dmlc/mshadow

How to safely free the space of the Tensor

zhangmeishan opened this issue · 4 comments

When I do not know whether t has been allocated, how I free?
if (t.dptr_ != NULL) FreeSpace(&t)
or
if(t.stream_ != NULL) FreeSpace(&t)
Anyone correct or some other method?
Thanks.

Use tensor container instead of raw tensor
On Fri, Jul 1, 2016 at 20:47 zhangmeishan notifications@github.com wrote:

When I do not know whether t has been allocated, how I free?
if (t.dptr_ != NULL) FreeSpace(&t)
or
if(t.stream_ != NULL) FreeSpace(&t)
Anyone correct or some other method?
Thanks.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#144, or mute the thread
https://github.com/notifications/unsubscribe/ABM13rAal_-2S2qh3vehgsvV_8XQeYtjks5qRd9OgaJpZM4JDl9P
.

Sent from mobile phone

If raw tensor is required? So how?

I think that "if (t.dptr_ != NULL) FreeSpace(&t)" is better, but I should assign default NULL value for dptr_ in the construct function of Tensor.

yes, you are right