/** * Copyright 2019 Huawei Technologies Co., Ltd * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ include "op.fbs"; namespace mindspore.predict; enum MSCONST: int { WEIGHT_REFCOUNT = 999 } table QuantParam { scale: double; zeroPoint: int; min: double = 0; max: double = 0; narrowRange: bool = true; numBits: int = 8; } table QuantParamArray { param: [QuantParam]; //pre-channel } table TensorDef { // data type dataType: DataType; // shape dims: [int]; format: Format; refCount: int; offset: int; data: [ubyte]; } union OpT { Concat, SoftMax, Activation, Conv2D, FusedBatchNorm, CaffeBatchNorm, BiasAdd, Pooling, DepthwiseConv2D, DeDepthwiseConv2D, Resize, DetectionPostProcess, FullConnection, Mean, DeConv2D, Scale, Reshape, Eltwise, NetOutput, Add, Sub, MatMul, StridedSlice, Power, Slice, Stack, Mul, RealDiv, Pad, Maximum, Minimum, CaffePReLU, LeakyReLU, ArgMax, ArgMin, Exp, CaffeCrop, Range, Rsqrt, ExpandDims, Tile, Cast, Shape, Nchw2Nhwc, Nhwc2Nchw, QuantDTypeCast, Split, Permute, FakeQuantWithMinMaxVars, Equal, Less, Greater, Min, Floor, Abs, Neg, Cos, Sin, Sqrt, Square, Constant, Log, Tan, Atan, Asin, Clip, Transpose, Squeeze, Unsqueeze, Upsample, Dropout, Broadcast, Lrn, Prelu, ZerosLike, TopK, SpaceToDepth, SpaceToBatch, SparseToDense, ReverseSequence, Rank, Gather, GatherNd, Fill, Elu, DepthToSpace, BatchToSpace, AddN, Ceil, EmbeddingLookup, EmbeddingLookupSparse, FloorDiv, FloorMod, L2Norm, LocalResponseNormalization, MatrixDiag, Reduce, Reverse, Round, Select, Scatter, Unique, Unstack, LogicalAnd, LogicalOr, LogicalXor, LogicalNot, OnnxInt8Quantize, OnnxInt8Dequantize, FakeQuantWithMinMax, FakeQuantWithMinMaxPerChannel, BatchNormFold, MulFold, AddFold, SquaredDifference } enum QuantType: int { QUANT_NONE, AwareTrainning, WeightQuant, PostTraining } enum FmkType: int { TF, CAFFE, ONNX, MS, TFLITE } table OpDef { name: string; fmkType: FmkType; attr: OpT; inputIndex: [uint]; outputIndex: [uint]; quantType: QuantType = QUANT_NONE; quantParam: [QuantParamArray]; } table SubGraphDef { name: string; inputIndex: [uint]; outputIndex: [uint]; mempoolSize: uint; nodes: [OpDef]; allTensors: [TensorDef]; // weight + input + output } table MempoolCfg { size: uint; shiftFactor: uint; } table GraphDef { name: string; mempoolCfg: MempoolCfg; subgraphs: [SubGraphDef]; } root_type GraphDef;