blob: 9e4c461b139dd3dd8d37585a2e2ceecc8c9aae01 [file] [log] [blame]
Eric Kunze2364dcd2021-04-26 11:06:57 -07001
Eric Kunze497ab5d2022-10-21 16:39:01 -07002// Copyright (c) 2020-2023, ARM Limited.
Eric Kunze2364dcd2021-04-26 11:06:57 -07003//
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/*
17 Syntax:
18 DEF_ATTRIBUTE(ATTRIBUTE_NAME, NUM_ARGS_IN_ATTRIBUTES, ARG0_TYPE, ARG0_SCALAR_OR_VECTOR, ARGS0_NAME, ...)
19
20 Description:
21 ATTRIBUTE_NAME: corresponding attribute name, must match corresponding "table XXXAttribute" in tosa.fbs
22 NUM_ARGS_IN_ATTRIBUTES: number of arguments in this attribute
23 ARG0_TYPE: data type of arg0 in attribute
24 ARG0_SCALAR_OR_VECTOR: is arg0 a scalar(S) or a vector(V)
25 ARG0_NAME: name of arg0
26 ...: variadic variables for more arguments, depending on NUM_ARGS_IN_ATTRIBUTES
27*/
28
James Ward485a11d2022-08-05 13:48:37 +010029DEF_ATTRIBUTE(Pool, 6,
TatWai Chong7be71652022-05-10 17:26:20 -070030 int32_t, V, pad,
Eric Kunze2364dcd2021-04-26 11:06:57 -070031 int32_t, V, kernel,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +000032 int32_t, V, stride,
33 int32_t, S, input_zp,
James Ward485a11d2022-08-05 13:48:37 +010034 int32_t, S, output_zp,
35 DType, S, accum_dtype)
Eric Kunze2364dcd2021-04-26 11:06:57 -070036
James Wardea00fd02023-01-20 16:03:50 +000037DEF_ATTRIBUTE(Conv, 5,
TatWai Chong7be71652022-05-10 17:26:20 -070038 int32_t, V, pad,
Eric Kunze2364dcd2021-04-26 11:06:57 -070039 int32_t, V, stride,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +000040 int32_t, V, dilation,
41 int32_t, S, input_zp,
James Wardea00fd02023-01-20 16:03:50 +000042 int32_t, S, weight_zp)
Eric Kunze2364dcd2021-04-26 11:06:57 -070043
James Wardea00fd02023-01-20 16:03:50 +000044DEF_ATTRIBUTE(TransposeConv, 5,
Eric Kunze7ffa1ff2022-06-01 17:26:48 -070045 int32_t, V, out_pad,
Eric Kunze2364dcd2021-04-26 11:06:57 -070046 int32_t, V, stride,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +000047 int32_t, V, output_shape,
48 int32_t, S, input_zp,
James Wardea00fd02023-01-20 16:03:50 +000049 int32_t, S, weight_zp)
Eric Kunze2364dcd2021-04-26 11:06:57 -070050
Kevin Cheng38d214c2021-10-15 15:49:19 -070051DEF_ATTRIBUTE(Pad, 3,
52 int32_t, V, padding,
53 int32_t, S, pad_const_int,
54 float, S, pad_const_fp)
Eric Kunze2364dcd2021-04-26 11:06:57 -070055
56DEF_ATTRIBUTE(Axis, 1,
57 int32_t, S, axis)
58
59DEF_ATTRIBUTE(Reshape, 1,
TatWai Chong7be71652022-05-10 17:26:20 -070060 int32_t, V, new_shape)
Eric Kunze2364dcd2021-04-26 11:06:57 -070061
62DEF_ATTRIBUTE(Slice, 2,
TatWai Chong7be71652022-05-10 17:26:20 -070063 int32_t, V, start,
Eric Kunze2364dcd2021-04-26 11:06:57 -070064 int32_t, V, size)
65
66DEF_ATTRIBUTE(Tile, 1,
67 int32_t, V, multiples)
68
TatWai Chong49b1ca62022-06-10 01:49:13 -070069DEF_ATTRIBUTE(Resize, 4,
70 int16_t, V, scale,
71 int16_t, V, offset,
72 int16_t, V, border,
Eric Kunze2364dcd2021-04-26 11:06:57 -070073 ResizeMode, S, mode)
74
75DEF_ATTRIBUTE(Clamp, 4,
76 int32_t, S, min_int,
77 int32_t, S, max_int,
78 float, S, min_fp,
79 float, S, max_fp)
80
81DEF_ATTRIBUTE(Rescale, 7,
82 int32_t, S, input_zp,
83 int32_t, S, output_zp,
84 int32_t, V, multiplier,
85 int32_t, V, shift,
86 bool, S, scale32,
87 bool, S, double_round,
88 bool, S, per_channel)
89
90DEF_ATTRIBUTE(Mul, 1,
91 int32_t, S, shift)
92
93DEF_ATTRIBUTE(ArithmeticRightShift, 1,
94 bool, S, round)
95
96DEF_ATTRIBUTE(CondIf, 2,
97 string, S, then_branch,
98 string, S, else_branch)
99
100DEF_ATTRIBUTE(WhileLoop, 2,
101 string, S, cond_branch,
102 string, S, body_branch)
Kevin Cheng38d214c2021-10-15 15:49:19 -0700103
104DEF_ATTRIBUTE(Transpose, 1,
TatWai Chong7be71652022-05-10 17:26:20 -0700105 int32_t, V, perms)
Kevin Cheng38d214c2021-10-15 15:49:19 -0700106
107DEF_ATTRIBUTE(Table, 1,
TatWai Chong7be71652022-05-10 17:26:20 -0700108 int16_t, V, table)
Kevin Cheng38d214c2021-10-15 15:49:19 -0700109
James Wardea00fd02023-01-20 16:03:50 +0000110DEF_ATTRIBUTE(MatMul, 2,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000111 int32_t, S, a_zp,
James Wardea00fd02023-01-20 16:03:50 +0000112 int32_t, S, b_zp)
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000113
James Wardea00fd02023-01-20 16:03:50 +0000114DEF_ATTRIBUTE(FullyConnected, 2,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000115 int32_t, S, input_zp,
James Wardea00fd02023-01-20 16:03:50 +0000116 int32_t, S, weight_zp)
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000117
118DEF_ATTRIBUTE(Negate, 2,
119 int32_t, S, input1_zp,
120 int32_t, S, output_zp)
Eric Kunze497ab5d2022-10-21 16:39:01 -0700121
122DEF_ATTRIBUTE(Custom, 3,
123 string, S, identifier,
124 string, S, config,
125 uint8_t, V, implementation_attrs)
Luke Hutton5e268092023-01-12 22:20:53 +0000126
127DEF_ATTRIBUTE(FFT, 1,
128 bool, S, inverse)