Does Caffe copies top blob memory from Python Data layer?

179 views
Skip to first unread message

Ilya Zhenin

unread,
Sep 13, 2016, 10:24:23 AM9/13/16
to Caffe Users
I wrote Python Data layer and at setup stage creating batch array(e.g. (256,3,224,224)) where I store data, rewriting this array memory every time when reshape function is called, not allocating new memory every time.
I think it is fine if caffe copies this memory array somewhere for its use, not modifying this memory location and do not calling reshape before this memory copied. Is everything fine with this logic?

Evan Shelhamer

unread,
Sep 14, 2016, 1:16:31 PM9/14/16
to Ilya Zhenin, Caffe Users
Sorry, I'm not entirely sure about your question. As you as you reshape and assign a top Caffe by `top[0].data[...] = arr` will be able to make use of the array. However, if your net is running on CPU it will not make its own copy of `arr` but instead share the array, so that you should not modify `arr` until the forward/backward/solver computation is done for that input. On GPU Caffe has to make a copy, since it is transferring memory from a numpy array on CPU to the GPU.

Evan Shelhamer





On Tue, Sep 13, 2016 at 7:24 AM, Ilya Zhenin <inf.s...@gmail.com> wrote:
I wrote Python Data layer and at setup stage creating batch array(e.g. (256,3,224,224)) where I store data, rewriting this array memory every time when reshape function is called, not allocating new memory every time.
I think it is fine if caffe copies this memory array somewhere for its use, not modifying this memory location and do not calling reshape before this memory copied. Is everything fine with this logic?

--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users+unsubscribe@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/ec996770-125a-4f60-993e-68e1ac098b2f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages