net
authorYangqing Jia <jiayq84@gmail.com>
Fri, 27 Sep 2013 00:01:08 +0000 (17:01 -0700)
committerYangqing Jia <jiayq84@gmail.com>
Fri, 27 Sep 2013 00:01:08 +0000 (17:01 -0700)
src/caffe/blob.cpp
src/caffe/net.hpp
src/caffe/test/test_net_proto.cpp

index 0a00ce5..8260fe0 100644 (file)
@@ -87,6 +87,7 @@ template <typename Dtype>
 void Blob<Dtype>::Update() {
   // not implemented yet.
   LOG(FATAL) << "not implemented";
+  // We will perform update based on where the data is located.
 }
 
 template <typename Dtype>
index 45ea708..a653df5 100644 (file)
@@ -38,11 +38,15 @@ class Net {
   void ToProto(NetParameter* param, bool write_diff = false);
 
   // returns the network name.
-  const string& name() { return name_; }
+  inline const string& name() { return name_; }
   // returns the layer names
-  const vector<string>& layer_names() { return layer_names_; }
+  inline const vector<string>& layer_names() { return layer_names_; }
   // returns the blob names
-  const vector<string>& blob_names() { return blob_names_; }
+  inline const vector<string>& blob_names() { return blob_names_; }
+  // returns the blobs
+  inline const vector<shared_ptr<Blob<Dtype> > >& blobs() { return blobs_; }
+  // rethrns the layers
+  inline const vector<shared_ptr<Layer<Dtype> > >& layers() { return layers_; }
 
  protected:
   // Individual layers in the net
index b328d3a..f53107e 100644 (file)
@@ -42,6 +42,14 @@ TYPED_TEST(NetProtoTest, TestSetup) {
   Net<TypeParam> caffe_net(net_param, bottom_vec);
   EXPECT_EQ(caffe_net.layer_names().size(), 9);
   EXPECT_EQ(caffe_net.blob_names().size(), 10);
+
+  for (int i = 0; i < caffe_net.blobs().size(); ++i) {
+    LOG(ERROR) << "Blob: " << caffe_net.blob_names()[i];
+    LOG(ERROR) << "size: " << caffe_net.blobs()[i]->num() << ", "
+        << caffe_net.blobs()[i]->channels() << ", "
+        << caffe_net.blobs()[i]->height() << ", "
+        << caffe_net.blobs()[i]->width();
+  }
 }
 
 }  // namespace caffe