Skip to content

Commit

Permalink
Merge pull request #5904 from longjon/gpu-ptr
Browse files Browse the repository at this point in the history
Expose GPU pointers to Python
  • Loading branch information
shelhamer committed Sep 19, 2017
2 parents ea455eb + 8bdc87f commit effcdb0
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions python/caffe/_caffe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,14 @@ BOOST_PYTHON_MODULE(_caffe) {
.add_property("count", static_cast<int (Blob<Dtype>::*)() const>(
&Blob<Dtype>::count))
.def("reshape", bp::raw_function(&Blob_Reshape))
#ifndef CPU_ONLY
.add_property("_gpu_data_ptr",
reinterpret_cast<uintptr_t (Blob<Dtype>::*)()>(
&Blob<Dtype>::mutable_gpu_data))
.add_property("_gpu_diff_ptr",
reinterpret_cast<uintptr_t (Blob<Dtype>::*)()>(
&Blob<Dtype>::mutable_gpu_diff))
#endif
.add_property("data", bp::make_function(&Blob<Dtype>::mutable_cpu_data,
NdarrayCallPolicies()))
.add_property("diff", bp::make_function(&Blob<Dtype>::mutable_cpu_diff,
Expand Down

0 comments on commit effcdb0

Please sign in to comment.