Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Exposing layer top and bottom names to python #2865
Conversation
longjon
added the
Python
label
Aug 5, 2015
|
Seems like a reasonable thing to expose to pycaffe. A couple questions:
|
|
thanks for the feedback. As for the C++ exposition, I didn't see a way of exposing it to python without exposing something to C++, but I'm open to suggestions. |
longjon
commented on an outdated diff
Jan 5, 2016
| @@ -149,6 +149,16 @@ class Net { | ||
| inline const vector<vector<Blob<Dtype>*> >& top_vecs() const { | ||
| return top_vecs_; | ||
| } | ||
| + /// @brief returns the ids of the top blobs of layer i | ||
| + inline const vector<int> & top_ids(int i) const { | ||
| + CHECK_LT(i, top_id_vecs_.size()) << "Invalid layer id"; |
|
|
longjon
and 1 other
commented on an outdated diff
Jan 5, 2016
| @@ -276,6 +276,22 @@ def _Net_batch(self, blobs): | ||
| padding]) | ||
| yield padded_batch | ||
| + | ||
| +class _Net_IdNameWrapper: | ||
| + """ | ||
| + A simple wrapper that allows the ids propery to be accessed as a dict | ||
| + indexed by names. Used for top and bottom names | ||
| + """ | ||
| + def __init__(self, net, func): | ||
| + self.net, self.func = net, func | ||
| + | ||
| + def __getitem__(self, name): | ||
| + # Map the layer name to id |
|
|
|
The new patch looks pretty reasonable; comments as noted. Also:
|
|
Not sure where to compute the |
|
Right, due to the awkwardness of the current method rewriting scheme, it would need to be done in a similar way to the other |
longjon
added a commit
that referenced
this pull request
Jan 8, 2016
|
|
longjon |
917ef33
|
longjon
merged commit 917ef33
into
BVLC:master
Jan 8, 2016
1 check passed
|
Okay, I'll go ahead and merge as is; while it would be nice to have Thanks for this exposure @philkr! |
philkr commentedAug 5, 2015
This PR allows the python interface to access the top and bottom blob names, which makes the data flow a bit more explicit in python.