[moco/tf] Processing the schama file for model metainfo file (#4137)
author윤현식/On-Device Lab(SR)/Principal Engineer/삼성전자 <hyunsik.yoon@samsung.com>
Mon, 8 Jul 2019 22:03:44 +0000 (07:03 +0900)
committer박세희/On-Device Lab(SR)/Principal Engineer/삼성전자 <saehie.park@samsung.com>
Mon, 8 Jul 2019 22:03:44 +0000 (07:03 +0900)
This commit adds schema file and CMakeLists for processing model metainfo file.

Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
contrib/moco-tf/proto/CMakeLists.txt
contrib/moco-tf/proto/ModelMetainfo.proto [new file with mode: 0644]

index 2053a68..a507498 100644 (file)
@@ -20,3 +20,17 @@ add_library(moco_tf_proto STATIC ${GRAPHDEF_PROTO_SOURCES})
 set_target_properties(moco_tf_proto PROPERTIES POSITION_INDEPENDENT_CODE ON)
 target_include_directories(moco_tf_proto PUBLIC ${GRAPHDEF_PROTO_INCLUDE_DIRS})
 target_link_libraries(moco_tf_proto PUBLIC libprotobuf)
+
+# handling ModelMetainfo.proto
+unset(PROTO_FILES)
+list(APPEND PROTO_FILES ModelMetainfo.proto)
+
+Protobuf_Generate(MODEL_META_PROTO
+                  "${CMAKE_CURRENT_BINARY_DIR}/generated"
+                  "./"
+                  ${PROTO_FILES})
+
+add_library(moco_tf_model_metainfo_proto STATIC ${MODEL_META_PROTO_SOURCES})
+set_target_properties(moco_tf_model_metainfo_proto PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(moco_tf_model_metainfo_proto PUBLIC ${MODEL_META_PROTO_INCLUDE_DIRS})
+target_link_libraries(moco_tf_model_metainfo_proto PUBLIC libprotobuf)
diff --git a/contrib/moco-tf/proto/ModelMetainfo.proto b/contrib/moco-tf/proto/ModelMetainfo.proto
new file mode 100644 (file)
index 0000000..9bf0d33
--- /dev/null
@@ -0,0 +1,46 @@
+syntax = "proto3";
+
+ package moco;
+option cc_enable_arenas = true;
+
+ /* example of prototxt file
+     custom_op {
+      name: "my/customOp/000"
+      op: "new_custom_op"
+      attr {
+        key: "output_shape"
+        value {
+          shape {
+            dim { size: 1 }
+            dim { size: 2 }
+            dim { size: 1 }
+            dim { size: 2 }
+          }
+        }
+      }
+    }
+*/
+
+ message ShapeProto {
+  message Dim {
+    int64 size = 1; // tensorflow uses int64
+  };
+
+   repeated Dim dim = 2;
+}
+
+ message AttrValue {
+  oneof value {
+    ShapeProto shape = 1;
+  }
+}
+
+ message CustomOpDef {
+  string name = 1;
+  string op = 2;
+  map<string, AttrValue> attr = 3;
+}
+
+ message ModelMetaDef {
+  repeated CustomOpDef custom_op = 1;
+}