]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - jacinto-ai/caffe-jacinto.git/blobdiff - src/caffe/test/test_net_proto.cpp
a bunch of updates.
[jacinto-ai/caffe-jacinto.git] / src / caffe / test / test_net_proto.cpp
index 013bd67ae51bb81edf811e78d30ec86514d4b2df..cd16ed659091ee5fbb75a95b94fc4045f97b63da 100644 (file)
@@ -1,15 +1,19 @@
 // Copyright 2013 Yangqing Jia
 
-#include <cstring>
 #include <cuda_runtime.h>
+#include <fcntl.h>
 #include <google/protobuf/text_format.h>
+#include <google/protobuf/io/zero_copy_stream_impl.h>
 #include <gtest/gtest.h>
 
+#include <cstring>
+
 #include "caffe/blob.hpp"
 #include "caffe/common.hpp"
 #include "caffe/net.hpp"
 #include "caffe/filler.hpp"
 #include "caffe/proto/caffe.pb.h"
+#include "caffe/util/io.hpp"
 
 #include "caffe/test/lenet.hpp"
 #include "caffe/test/test_caffe_main.hpp"
@@ -22,6 +26,11 @@ class NetProtoTest : public ::testing::Test {};
 typedef ::testing::Types<float, double> Dtypes;
 TYPED_TEST_CASE(NetProtoTest, Dtypes);
 
+TYPED_TEST(NetProtoTest, TestLoadFromText) {
+  NetParameter net_param;
+  ReadProtoFromTextFile("caffe/test/data/lenet.prototxt", &net_param);
+}
+
 TYPED_TEST(NetProtoTest, TestSetup) {
   NetParameter net_param;
   string lenet_string(kLENET);
@@ -30,8 +39,7 @@ TYPED_TEST(NetProtoTest, TestSetup) {
       lenet_string, &net_param));
   // check if things are right
   EXPECT_EQ(net_param.layers_size(), 9);
-  EXPECT_EQ(net_param.bottom_size(), 2);
-  EXPECT_EQ(net_param.top_size(), 0);
+  EXPECT_EQ(net_param.input_size(), 2);
 
   // Now, initialize a network using the parameter
   shared_ptr<Blob<TypeParam> > data(new Blob<TypeParam>(10, 1, 28, 28));
@@ -62,10 +70,9 @@ TYPED_TEST(NetProtoTest, TestSetup) {
   // Run the network without training.
   vector<Blob<TypeParam>*> top_vec;
   LOG(ERROR) << "Performing Forward";
-  caffe_net.Forward(bottom_vec, &top_vec);
+  caffe_net.Forward(bottom_vec);
   LOG(ERROR) << "Performing Backward";
   LOG(ERROR) << caffe_net.Backward();
-
 }
 
 }  // namespace caffe