From 6b22bd99385235861eb11b7708ea3cbb8599674f Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9C=A4=ED=98=84=EC=8B=9D/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Tue, 9 Jul 2019 07:03:44 +0900 Subject: [PATCH] [moco/tf] Processing the schama file for model metainfo file (#4137) This commit adds schema file and CMakeLists for processing model metainfo file. Signed-off-by: Hyun Sik Yoon --- contrib/moco-tf/proto/CMakeLists.txt | 14 ++++++++++ contrib/moco-tf/proto/ModelMetainfo.proto | 46 +++++++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 contrib/moco-tf/proto/ModelMetainfo.proto diff --git a/contrib/moco-tf/proto/CMakeLists.txt b/contrib/moco-tf/proto/CMakeLists.txt index 2053a68..a507498 100644 --- a/contrib/moco-tf/proto/CMakeLists.txt +++ b/contrib/moco-tf/proto/CMakeLists.txt @@ -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 index 0000000..9bf0d33 --- /dev/null +++ b/contrib/moco-tf/proto/ModelMetainfo.proto @@ -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 attr = 3; +} + + message ModelMetaDef { + repeated CustomOpDef custom_op = 1; +} -- 2.7.4