Skip to content

Commit

Permalink
[pycaffe] expose Blob.Reshape
Browse files Browse the repository at this point in the history
While this function should never be called in the current interface, it
will be necessary to have when embedding Python.
  • Loading branch information
longjon committed Aug 31, 2014
1 parent bae9c2c commit e379c39
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions python/caffe/_caffe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,7 @@ BOOST_PYTHON_MODULE(_caffe) {
.add_property("height", &PyBlob<float>::height)
.add_property("width", &PyBlob<float>::width)
.add_property("count", &PyBlob<float>::count)
.def("reshape", &PyBlob<float>::Reshape)
.add_property("data", &PyBlobWrap::get_data)
.add_property("diff", &PyBlobWrap::get_diff);

Expand Down
3 changes: 3 additions & 0 deletions python/caffe/_caffe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ class PyBlob {
int height() const { return blob_->height(); }
int width() const { return blob_->width(); }
int count() const { return blob_->count(); }
void Reshape(const int n, const int c, const int h, const int w) {
return blob_->Reshape(n, c, h, w);
}

// this is here only to satisfy boost's vector_indexing_suite
bool operator == (const PyBlob &other) {
Expand Down

0 comments on commit e379c39

Please sign in to comment.