From e379c3917dfc2dd003b09f885e2b33878de8fa34 Mon Sep 17 00:00:00 2001 From: Jonathan L Long Date: Sun, 31 Aug 2014 01:14:58 -0700 Subject: [PATCH] [pycaffe] expose Blob.Reshape While this function should never be called in the current interface, it will be necessary to have when embedding Python. --- python/caffe/_caffe.cpp | 1 + python/caffe/_caffe.hpp | 3 +++ 2 files changed, 4 insertions(+) diff --git a/python/caffe/_caffe.cpp b/python/caffe/_caffe.cpp index 5f18ff63b4e..9c61ea869b9 100644 --- a/python/caffe/_caffe.cpp +++ b/python/caffe/_caffe.cpp @@ -172,6 +172,7 @@ BOOST_PYTHON_MODULE(_caffe) { .add_property("height", &PyBlob::height) .add_property("width", &PyBlob::width) .add_property("count", &PyBlob::count) + .def("reshape", &PyBlob::Reshape) .add_property("data", &PyBlobWrap::get_data) .add_property("diff", &PyBlobWrap::get_diff); diff --git a/python/caffe/_caffe.hpp b/python/caffe/_caffe.hpp index cd567b665c2..2df47c7cec5 100644 --- a/python/caffe/_caffe.hpp +++ b/python/caffe/_caffe.hpp @@ -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) {