1 // Copyright (c) 2019~2022 Samsung Electronics Co., Ltd. All Rights Reserved
2 // Copyright 2017 The TensorFlow Authors. All Rights Reserved.
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
8 // http://www.apache.org/licenses/LICENSE-2.0
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.
18 // Version Major.Minor
20 // Major version is schema version.
21 // We keep schema version if it is compatible
22 // Minor version is for human communication
23 // It will not be stored in circle model.
25 // Version 0.0: Initial version. Based on TensorFlow Lite v1.13.1 schema.
26 // Version 0.1: Based on TF v2.2-rc2 + more (from TensorFlow `56d281c`)
27 // `BATCH_MATMUL` operator, `FLOAT64` tensor type,
28 // `asymmetric_quantize_inputs` for several operator options
29 // Version 0.2: BCQ_GATHER and BCQ_FULLY_CONNECTED are added.
30 // Version 0.3: SHUFFLED16x1FLOAT32 is added.
31 // Version 0.4: Base up to TensorFlow Lite v2.7.0 schema.
35 // This corresponds to the version.
36 file_identifier "CIR0";
37 // File extension of any written files.
38 file_extension "circle";
40 // IMPORTANT: All new members of tables, enums and unions must be added at the
41 // end to ensure backwards compatibility.
43 // The type of data stored in a tensor.
44 enum TensorType : byte {
58 // Experimental: Resource and variant types are experimental, that are subject
59 // to change. Do not implement custom kernels using resource & variant types
66 // Custom quantization parameters for experimenting with new quantization
68 table CustomQuantization {
69 custom:[ubyte] (force_align: 16);
72 // Represents a specific quantization technique's parameters.
73 union QuantizationDetails {
77 // Parameters for converting a quantized tensor back to float.
78 table QuantizationParameters {
79 // These four parameters are the asymmetric linear quantization parameters.
80 // Given a quantized value q, the corresponding float value f should be:
81 // f = scale * (q - zero_point)
82 // For other quantization types, the QuantizationDetails below is used.
83 min:[float]; // For importing back into tensorflow.
84 max:[float]; // For importing back into tensorflow.
85 scale:[float]; // For dequantizing the tensor's values.
88 // If this is not none, the other quantization parameters (i.e. min, max,
89 // scale, zero_point fields above) are ignored and the value of the
90 // QuantizationDetails union should be used.
91 details:QuantizationDetails;
93 // Specifies the dimension of the Tensor's shape that the scales and
94 // zero_points correspond to. For example, a tensor t, with dims=[4, 3, 2, 1]
95 // with quantization params:
96 // scale=[1.0, 2.0, 3.0], zero_point=[1, 2, 3], quantization_dimension=1
97 // will be quantized across the second dimension of t.
98 // t[:, 0, :, :] will have scale[0]=1.0, zero_point[0]=1
99 // t[:, 1, :, :] will have scale[1]=2.0, zero_point[0]=2
100 // t[:, 2, :, :] will have scale[2]=3.0, zero_point[0]=3
101 quantized_dimension:int;
105 // We use a modification of the TACO format.
106 // Reference: http://tensor-compiler.org/kjolstad-oopsla17-tensor-compiler.pdf
108 // To encode a conceptual n-dimensional dense tensor with dims (d0, ..., dn-1),
109 // potentially with a k-dimensional block (0 <= k <= n) with dims
110 // (dn, ..., dn+k-1), the format needs to specify:
111 // 1. In what order to traverse these dimensions. For example, to store a 2-D
112 // matrix in row major order, the traversal order would be (d0, d1),
113 // whereas to store it in column major order, the traversal order would be
114 // (d1, d0). If the 2-D matrix has a 2-D inner block, the traversal order
115 // could be (d0, d1, d2, d3).
116 // 2. How each block dimension in (dn, ..., dn+k-1) maps to the original
117 // tensor dimension in (d0, ..., dn-1).
118 // 3. In the traversal order defined above, the format (dense vs. sparse) and
119 // index metadata for each dimension. For a dense dimension, this is just
120 // the size of that dimension. For a sparse dimension, it's the same as
121 // the compressed index defined in the Compressed Sparse Row (CSR) format.
122 // (http://scipy-lectures.org/advanced/scipy_sparse/csr_matrix.html)
124 // The storage type for a dimension. Currently we support:
125 // 1. DENSE: each coordinate in this dimension is stored implicitly.
126 // 2. SPARSE_CSR: only the coordinates with non-zero elements are stored. The
127 // compression technique is the same what CSR uses.
128 // More types like a sparse dimension with a different compression technique
129 // could be added to the list in the future.
130 enum DimensionType : byte {
140 values:[ushort] (force_align: 4);
144 values:[ubyte] (force_align: 4);
147 // Variable-typed buffer to store the index metadata for a sparse dimension.
148 // The widest type is Int32 instead of UInt32 because tensor's shape is a int32
149 // vector. We don't want the per-dimensional index to overflow that range.
150 union SparseIndexVector {
156 table DimensionMetadata {
157 // Whether a dimension is dense or sparse.
158 format:DimensionType;
159 // Index metadata used for a dimension.
160 // - If format is DimensionType.DENSE then we use the dense_size field to
161 // store the size of that dimension. Each index in that dimension is
162 // stored implicitly.
163 // - If format is DimensionType.SPARSE_CSR then we use array_segments and
164 // array_indices to encode that dimension. array_segments represents how
165 // to segment the indices array, each segment corresponds to one element
166 // in the previous dimension. array_indices represents the index of the
167 // non-zero elements within this dimension (as those in the CSR matrix
168 // format, where the first array is row pointers and the second array is
171 array_segments:SparseIndexVector;
172 array_indices:SparseIndexVector;
175 // Parameters to encode a sparse TfLite tensor.
176 table SparsityParameters {
177 // The traversal order of the dimensions defined in the `shape` field of the
178 // conceptual dense tensor. For a n-dimensional tensors with dims (d0, d1,
180 // - if not block sparse, the traversal_order is just a permutation of (d0,
181 // ..., dn-1). For example, a 2-D matrix stored in row-major order would
182 // have traversal_order = (d0, d1).
183 // - if block sparse with a k-dimensional block (0 <= k <= n), the
184 // traversal_order has n + k elements. The first n elements are still a
185 // permutation of (d0, ..., dn-1). The lask k elements are a permutation
186 // of (dn, ..., dn+k-1), defining how to traverse a block internally. For
187 // example, a 2-D matrix with 2-D blocks, both stored in row-major order
188 // would have traversal_order = (d0, d1, d2, d3).
189 traversal_order:[int];
190 // For an n-dimensional tensor with a k-dimensional block (0 <= k <= n),
191 // stores how a block dimension in (dn, ..., dn+k-1) maps to the original
192 // tensor dimension in (d0, ..., dn).
193 // It's stored in the order of (dn, ..., dn+k-1).
194 // If not block-sparse, this field is NULL.
196 // In the traversal order defined above, the metadata needed for
197 // each dimension to locate the non-zero values in the original dense tensor.
198 // The size of the dim_metadata array = the size of the traversal_order array
200 dim_metadata:[DimensionMetadata];
204 // The tensor shape. The meaning of each entry is operator-specific but
205 // builtin ops use: [batch size, height, width, number of channels] (That's
206 // Tensorflow's NHWC).
209 // An index that refers to the buffers table at the root of the model. Or,
210 // if there is no data buffer associated (i.e. intermediate results), then
211 // this is 0 (which refers to an always existent empty buffer).
213 // The data_buffer itself is an opaque container, with the assumption that the
214 // target device is little-endian. In addition, all builtin operators assume
215 // the memory is ordered such that if `shape` is [4, 3, 2], then index
216 // [i, j, k] maps to data_buffer[i*3*2 + j*2 + k].
218 name:string; // For debugging and importing back into tensorflow.
219 quantization:QuantizationParameters; // Optional.
221 is_variable:bool = false;
223 // Parameters to encode a sparse tensor. See the example in
224 // tensorflow/lite/testdata/sparse_tensor.json.
225 sparsity:SparsityParameters; // Optional.
227 // Encodes `shape` with unknown dimensions. Unknown dimensions are
228 // represented with -1.
229 shape_signature:[int]; // Optional.
232 // A list of builtin operators. Builtin operators are slightly faster than custom
233 // ones, but not by much. Moreover, while custom operators accept an opaque
234 // object containing configuration parameters, builtins have a predetermined
235 // set of acceptable options.
237 enum BuiltinOperator : int32 {
239 BCQ_FULLY_CONNECTED = -3,
245 DEPTHWISE_CONV_2D = 4,
248 EMBEDDING_LOOKUP = 7,
251 HASHTABLE_LOOKUP = 10,
252 L2_NORMALIZATION = 11,
254 LOCAL_RESPONSE_NORMALIZATION = 13,
261 // NOTE(aselle): RELU_N1_TO_1 used to be called RELU1, but it was renamed
262 // since different model developers use RELU1 in different ways. Never
263 // create another op called RELU1.
267 RESIZE_BILINEAR = 23,
273 CONCAT_EMBEDDINGS = 29,
277 EMBEDDING_LOOKUP_SPARSE = 33,
279 UNIDIRECTIONAL_SEQUENCE_RNN = 35,
281 BATCH_TO_SPACE_ND = 37,
282 SPACE_TO_BATCH_ND = 38,
288 UNIDIRECTIONAL_SEQUENCE_LSTM = 44,
290 BIDIRECTIONAL_SEQUENCE_RNN = 46,
295 // DELEGATE is a special op type for the operations which are delegated to
297 // WARNING: Experimental interface, subject to change
299 BIDIRECTIONAL_SEQUENCE_LSTM = 52,
315 SPARSE_TO_DENSE = 68,
344 RESIZE_NEAREST_NEIGHBOR = 97,
346 SQUARED_DIFFERENCE = 99,
359 REVERSE_SEQUENCE = 112,
362 MATRIX_SET_DIAG = 115,
367 NON_MAX_SUPPRESSION_V4 = 120,
368 NON_MAX_SUPPRESSION_V5 = 121,
374 PLACEHOLDER_FOR_GREATER_OP_CODES = 127,
384 HASHTABLE_FIND = 137,
385 HASHTABLE_IMPORT = 138,
386 HASHTABLE_SIZE = 139,
388 CONV_3D_TRANSPOSE = 141,
391 ASSIGN_VARIABLE = 144,
392 BROADCAST_ARGS = 145,
393 RANDOM_STANDARD_NORMAL = 146,
395 // LINT.ThenChange(nnapi_linter/linter.proto)
397 // Options for the builtin operators.
398 union BuiltinOptions {
400 DepthwiseConv2DOptions,
401 ConcatEmbeddingsOptions,
402 LSHProjectionOptions,
406 FullyConnectedOptions,
408 ConcatenationOptions,
411 LocalResponseNormalizationOptions,
413 ResizeBilinearOptions,
418 EmbeddingLookupSparseOptions,
422 BatchToSpaceNDOptions,
423 SpaceToBatchNDOptions,
437 MaximumMinimumOptions,
447 TransposeConvOptions,
448 SparseToDenseOptions,
467 BidirectionalSequenceLSTMOptions,
468 BidirectionalSequenceRNNOptions,
469 UnidirectionalSequenceLSTMOptions,
472 ResizeNearestNeighborOptions,
474 SquaredDifferenceOptions,
485 ReverseSequenceOptions,
488 MatrixSetDiagOptions,
493 NonMaxSuppressionV4Options,
494 NonMaxSuppressionV5Options,
506 HashtableFindOptions,
507 HashtableImportOptions,
508 HashtableSizeOptions,
511 AssignVariableOptions,
513 BCQGatherOptions = 252,
514 BCQFullyConnectedOptions = 253,
515 InstanceNormOptions = 254,
518 enum Padding : byte { SAME, VALID }
520 enum ActivationFunctionType : byte {
529 table Conv2DOptions {
533 fused_activation_function:ActivationFunctionType;
534 dilation_w_factor:int = 1;
535 dilation_h_factor:int = 1;
538 // Options for both Conv3D and Conv3DTranspose.
539 table Conv3DOptions {
544 fused_activation_function:ActivationFunctionType;
545 dilation_d_factor:int = 1;
546 dilation_w_factor:int = 1;
547 dilation_h_factor:int = 1;
550 table Pool2DOptions {
556 fused_activation_function:ActivationFunctionType;
559 table DepthwiseConv2DOptions {
560 // Parameters for DepthwiseConv version 1 or above.
564 // `depth_multiplier` is redundant. It's used by CPU kernels in
565 // TensorFlow 2.0 or below, but ignored in versions above.
566 // See comments in lite/c/builtin_op_data.h for more details.
567 depth_multiplier:int;
568 fused_activation_function:ActivationFunctionType;
569 // Parameters for DepthwiseConv version 2 or above.
570 dilation_w_factor:int = 1;
571 dilation_h_factor:int = 1;
574 table ConcatEmbeddingsOptions {
576 num_columns_per_channel:[int];
577 embedding_dim_per_channel:[int]; // This could be inferred from parameters.
580 enum LSHProjectionType: byte {
586 table LSHProjectionOptions {
587 type: LSHProjectionType;
592 fused_activation_function:ActivationFunctionType;
593 // For weights-only quantization, use asymmetric quantization for non
594 // constant inputs at evaluation time.
595 asymmetric_quantize_inputs:bool;
598 // An implementation of TensorFlow RNNCell.
600 fused_activation_function:ActivationFunctionType;
601 asymmetric_quantize_inputs:bool;
604 // An implementation of TensorFlow dynamic_rnn with RNNCell.
605 table SequenceRNNOptions {
607 fused_activation_function:ActivationFunctionType;
608 asymmetric_quantize_inputs:bool;
611 // An implementation of TensorFlow bidrectional_dynamic_rnn with RNNCell.
612 table BidirectionalSequenceRNNOptions {
614 fused_activation_function:ActivationFunctionType;
616 asymmetric_quantize_inputs:bool;
619 enum FullyConnectedOptionsWeightsFormat: byte {
621 SHUFFLED4x16INT8 = 1,
622 SHUFFLED16x1FLOAT32 = 127
625 // An implementation of TensorFlow fully_connected (a.k.a Dense) layer.
626 table FullyConnectedOptions {
627 // Parameters for FullyConnected version 1 or above.
628 fused_activation_function:ActivationFunctionType;
630 // Parameters for FullyConnected version 2 or above.
631 weights_format:FullyConnectedOptionsWeightsFormat = DEFAULT;
633 // Parameters for FullyConnected version 5 or above.
634 // If set to true, then the number of dimension is preserved. Furthermore,
635 // all but the last dimension of the input and output shapes will be equal.
638 // Parameters for FullyConnected version 7 or above.
639 // If set to true, then weights-only op will use asymmetric quantization for
641 asymmetric_quantize_inputs: bool;
644 table SoftmaxOptions {
648 // An implementation of TensorFlow concat.
649 table ConcatenationOptions {
651 fused_activation_function:ActivationFunctionType;
655 fused_activation_function:ActivationFunctionType;
656 // Parameters supported by version 3.
657 pot_scale_int16:bool = true;
661 fused_activation_function:ActivationFunctionType;
664 table L2NormOptions {
665 // This field is currently ignored in the L2 Norm Op.
666 fused_activation_function:ActivationFunctionType;
669 table LocalResponseNormalizationOptions {
676 enum LSTMKernelType : byte {
677 // Full LSTM kernel which supports peephole and projection.
679 // Basic LSTM kernels. Equivalent to TensorFlow BasicLSTMCell.
683 // An implementation of TensorFlow LSTMCell and CoupledInputForgetGateLSTMCell
685 // Parameters for LSTM version 1 or above.
686 fused_activation_function:ActivationFunctionType;
687 cell_clip: float; // Optional, 0.0 means no clipping
688 proj_clip: float; // Optional, 0.0 means no clipping
690 // Parameters for LSTM version 2 or above.
691 // Basic kernel is only supported in version 2 or above.
692 kernel_type: LSTMKernelType = FULL;
694 // Parameters for LSTM version 4 or above.
695 asymmetric_quantize_inputs: bool;
698 // An implementation of TensorFlow dynamic_rnn with LSTMCell.
699 table UnidirectionalSequenceLSTMOptions {
700 fused_activation_function:ActivationFunctionType;
701 cell_clip: float; // Optional, 0.0 means no clipping
702 proj_clip: float; // Optional, 0.0 means no clipping
704 // If true then first dimension is sequence, otherwise batch.
707 // Parameter for Unidirectional Sequence LSTM version 4.
708 asymmetric_quantize_inputs:bool;
711 table BidirectionalSequenceLSTMOptions {
712 // Parameters supported by version 1:
713 fused_activation_function:ActivationFunctionType;
714 cell_clip: float; // Optional, 0.0 means no clipping
715 proj_clip: float; // Optional, 0.0 means no clipping
717 // If true, store the outputs of both directions into the first output.
720 // Parameters supported by version 2:
721 // If true then first dimension is sequence, otherwise batch.
722 // Version 1 implementations assumed time_major to be true, so this default
723 // value should never change.
724 time_major: bool = true;
726 // Parameters for version 3 or above.
727 asymmetric_quantize_inputs:bool;
730 table ResizeBilinearOptions {
731 new_height: int (deprecated);
732 new_width: int (deprecated);
734 half_pixel_centers: bool;
737 table ResizeNearestNeighborOptions {
739 half_pixel_centers: bool;
742 // A call operation options
744 // The subgraph index that needs to be called.
754 table ReshapeOptions {
758 table SpaceToBatchNDOptions {
761 table BatchToSpaceNDOptions {
764 table SkipGramOptions {
767 include_all_ngrams: bool;
770 table SpaceToDepthOptions {
774 table DepthToSpaceOptions {
779 fused_activation_function:ActivationFunctionType;
780 // Parameters supported by version 5
781 pot_scale_int16:bool = true;
785 fused_activation_function:ActivationFunctionType;
788 table TopKV2Options {
791 enum CombinerType : byte {
797 table EmbeddingLookupSparseOptions {
798 combiner:CombinerType;
801 table GatherOptions {
803 // Parameters for Gather version 5 or above.
807 table TransposeOptions {
816 table ReducerOptions {
820 table SqueezeOptions {
828 table SplitVOptions {
832 table StridedSliceOptions {
837 shrink_axis_mask: int;
840 table LogSoftmaxOptions {
844 in_data_type: TensorType;
845 out_data_type: TensorType;
848 table DequantizeOptions {
851 table MaximumMinimumOptions {
857 table ArgMaxOptions {
858 output_type : TensorType;
861 table ArgMinOptions {
862 output_type : TensorType;
865 table GreaterOptions {
868 table GreaterEqualOptions {
874 table LessEqualOptions {
880 table SelectOptions {
886 table TransposeConvOptions {
892 table ExpandDimsOptions {
895 table SparseToDenseOptions {
896 validate_indices:bool;
902 table NotEqualOptions {
906 // Optional output type of the operation (int32 or int64). Defaults to int32.
907 out_type : TensorType;
916 table FakeQuantOptions {
917 // Parameters supported by version 1:
922 // Parameters supported by version 2:
931 table LogicalOrOptions {
934 table OneHotOptions {
942 table HardSwishOptions {
945 table LogicalAndOptions {
948 table LogicalNotOptions {
951 table UnpackOptions {
956 table FloorDivOptions {
959 table SquareOptions {
962 table ZerosLikeOptions {
968 table FloorModOptions {
974 table LeakyReluOptions {
978 table SquaredDifferenceOptions {
981 enum MirrorPadMode : byte {
982 // Doesn't include borders.
988 table MirrorPadOptions {
992 table UniqueOptions {
993 idx_out_type:TensorType = INT32;
996 table ReverseV2Options {
1002 table GatherNdOptions {
1005 table WhereOptions {
1008 table ReverseSequenceOptions {
1013 table MatrixDiagOptions {
1016 table QuantizeOptions {
1019 table MatrixSetDiagOptions {
1023 then_subgraph_index:int;
1024 else_subgraph_index:int;
1027 table CallOnceOptions {
1028 init_subgraph_index:int;
1031 table WhileOptions {
1032 cond_subgraph_index:int;
1033 body_subgraph_index:int;
1036 table NonMaxSuppressionV4Options {
1039 table NonMaxSuppressionV5Options {
1042 table ScatterNdOptions {
1045 table SelectV2Options {
1048 table DensifyOptions {
1051 table SegmentSumOptions {
1054 table BatchMatMulOptions {
1057 // Parameters for BatchMatMul version 4 or above.
1058 // If set to true, then weights-only op will use asymmetric quantization for
1060 asymmetric_quantize_inputs: bool;
1063 table CumsumOptions {
1068 table BroadcastToOptions {
1071 table Rfft2dOptions {
1074 table HashtableOptions {
1075 // The identity of hash tables. This identity will be used across different
1076 // subgraphs in the same interpreter instance.
1078 key_dtype:TensorType;
1079 value_dtype:TensorType;
1082 table HashtableFindOptions {
1085 table HashtableImportOptions {
1088 table HashtableSizeOptions {
1091 table VarHandleOptions {
1096 table ReadVariableOptions {
1099 table AssignVariableOptions {
1102 table RandomOptions {
1107 table BCQGatherOptions {
1108 input_hidden_size: int;
1112 table BCQFullyConnectedOptions {
1113 weights_hidden_size: int;
1114 fused_activation_function:ActivationFunctionType;
1117 table InstanceNormOptions {
1119 fused_activation_function:ActivationFunctionType;
1122 // An OperatorCode can be an enum value (BuiltinOperator) if the operator is a
1123 // builtin, or a string if the operator is custom.
1124 table OperatorCode {
1125 // This field is for backward compatibility. This field will be used when
1126 // the value of the extended builtin_code field has less than
1127 // BulitinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES.
1128 deprecated_builtin_code:byte;
1131 // The version of the operator. The version need to be bumped whenever new
1132 // parameters are introduced into an op.
1135 // This field is introduced for resolving op builtin code shortage problem
1136 // (the original BuiltinOperator enum field was represented as a byte).
1137 // This field will be used when the value of the extended builtin_code field
1138 // has greater than BulitinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES.
1139 builtin_code:BuiltinOperator;
1142 enum CustomOptionsFormat : byte {
1146 enum DataFormat : byte {
1147 // For 2D data, NHWC(batch, height, width, channels)
1148 // For 3D data, NDHWC(batch, depth, height, width, channels)
1150 // For 2D data, NCHW(batch, channels, height, width)
1151 // For 3D data, NCDHW(batch, channels, depth, height, width)
1155 // An operator takes tensors as inputs and outputs. The type of operation being
1156 // performed is determined by an index into the list of valid OperatorCodes,
1157 // while the specifics of each operations is configured using builtin_options
1158 // or custom_options.
1160 // Index into the operator_codes array. Using an integer here avoids
1161 // complicate map lookups.
1164 // Optional input are indicated by -1.
1168 builtin_options:BuiltinOptions;
1169 custom_options:[ubyte];
1170 custom_options_format:CustomOptionsFormat;
1172 // A list of booleans indicating the input tensors which are being mutated by
1173 // this operator.(e.g. used by RNN and LSTM).
1174 // For example, if the "inputs" array refers to 5 tensors and the second and
1175 // fifth are mutable variables, then this list will contain
1176 // [false, true, false, false, true].
1178 // If the list is empty, no variable is mutated in this operator.
1179 // The list either has the same length as `inputs`, or is empty.
1180 mutating_variable_inputs:[bool];
1182 // A list of indices to the subgraph's "tensors" that are internal to an Op.
1183 // Internal tensors are those that do not flow in or out of the operation,
1184 // but instead are part of internal computation. As such, the operation's
1185 // implementation may manage its memory more efficiently. They are needed
1186 // however (i.e. not just an implementation detail) since they are part of the
1187 // computation, which may require relevant metadata such as quantization
1189 intermediates:[int];
1192 // The root type, defining a subgraph, which typically represents an entire
1195 // A list of all tensors used in this subgraph.
1198 // Indices of the tensors that are inputs into this subgraph. Note this is
1199 // the list of non-static tensors that feed into the subgraph for inference.
1202 // Indices of the tensors that are outputs out of this subgraph. Note this is
1203 // the list of output tensors that are considered the product of the
1204 // subgraph's inference.
1207 // All operators, in execution order.
1208 operators:[Operator];
1210 // Name of this subgraph (used for debugging).
1213 // Data format for input/output of SubGraph
1214 data_format: DataFormat;
1217 // Table of raw data buffers (used for constant tensors). Referenced by tensors
1218 // by index. The generous alignment accommodates mmap-friendly data structures.
1220 data:[ubyte] (force_align: 16);
1224 // A human readable string to uniquely identify a Metadata.
1226 // An index to the buffers table.
1230 // Map from an alias name of tensor to tensor index in the graph.
1231 // This is used in Signature def.
1233 // Represents the alias to use for this tensor.
1236 // The actual tensor index in the primary graph, that 'name' corresponds to.
1240 // This corresponds to SignatureDef in Tensorflow SavedModel.
1241 // The SignatureDef will be part of the SavedModel provided for conversion.
1242 table SignatureDef {
1243 // Named inputs for this signature.
1246 // Named outputs for this signature.
1247 outputs:[TensorMap];
1249 // Key value which was in the Tensorflow SavedModel SignatureDef map.
1250 signature_key:string;
1252 // Model tag, deprecated.
1253 deprecated_tag:string (deprecated);
1255 // Index of subgraphs that corresponds to the exported method.
1256 subgraph_index:uint;
1260 // Version of the schema.
1263 // A list of all operator codes used in this model. This is
1264 // kept in order because operators carry an index into this
1266 operator_codes:[OperatorCode];
1268 // All the subgraphs of the model. The 0th is assumed to be the main
1270 subgraphs:[SubGraph];
1272 // A description of the model.
1275 // Buffers of the model.
1276 // Note the 0th entry of this array must be an empty buffer (sentinel).
1277 // This is a convention so that tensors without a buffer can provide 0 as
1281 // Metadata about the model. Indirects into the existings buffers list.
1282 // Deprecated, prefer to use metadata field.
1283 metadata_buffer:[int];
1285 // Metadata about the model.
1286 metadata:[Metadata];
1288 // Optional SignatureDefs for the model.
1289 signature_defs:[SignatureDef];