[enco] Extract PoolingParmeter importer (#1471)
author박종현/동작제어Lab(SR)/Staff Engineer/삼성전자 <jh1302.park@samsung.com>
Wed, 12 Sep 2018 22:32:39 +0000 (07:32 +0900)
committerGitHub Enterprise <noreply-CODE@samsung.com>
Wed, 12 Sep 2018 22:32:39 +0000 (07:32 +0900)
This commit extracts PoolingParameter importer implemented in
PoolingSpec test as a library routine.

Signed-off-by: Jonghyun Park <jh1302.park@samsung.com>
contrib/enco/frontend/caffe/src/Importer.cpp
contrib/enco/frontend/caffe/src/Importer.h
contrib/enco/frontend/caffe/src/PoolingSpec.test.cpp

index 79dd41c..d79d3cc 100644 (file)
@@ -28,3 +28,9 @@ bool from_bin(std::istream &is, ::caffe::NetParameter &param)
 
   return true;
 }
+
+bool from_txt(std::istream &is, ::caffe::PoolingParameter &param)
+{
+  ::google::protobuf::io::IstreamInputStream iis{&is};
+  return google::protobuf::TextFormat::Parse(&iis, &param);
+}
index f0caea3..6ce9bf6 100644 (file)
@@ -8,4 +8,6 @@
 bool from_txt(std::istream &is, ::caffe::NetParameter &param);
 bool from_bin(std::istream &is, ::caffe::NetParameter &param);
 
+bool from_txt(std::istream &is, ::caffe::PoolingParameter &param);
+
 #endif // __IMPORTER_H__
index 687589f..d71a8c4 100644 (file)
@@ -20,21 +20,15 @@ using nncc::foundation::make_unique;
 
 #define STRING(content) #content
 
-namespace
-{
-
-bool from_txt(std::istream &is, ::caffe::PoolingParameter &pooling)
-{
-  ::google::protobuf::io::IstreamInputStream iis{&is};
-  return google::protobuf::TextFormat::Parse(&iis, &pooling);
-}
-
-template <typename T> bool from_txt(const std::string &txt, T &out)
+bool from_txt(const std::string &txt, ::caffe::PoolingParameter &out)
 {
   std::stringstream ss{txt};
   return from_txt(ss, out);
 }
 
+namespace
+{
+
 class SequentialBuilder
 {
 public: