pub const SCHEMA: &str = "\n// Copyright (c) 2020-2026 ARM Limited.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nnamespace tosa;\n\n// This corresponds to the version.\nfile_identifier \"TOSA\";\n// File extension of any written files.\nfile_extension \"tosa\";\n\n// NOTE: New values added to the schema should be placed\n// at the end of the list in order to keep schema stable.\n\nenum DType:uint32 {\n UNKNOWN = 0,\n BOOL,\n INT4,\n INT8,\n INT16,\n INT32,\n INT48,\n FP32,\n FP16,\n BF16,\n SHAPE,\n FP8E4M3,\n FP8E5M2,\n FP6E2M3,\n FP6E3M2,\n FP4E2M1,\n FP8UE8M0,\n INT64,\n MXINT8,\n}\n\nenum ResizeMode:uint32 {\n UNKNOWN = 0,\n NEAREST,\n BILINEAR,\n}\n\nenum NanPropagationMode:uint32 {\n UNKNOWN = 0,\n PROPAGATE,\n IGNORE,\n}\n\nenum RoundingMode:uint32 {\n UNKNOWN = 0,\n SINGLE_ROUND,\n INEXACT_ROUND,\n DOUBLE_ROUND\n}\n\nenum BlockSize:uint32 {\n UNKNOWN = 0,\n BLOCK_SIZE_1 = 1,\n BLOCK_SIZE_32 = 32,\n}\n\nenum Op:uint32 {\n UNKNOWN = 0,\n ARGMAX,\n AVG_POOL2D,\n CONV2D,\n CONV3D,\n DEPTHWISE_CONV2D,\n FFT2D,\n MATMUL,\n MAX_POOL2D,\n RFFT2D,\n TRANSPOSE_CONV2D,\n CLAMP,\n ERF,\n SIGMOID,\n TANH,\n ADD,\n ARITHMETIC_RIGHT_SHIFT,\n BITWISE_AND,\n BITWISE_OR,\n BITWISE_XOR,\n INTDIV,\n LOGICAL_AND,\n LOGICAL_LEFT_SHIFT,\n LOGICAL_RIGHT_SHIFT,\n LOGICAL_OR,\n LOGICAL_XOR,\n MAXIMUM,\n MINIMUM,\n MUL,\n POW,\n SUB,\n TABLE,\n ABS,\n BITWISE_NOT,\n CEIL,\n CLZ,\n COS,\n EXP,\n FLOOR,\n LOG,\n LOGICAL_NOT,\n NEGATE,\n RECIPROCAL,\n RSQRT,\n SIN,\n SELECT,\n EQUAL,\n GREATER,\n GREATER_EQUAL,\n REDUCE_ALL,\n REDUCE_ANY,\n REDUCE_MAX,\n REDUCE_MIN,\n REDUCE_PRODUCT,\n REDUCE_SUM,\n CONCAT,\n PAD,\n RESHAPE,\n REVERSE,\n SLICE,\n TILE,\n TRANSPOSE,\n GATHER,\n SCATTER,\n RESIZE,\n CAST,\n RESCALE,\n CONST,\n IDENTITY,\n CUSTOM,\n COND_IF,\n WHILE_LOOP,\n VARIABLE,\n VARIABLE_WRITE,\n VARIABLE_READ,\n CONST_SHAPE,\n MATMUL_T_BLOCK_SCALED,\n CAST_FROM_BLOCK_SCALED,\n CAST_TO_BLOCK_SCALED,\n DIM,\n CONCAT_SHAPE,\n ADD_SHAPE,\n SUB_SHAPE,\n MUL_SHAPE,\n SLICE_SHAPE,\n EXP2_SHAPE,\n LOG2_CEIL_SHAPE,\n LOG2_FLOOR_SHAPE,\n MAX_SHAPE,\n MIN_SHAPE,\n MOD_SHAPE,\n DIV_CEIL_SHAPE,\n DIV_FLOOR_SHAPE,\n ASSERT_EQUAL_SHAPE,\n CONV2D_BLOCK_SCALED,\n MAX_POOL2D_ADAPTIVE,\n AVG_POOL2D_ADAPTIVE,\n RESHAPE_BLOCK_SCALED,\n ROW_GATHER_BLOCK_SCALED,\n}\n\nunion Attribute {\n ArgMaxAttribute,\n AvgPool2dAttribute,\n Conv2dAttribute,\n Conv3dAttribute,\n DepthwiseConv2dAttribute,\n FFT2dAttribute,\n MatMulAttribute,\n MaxPool2dAttribute,\n RFFT2dAttribute,\n TransposeConv2dAttribute,\n ClampAttribute,\n ErfAttribute,\n SigmoidAttribute,\n TanhAttribute,\n AddAttribute,\n ArithmeticRightShiftAttribute,\n BitwiseAndAttribute,\n BitwiseOrAttribute,\n BitwiseXorAttribute,\n IntDivAttribute,\n LogicalAndAttribute,\n LogicalLeftShiftAttribute,\n LogicalRightShiftAttribute,\n LogicalOrAttribute,\n LogicalXorAttribute,\n MaximumAttribute,\n MinimumAttribute,\n MulAttribute,\n PowAttribute,\n SubAttribute,\n TableAttribute,\n AbsAttribute,\n BitwiseNotAttribute,\n CeilAttribute,\n ClzAttribute,\n CosAttribute,\n ExpAttribute,\n FloorAttribute,\n LogAttribute,\n LogicalNotAttribute,\n NegateAttribute,\n ReciprocalAttribute,\n RsqrtAttribute,\n SinAttribute,\n SelectAttribute,\n EqualAttribute,\n GreaterAttribute,\n GreaterEqualAttribute,\n ReduceAllAttribute,\n ReduceAnyAttribute,\n ReduceMaxAttribute,\n ReduceMinAttribute,\n ReduceProductAttribute,\n ReduceSumAttribute,\n ConcatAttribute,\n PadAttribute,\n ReshapeAttribute,\n ReverseAttribute,\n SliceAttribute,\n TileAttribute,\n TransposeAttribute,\n GatherAttribute,\n ScatterAttribute,\n ResizeAttribute,\n CastAttribute,\n RescaleAttribute,\n ConstAttribute,\n IdentityAttribute,\n CustomAttribute,\n CondIfAttribute,\n WhileLoopAttribute,\n VariableAttribute,\n VariableWriteAttribute,\n VariableReadAttribute,\n ConstShapeAttribute,\n MatMulTBlockScaledAttribute,\n CastFromBlockScaledAttribute,\n CastToBlockScaledAttribute,\n DimAttribute,\n ConcatShapeAttribute,\n AddShapeAttribute,\n SubShapeAttribute,\n MulShapeAttribute,\n SliceShapeAttribute,\n Exp2ShapeAttribute,\n Log2CeilShapeAttribute,\n Log2FloorShapeAttribute,\n MaxShapeAttribute,\n MinShapeAttribute,\n ModShapeAttribute,\n DivCeilShapeAttribute,\n DivFloorShapeAttribute,\n AssertEqualShapeAttribute,\n Conv2dBlockScaledAttribute,\n MaxPool2dAdaptiveAttribute,\n AvgPool2dAdaptiveAttribute,\n ReshapeBlockScaledAttribute,\n RowGatherBlockScaledAttribute\n}\n\ntable ArgMaxAttribute {\n axis: int32;\n nan_mode: NanPropagationMode;\n}\n\ntable AvgPool2dAttribute {\n kernel: [int32];\n stride: [int32];\n pad: [int32];\n acc_type: DType;\n}\n\ntable AvgPool2dAdaptiveAttribute {\n acc_type: DType;\n}\n\ntable Conv2dAttribute {\n pad: [int32];\n stride: [int32];\n dilation: [int32];\n local_bound: bool;\n acc_type: DType;\n}\n\ntable Conv3dAttribute {\n pad: [int32];\n stride: [int32];\n dilation: [int32];\n local_bound: bool;\n acc_type: DType;\n}\n\ntable DepthwiseConv2dAttribute {\n pad: [int32];\n stride: [int32];\n dilation: [int32];\n local_bound: bool;\n acc_type: DType;\n}\n\ntable FFT2dAttribute {\n inverse: bool;\n local_bound: bool;\n}\n\ntable MatMulAttribute {\n}\n\ntable MaxPool2dAttribute {\n kernel: [int32];\n stride: [int32];\n pad: [int32];\n nan_mode: NanPropagationMode;\n}\n\ntable MaxPool2dAdaptiveAttribute {\n nan_mode: NanPropagationMode;\n}\n\ntable RFFT2dAttribute {\n local_bound: bool;\n}\n\ntable TransposeConv2dAttribute {\n out_pad: [int32];\n stride: [int32];\n local_bound: bool;\n acc_type: DType;\n}\n\ntable ClampAttribute {\n min_val: [ubyte] (force_align: 8);\n max_val: [ubyte] (force_align: 8);\n nan_mode: NanPropagationMode;\n}\n\ntable ErfAttribute {\n}\n\ntable SigmoidAttribute {\n}\n\ntable TanhAttribute {\n}\n\ntable AddAttribute {\n}\n\ntable ArithmeticRightShiftAttribute {\n round: bool;\n}\n\ntable BitwiseAndAttribute {\n}\n\ntable BitwiseOrAttribute {\n}\n\ntable BitwiseXorAttribute {\n}\n\ntable IntDivAttribute {\n}\n\ntable LogicalAndAttribute {\n}\n\ntable LogicalLeftShiftAttribute {\n}\n\ntable LogicalRightShiftAttribute {\n}\n\ntable LogicalOrAttribute {\n}\n\ntable LogicalXorAttribute {\n}\n\ntable MaximumAttribute {\n nan_mode: NanPropagationMode;\n}\n\ntable MinimumAttribute {\n nan_mode: NanPropagationMode;\n}\n\ntable MulAttribute {\n}\n\ntable PowAttribute {\n}\n\ntable SubAttribute {\n}\n\ntable TableAttribute {\n}\n\ntable AbsAttribute {\n}\n\ntable BitwiseNotAttribute {\n}\n\ntable CeilAttribute {\n}\n\ntable ClzAttribute {\n}\n\ntable CosAttribute {\n}\n\ntable ExpAttribute {\n}\n\ntable FloorAttribute {\n}\n\ntable LogAttribute {\n}\n\ntable LogicalNotAttribute {\n}\n\ntable NegateAttribute {\n}\n\ntable ReciprocalAttribute {\n}\n\ntable RsqrtAttribute {\n}\n\ntable SinAttribute {\n}\n\ntable SelectAttribute {\n}\n\ntable EqualAttribute {\n}\n\ntable GreaterAttribute {\n}\n\ntable GreaterEqualAttribute {\n}\n\ntable ReduceAllAttribute {\n axis: int32;\n}\n\ntable ReduceAnyAttribute {\n axis: int32;\n}\n\ntable ReduceMaxAttribute {\n axis: int32;\n nan_mode: NanPropagationMode;\n}\n\ntable ReduceMinAttribute {\n axis: int32;\n nan_mode: NanPropagationMode;\n}\n\ntable ReduceProductAttribute {\n axis: int32;\n}\n\ntable ReduceSumAttribute {\n axis: int32;\n}\n\ntable ConcatAttribute {\n axis: int32;\n}\n\ntable PadAttribute {\n}\n\ntable ReshapeAttribute {\n}\n\ntable ReshapeBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable ReverseAttribute {\n axis: int32;\n}\n\ntable SliceAttribute {\n}\n\ntable TileAttribute {\n}\n\ntable TransposeAttribute {\n perms: [int32];\n}\n\ntable GatherAttribute {\n}\n\ntable ScatterAttribute {\n}\n\ntable RowGatherBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable ResizeAttribute {\n mode: ResizeMode;\n}\n\ntable CastAttribute {\n}\n\ntable RescaleAttribute {\n scale32: bool;\n rounding_mode: RoundingMode;\n per_channel: bool;\n input_unsigned: bool;\n output_unsigned: bool;\n}\n\ntable ConstAttribute {\n // value is stored in output TosaTensor\n}\n\ntable IdentityAttribute {\n}\n\ntable CustomAttribute {\n operator_name:string;\n domain_name:string;\n implementation_attrs:[ubyte];\n}\n\ntable CondIfAttribute {\n then_graph: string;\n else_graph: string;\n}\n\ntable WhileLoopAttribute {\n cond_graph: string;\n body_graph: string;\n}\n\ntable VariableAttribute {\n}\n\ntable VariableWriteAttribute {\n}\n\ntable VariableReadAttribute {\n}\n\ntable ConstShapeAttribute {\n // value is stored in output TosaTensor\n}\n\ntable MatMulTBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable CastFromBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable CastToBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable Conv2dBlockScaledAttribute {\n block_size: BlockSize;\n}\n\ntable SoftwareVersion {\n _major: int32 = -1;\n _minor: int32 = -1;\n _micro: int32 = -1;\n _modifier: string;\n}\n\ntable DimAttribute {\n axis: int32;\n}\n\ntable ConcatShapeAttribute {\n}\n\ntable AddShapeAttribute {\n}\n\ntable SubShapeAttribute {\n}\n\ntable MulShapeAttribute {\n}\n\ntable SliceShapeAttribute {\n}\n\ntable Exp2ShapeAttribute {\n}\n\ntable Log2CeilShapeAttribute {\n}\n\ntable Log2FloorShapeAttribute {\n}\n\ntable MaxShapeAttribute {\n}\n\ntable MinShapeAttribute {\n}\n\ntable ModShapeAttribute {\n}\n\ntable DivCeilShapeAttribute {\n}\n\ntable DivFloorShapeAttribute {\n}\n\ntable AssertEqualShapeAttribute {\n allow_broadcast: bool;\n}\n\n\ntable Version {\n _major: int32 = -1;\n _minor: int32 = -1;\n _patch: int32 = -1;\n _draft: bool = true;\n}\n\ntable TosaTensor {\n name:string; // name of the tensor, used for solving dependency\n shape:[int32]; // shape of the tensor\n type:DType; // data type of the tensor\n data: [ubyte] (force_align: 8); // raw data array if it\'s a constant tensor.\n variable: bool; // is this a variable tensor\n is_unranked: bool; // whether this is an unranked tensor\n variable_name:string; // name for variable attribute\n\n // In a model that is larger than 2GB, then tensors instead uses the following\n // attributes to find stored data, which is outside of flatbuffers\n // the offset is calculated relative to the beginning of the file and is only\n // valid if > 1.\n offset: ulong;\n size: ulong;\n}\n\ntable TosaShape {\n name: string; // name of the shape\n rank: uint32; // rank of the shape\n data: [ubyte] (force_align: 8); // raw data array if it\'s a constant shape\n}\n\ntable OpLocation {\n text: string; // Opaque string, interpretted by user\n}\n\ntable TosaOperator {\n op:Op; // operator enum\n attribute:Attribute; // union structure. operator attribute\n inputs:[string]; // list of input tensor or shape names\n outputs:[string]; // list of output tensor or shape names\n location: OpLocation; // location of this Op in mlir\n}\n\ntable TosaBasicBlock {\n name:string; // basic block name\n operators:[TosaOperator]; // operators array\n tensors:[TosaTensor]; // tensors array\n inputs:[string]; // name of graph inputs\n outputs:[string]; // name of graph outputs\n shapes:[TosaShape]; // shapes array\n}\n\ntable TosaRegion {\n name:string; // name of region\n blocks:[TosaBasicBlock]; // basic blocks array\n}\n\ntable TosaGraph {\n version:Version (required);\n regions:[TosaRegion]; // regions array\n software_version:SoftwareVersion; // cannot be required for back-compat\n}\n\nroot_type TosaGraph;\n";Expand description
TOSA schema source pinned into this crate.