Supporting Blobs with num_axes() != 4 in pycaffe interface #3703

Merged
merged 1 commit into from Feb 25, 2016

Conversation

Projects
None yet
2 participants
Contributor

shaibagon commented Feb 23, 2016

Currently, Blobs (especially inputs to net) with num_axes() != 4 are not supported by pycaffe interface.
This is because pycaffe uses .num property of Blob that is only supported for 4D Blobs.

This PR attempts to correct this by removing all references to Blob.num property (that assumes Blob is 4D).
Replacing it with accessing Blob.shape[0] that is good also for Blobs with num_axes() != 4

This is a very minor change code-wise

@shaibagon shaibagon removing all references to Blob.num property (that assumes Blob is 4D…
…). Replacing it with accessing Blob.shape[0] - for Blobs with num_axes() != 4
29bb23f

shelhamer added the Python label Feb 25, 2016

Owner

shelhamer commented Feb 25, 2016

Thanks for this small patch to make the pycaffe keyword args work.

More precisely, this is only an issue for num_axes > 4 and when passing blobs= or diffs= keyword args to the pycaffe forward(), backward() respectively. The pycaffe blob interface, the Net.{blobs,params} properties, and Net.{forward(),backward()} methods all work in N-D.

@shelhamer shelhamer added a commit that referenced this pull request Feb 25, 2016

@shelhamer shelhamer Merge pull request #3703 from shaibagon/pycaffe_nd_blobs
[pycaffe] make pycaffe support N-D blobs throughout
08766ff

@shelhamer shelhamer merged commit 08766ff into BVLC:master Feb 25, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Contributor

shaibagon commented Feb 25, 2016

@shelhamer
Thanks for accepting this PR.

shaibagon deleted the shaibagon:pycaffe_nd_blobs branch Feb 25, 2016

@fxbit fxbit added a commit to Yodigram/caffe that referenced this pull request Sep 1, 2016

@shelhamer @fxbit shelhamer + fxbit Merge pull request #3703 from shaibagon/pycaffe_nd_blobs
[pycaffe] make pycaffe support N-D blobs throughout
c08f260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment