om.proto 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204
  1. syntax = "proto3";
  2. package ge.proto;
  3. enum DataType
  4. {
  5. DT_UNDEFINED = 0; // Used to indicate a DataType field has not been set.
  6. DT_FLOAT = 1; // float type
  7. DT_FLOAT16 = 2; // fp16 type
  8. DT_INT8 = 3; // int8 type
  9. DT_UINT8 = 4; // uint8 type
  10. DT_INT16 = 5; // int16 type
  11. DT_UINT16 = 6; // uint16 type
  12. DT_INT32 = 7; //
  13. DT_INT64 = 8; // int64 type
  14. DT_UINT32 = 9; // unsigned int32
  15. DT_UINT64 = 10; // unsigned int64
  16. DT_BOOL = 11; // bool type
  17. DT_DOUBLE = 12; // double type
  18. DT_STRING = 13; // string type
  19. DT_DUAL_SUB_INT8 = 14; /**< dual output int8 type */
  20. DT_DUAL_SUB_UINT8 = 15; /**< dual output uint8 type */
  21. DT_COMPLEX64 = 16; // complex64 type
  22. DT_COMPLEX128 = 17; // complex128 type
  23. DT_QINT8 = 18; // qint8 type
  24. DT_QINT16 = 19; // qint16 type
  25. DT_QINT32 = 20; // qint32 type
  26. DT_QUINT8 = 21; // quint8 type
  27. DT_QUINT16 = 22; // quint16 type
  28. DT_RESOURCE = 23; // resource type
  29. DT_STRING_REF = 24; // string_ref type
  30. DT_DUAL = 25; /**< dual output type */
  31. DT_VARIANT = 26; // variant type
  32. DT_BF16 = 27; // bf16 type
  33. DT_INT4 = 28; // int4 type
  34. DT_UINT1 = 29; // uint1 type
  35. DT_INT2 = 30; // int2 type
  36. DT_UINT2 = 31; // uint2 type
  37. }
  38. message AttrDef
  39. {
  40. message ListValue
  41. {
  42. enum ListValueType{
  43. VT_LIST_NONE = 0;
  44. VT_LIST_STRING = 1;
  45. VT_LIST_INT = 2;
  46. VT_LIST_FLOAT = 3;
  47. VT_LIST_BOOL = 4;
  48. VT_LIST_BYTES = 5;
  49. VT_LIST_TENSOR_DESC = 6;
  50. VT_LIST_TENSOR = 7;
  51. VT_LIST_GRAPH = 8;
  52. VT_LIST_NAMED_ATTRS = 9;
  53. VT_LIST_DATA_TYPE = 10;
  54. }
  55. repeated bytes s = 2; // "list(string)"
  56. repeated int64 i = 3; // "list(int)"
  57. repeated float f = 4; // "list(float)"
  58. repeated bool b = 5; // "list(bool)"
  59. repeated bytes bt = 7;
  60. repeated TensorDescriptor td = 8;
  61. repeated TensorDef t = 9;
  62. repeated GraphDef g = 10;
  63. repeated NamedAttrs na = 11;
  64. repeated int64 dt = 12; // list ge::DataType
  65. ListValueType val_type = 20;
  66. }
  67. message ListListInt{
  68. message ListInt{
  69. repeated int64 list_i = 1; // list int
  70. }
  71. repeated ListInt list_list_i = 1; // list list int
  72. }
  73. message ListListFloat{
  74. message ListFloat{
  75. repeated float list_f = 1; // list float
  76. }
  77. repeated ListFloat list_list_f = 1; // list list float
  78. }
  79. oneof value
  80. {
  81. bytes s = 2; // "string"
  82. int64 i = 3; // "int"
  83. float f = 4; // "float"
  84. bool b = 5; // "bool"
  85. bytes bt = 7;
  86. ListValue list = 1; // any "list(...)"
  87. NamedAttrs func = 10; // Used to support attr nesting
  88. TensorDescriptor td = 11; // GeTensorDesc type
  89. TensorDef t = 12; // GeTensor type
  90. GraphDef g = 13; // Graph type
  91. ListListInt list_list_int = 14; // List List Int type
  92. int64 dt = 15; // ge::DataType
  93. ListListFloat list_list_float = 16; // List List Float type
  94. }
  95. }
  96. // A list of attr names and their values. The whole list is attached
  97. // with a string name. E.g., MatMul[T=float].
  98. message NamedAttrs
  99. {
  100. string name = 1;
  101. map<string, AttrDef> attr = 2;
  102. }
  103. // Shape / dimension description, using row-major order
  104. message ShapeDef
  105. {
  106. repeated int64 dim = 1; // Size of each dimension
  107. }
  108. // Multidimensional data description
  109. message TensorDescriptor
  110. {
  111. string name = 1; // Optional parameter, tensor name
  112. DataType dtype = 2; // tensor datatype
  113. ShapeDef shape = 3; // Shape / dimension
  114. string layout = 4; // Tensor format, eg: "NCHW", "NHWC", "CHW", "ND"
  115. bool has_out_attr = 9;
  116. int64 size = 10;
  117. int64 weight_size = 11;
  118. bool reuse_input = 12;
  119. bool output_tensor = 13;
  120. string device_type = 14;
  121. bool input_tensor =15;
  122. int64 real_dim_cnt = 16;
  123. int64 reuse_input_index = 17;
  124. int64 data_offset = 18;
  125. int64 cmps_size = 19;
  126. string cmps_tab = 20;
  127. int64 cmps_tab_offset = 21;
  128. map<string, AttrDef> attr = 5; // Set of extra parameter fields
  129. }
  130. // GeTensor definition
  131. message TensorDef
  132. {
  133. TensorDescriptor desc = 1; // Tensor description
  134. bytes data = 2; // Tensor data
  135. }
  136. // Operator description
  137. message OpDef
  138. {
  139. string name = 1; // name
  140. string type = 2; // type
  141. repeated string input = 5; // input original op name + outgoing index. op_name:index
  142. map<string, AttrDef> attr = 10; // Set of operator parameter fields
  143. bool has_out_attr = 20;
  144. int64 id = 21;
  145. int64 stream_id =22;
  146. repeated string input_name = 23;
  147. repeated string src_name = 24;
  148. repeated int64 src_index = 25;
  149. repeated string dst_name = 26;
  150. repeated int64 dst_index = 27;
  151. repeated int64 input_i = 28;
  152. repeated int64 output_i = 29;
  153. repeated int64 workspace = 30;
  154. repeated int64 workspace_bytes = 31;
  155. repeated bool is_input_const = 32;
  156. repeated TensorDescriptor input_desc = 33;
  157. repeated TensorDescriptor output_desc = 34;
  158. repeated string subgraph_name = 35;
  159. }
  160. // Graph definition
  161. message GraphDef
  162. {
  163. string name = 1; // name
  164. repeated string input = 4; // Graph input
  165. repeated string output = 5; // Graph output
  166. repeated OpDef op = 6; // List of operators
  167. map<string, AttrDef> attr = 11; // Extended field
  168. }
  169. // model definition
  170. message ModelDef
  171. {
  172. string name = 1; // name
  173. uint32 version = 2; // IR Proto verion
  174. string custom_version = 3; // User model version number, passed in by user
  175. repeated GraphDef graph = 7; // Graph definition,graph[0] represents the main diagram in modeldef
  176. map<string, AttrDef> attr = 11; // Extended field
  177. }