* [tf2tflite] Schema for additional info of Custom Op from user
This is a schema for additional info of Custom Op from user.
It was committed into _moco-tf_ but moved to here.
The name was renamed to CompileInfo.pbtxt (Previous name was Model.MetaInfo.pbtxt), which seems more friendlier. :-)
Signed-off-by: Hyun Sik Yoon <hyunsik.yoon@samsung.com>
* renaming CompileInfo to CustomInfo && move ./proto/CMakeFiles.txt to ./CMakeFiles.txt
* modify DT_INT32 to 15
return()
endif(NOT TARGET exo_tflite)
+nncc_find_package(Protobuf QUIET)
+
+if(NOT Protobuf_FOUND)
+ return()
+endif(NOT Protobuf_FOUND)
+
+# generating and building schema for CustomOp.info
+Protobuf_Generate(CUSTOMOP_INFO_PROTO
+ "${CMAKE_CURRENT_BINARY_DIR}/generated"
+ "./proto"
+ CustomOpInfo.proto)
+
+add_library(tf2tflite_customop_info_proto STATIC ${CUSTOMOP_INFO_PROTO_SOURCES})
+set_target_properties(tf2tflite_customop_info_proto PROPERTIES POSITION_INDEPENDENT_CODE ON)
+target_include_directories(tf2tflite_customop_info_proto PUBLIC ${CUSTOMOP_INFO_PROTO_INCLUDE_DIRS})
+target_link_libraries(tf2tflite_customop_info_proto PUBLIC libprotobuf)
+
file(GLOB_RECURSE SOURCES "src/*.cpp")
add_executable(tf2tflite ${SOURCES})
--- /dev/null
+syntax = "proto3";
+
+package tf2tflite;
+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 }
+ }
+ }
+ }
+ }
+*/
+
+enum DataType {
+ // Not a legal value for DataType. Used to indicate a DataType field
+ // has not been set.
+ DT_INVALID = 0;
+
+ DT_FLOAT = 1;
+ DT_INT32 = 15; // Set to 15, considering possibility for reordering. 10 for INT, 10+N for INT 2^N
+ // TODO Support more types
+}
+
+message ShapeProto {
+ message Dim {
+ int64 size = 1; // tensorflow uses int64
+ };
+
+ repeated Dim dim = 2;
+}
+
+message AttrValue {
+ oneof value {
+ ShapeProto shape = 1;
+ DataType type = 2;
+ }
+}
+
+message CustomOpDef {
+ string name = 1;
+ string op = 2;
+ map<string, AttrValue> attr = 3;
+}
+
+message CustomOpInfoDef {
+ repeated CustomOpDef custom_op = 1;
+}