Add names to the blobs returned by CaffeLayer
authorJonathan L Long <jonlong@cs.berkeley.edu>
Tue, 11 Mar 2014 05:02:08 +0000 (22:02 -0700)
committerJonathan L Long <jonlong@cs.berkeley.edu>
Sat, 15 Mar 2014 09:28:07 +0000 (02:28 -0700)
Even though these are redundant, this keeps the meaning of
CaffeBlob.name consistent for now, and will allow CaffeBlob construction
to be simplified.

python/caffe/_caffe.cpp

index c5e9e84..c2a2618 100644 (file)
@@ -108,7 +108,11 @@ class CaffeLayer {
 
   string name() const { return name_; }
   vector<CaffeBlob> blobs() {
-    return vector<CaffeBlob>(layer_->blobs().begin(), layer_->blobs().end());
+    vector<CaffeBlob> result;
+    for (int i = 0; i < layer_->blobs().size(); ++i) {
+      result.push_back(CaffeBlob(layer_->blobs()[i], name_));
+    }
+    return result;
   }
 
   // this is here only to satisfy boost's vector_indexing_suite