You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ms.fbs 2.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * Copyright 2019 Huawei Technologies Co., Ltd
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. include "op.fbs";
  17. namespace mindspore.predict;
  18. enum DataType : int {
  19. DT_FLOAT = 0,
  20. DT_FLOAT16 = 1,
  21. DT_INT8 = 2,
  22. DT_INT32 = 3,
  23. DT_UINT8 = 4,
  24. DT_UINT32 = 8,
  25. DT_UNDEFINED = 16
  26. }
  27. enum Format : int {
  28. NCHW = 0,
  29. NHWC,
  30. NC4HW4 = 100,
  31. NUM_OF_FORMAT
  32. }
  33. enum MSConst: int {
  34. WEIGHT_REFCOUNT = 999
  35. }
  36. table QuantizationDef {
  37. // Quantized value q, corresponding float value r:
  38. // r = scale * (q - zero_point), where scale = (rmax - rmin) / (qmax - qmin)
  39. min: [float];
  40. max: [float];
  41. scale: [float];
  42. zero_point: [long];
  43. // Tensor shape of the specifies dimension.
  44. dimension: int;
  45. }
  46. table TensorDef {
  47. // data type
  48. dataType: DataType;
  49. // shape
  50. dims: [int];
  51. format: Format;
  52. refCount: int;
  53. offset: int;
  54. data: [ubyte];
  55. quantization: QuantizationDef;
  56. }
  57. union OpT {
  58. Concat,
  59. SoftMax,
  60. Activation,
  61. Conv2D,
  62. FusedBatchNorm,
  63. CaffeBatchNorm,
  64. Squeeze,
  65. BiasAdd,
  66. Pooling,
  67. DepthwiseConv2D,
  68. DeDepthwiseConv2D,
  69. Resize,
  70. DetectionPostProcess,
  71. FullConnection,
  72. Mean,
  73. DeConv2D,
  74. Scale,
  75. Reshape,
  76. Eltwise,
  77. NetOutput,
  78. Add,
  79. MatMul,
  80. StridedSlice,
  81. Power,
  82. Slice,
  83. Stack,
  84. Mul,
  85. Pad,
  86. Maximum,
  87. CaffePReLU,
  88. ArgMax,
  89. Exp,
  90. CaffeCrop,
  91. Range,
  92. ExpandDims,
  93. Tile,
  94. Cast
  95. // Split
  96. }
  97. enum QuantType: int {
  98. QUANT_NONE,
  99. QUANT_INT8
  100. }
  101. table OpDef {
  102. name: string;
  103. attr: OpT;
  104. inputIndex: [uint];
  105. outputIndex: [uint];
  106. isLastConv: bool;
  107. quantType: QuantType = QUANT_NONE;
  108. }
  109. enum FmkType: int {
  110. TF,
  111. CAFFE
  112. }
  113. table NodeDef {
  114. fmkType: FmkType;
  115. opDef: OpDef;
  116. }
  117. table SubGraphDef {
  118. name: string;
  119. inputIndex: [uint];
  120. outputIndex: [uint];
  121. mempoolSize: uint;
  122. nodes: [NodeDef];
  123. allTensors: [TensorDef]; // weight + input + output
  124. }
  125. table MempoolCfg {
  126. size: uint;
  127. shiftFactor: uint;
  128. }
  129. table GraphDef {
  130. name: string;
  131. mempoolCfg: MempoolCfg;
  132. subgraphs: [SubGraphDef];
  133. }
  134. root_type GraphDef;