Skip to content

Commit 633ad15

Browse files
committed
Merge pull request BVLC#2877 from jeffdonahue/pycaffe-shape-accessor
[pycaffe] add Blob shape accessor
2 parents 32ced4f + 50195e3 commit 633ad15

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

python/caffe/_caffe.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,11 @@ BOOST_PYTHON_MODULE(_caffe) {
230230

231231
bp::class_<Blob<Dtype>, shared_ptr<Blob<Dtype> >, boost::noncopyable>(
232232
"Blob", bp::no_init)
233+
.add_property("shape",
234+
bp::make_function(
235+
static_cast<const vector<int>& (Blob<Dtype>::*)() const>(
236+
&Blob<Dtype>::shape),
237+
bp::return_value_policy<bp::copy_const_reference>()))
233238
.add_property("num", &Blob<Dtype>::num)
234239
.add_property("channels", &Blob<Dtype>::channels)
235240
.add_property("height", &Blob<Dtype>::height)

0 commit comments

Comments
 (0)