From 96f0e5239e6ac3ac3e11b6f24fa6e8fa1700ffeb Mon Sep 17 00:00:00 2001 From: Yangqing Jia Date: Thu, 26 Sep 2013 17:01:08 -0700 Subject: [PATCH] net --- src/caffe/blob.cpp | 1 + src/caffe/net.hpp | 10 +++++++--- src/caffe/test/test_net_proto.cpp | 8 ++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/caffe/blob.cpp b/src/caffe/blob.cpp index 0a00ce5..8260fe0 100644 --- a/src/caffe/blob.cpp +++ b/src/caffe/blob.cpp @@ -87,6 +87,7 @@ template void Blob::Update() { // not implemented yet. LOG(FATAL) << "not implemented"; + // We will perform update based on where the data is located. } template diff --git a/src/caffe/net.hpp b/src/caffe/net.hpp index 45ea708..a653df5 100644 --- a/src/caffe/net.hpp +++ b/src/caffe/net.hpp @@ -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& layer_names() { return layer_names_; } + inline const vector& layer_names() { return layer_names_; } // returns the blob names - const vector& blob_names() { return blob_names_; } + inline const vector& blob_names() { return blob_names_; } + // returns the blobs + inline const vector > >& blobs() { return blobs_; } + // rethrns the layers + inline const vector > >& layers() { return layers_; } protected: // Individual layers in the net diff --git a/src/caffe/test/test_net_proto.cpp b/src/caffe/test/test_net_proto.cpp index b328d3a..f53107e 100644 --- a/src/caffe/test/test_net_proto.cpp +++ b/src/caffe/test/test_net_proto.cpp @@ -42,6 +42,14 @@ TYPED_TEST(NetProtoTest, TestSetup) { Net 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 -- 2.7.4