[caffegen] Do NOT depend on nncc_foundation (#1548)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Tue, 18 Sep 2018 08:01:52 +0000 (17:01 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Tue, 18 Sep 2018 08:01:52 +0000 (17:01 +0900)
This commit replaces all the use of nncc::foundation::make_unique with
stdex::make_unique in order to eliminate nncc_foundation dependency.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/caffegen/CMakeLists.txt
contrib/caffegen/src/Driver.cpp
contrib/caffegen/src/FillCommand.cpp
contrib/caffegen/src/MergeCommand.cpp
contrib/caffegen/src/internal/LayerResolver.cpp
contrib/caffegen/src/internal/NetworkBuilder.cpp

index fc7129c..ce8565e 100644 (file)
@@ -14,7 +14,7 @@ file(GLOB_RECURSE SOURCES "src/*.cpp")
 
 add_executable(caffegen ${SOURCES})
 target_include_directories(caffegen PRIVATE include)
-target_link_libraries(caffegen nncc_foundation)
+target_link_libraries(caffegen stdex)
 target_link_libraries(caffegen cli)
 target_link_libraries(caffegen caffeproto)
 target_link_libraries(caffegen caffe)
index 835bd35..9f8e78f 100644 (file)
@@ -5,22 +5,24 @@
 #include "MergeCommand.h"
 
 #include <cli/App.h>
-#include <nncc/foundation/Memory.h>
+#include <stdex/Memory.h>
 
 #include <map>
 #include <string>
 
+using stdex::make_unique;
+
 int main(int argc, char **argv)
 {
   cli::App app{argv[0]};
 
   // all receive data from stdin
-  app.insert("init", nncc::foundation::make_unique<InitCommand>());
-  app.insert("fill", nncc::foundation::make_unique<FillCommand>());
-  app.insert("encode", nncc::foundation::make_unique<EncodeCommand>());
-  app.insert("decode", nncc::foundation::make_unique<DecodeCommand>());
+  app.insert("init", make_unique<InitCommand>());
+  app.insert("fill", make_unique<FillCommand>());
+  app.insert("encode", make_unique<EncodeCommand>());
+  app.insert("decode", make_unique<DecodeCommand>());
   // takes 2 args: prototxt model and caffemodel weights in that order
-  app.insert("merge", nncc::foundation::make_unique<MergeCommand>());
+  app.insert("merge", make_unique<MergeCommand>());
 
   return app.run(argc - 1, argv + 1);
 }
index eb7d236..d599977 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <caffe/proto/caffe.pb.h>
 
-#include <nncc/foundation/Memory.h>
+#include <stdex/Memory.h>
 
 #include <google/protobuf/io/coded_stream.h>
 #include <google/protobuf/io/zero_copy_stream_impl.h>
 #include <random>
 #include <iostream>
 
+using stdex::make_unique;
+
 int FillCommand::run(int, const char *const *) const
 {
-  auto param = nncc::foundation::make_unique<::caffe::NetParameter>();
+  auto param = make_unique<::caffe::NetParameter>();
 
   // Read from standard input
   google::protobuf::io::FileInputStream is{0};
index 47eb64e..43c4bef 100644 (file)
@@ -1,6 +1,5 @@
 #include "MergeCommand.h"
 
-#include <nncc/foundation/Memory.h>
 #include <caffe/proto/caffe.pb.h>
 #include <caffe/caffe.hpp>
 
index 3e392ff..46cfa0e 100644 (file)
@@ -2,7 +2,9 @@
 #include "internal/InputLayer.h"
 #include "internal/ConvolutionLayer.h"
 
-#include <nncc/foundation/Memory.h>
+#include <stdex/Memory.h>
+
+using stdex::make_unique;
 
 template <typename T> std::shared_ptr<LayerFactory> make_factory(void)
 {
@@ -10,11 +12,11 @@ template <typename T> std::shared_ptr<LayerFactory> make_factory(void)
   {
     std::unique_ptr<Layer> make(Network *net, caffe::LayerParameter *p) const override
     {
-      return nncc::foundation::make_unique<T>(net, p);
+      return make_unique<T>(net, p);
     }
   };
 
-  return nncc::foundation::make_unique<LayerFactoryImpl>();
+  return make_unique<LayerFactoryImpl>();
 }
 
 LayerResolver::LayerResolver()
index f9613e4..20b0263 100644 (file)
@@ -1,6 +1,8 @@
 #include "internal/NetworkBuilder.h"
 
-#include <nncc/foundation/Memory.h>
+#include <stdex/Memory.h>
+
+using stdex::make_unique;
 
 NetworkBuilder::NetworkBuilder(const LayerResolver &resolver) : _resolver{resolver}
 {
@@ -9,7 +11,7 @@ NetworkBuilder::NetworkBuilder(const LayerResolver &resolver) : _resolver{resolv
 
 std::unique_ptr<Network> NetworkBuilder::build(std::unique_ptr<caffe::NetParameter> &&p)
 {
-  auto res = nncc::foundation::make_unique<Network>(std::move(p));
+  auto res = make_unique<Network>(std::move(p));
 
   for (int n = 0; n < res->param().layer_size(); ++n)
   {