blob: 30b432d61ea696003e3c582d8c414c3f7456a077 [file] [log] [blame]
Eric Kunze2364dcd2021-04-26 11:06:57 -07001
Tai Ly0b6d7c22024-03-08 17:03:25 +00002// Copyright (c) 2020-2024, 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,
Tai Ly81db8ee2024-02-14 19:57:38 +000035 DType, S, acc_type)
Eric Kunze2364dcd2021-04-26 11:06:57 -070036
Tai Lyad78daa2024-03-13 18:52:45 +000037DEF_ATTRIBUTE(Conv, 7,
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,
Eric Kunze4881c292023-11-01 16:12:07 -070042 int32_t, S, weight_zp,
Tai Lyad78daa2024-03-13 18:52:45 +000043 bool, S, local_bound,
44 DType, S, acc_type)
Eric Kunze2364dcd2021-04-26 11:06:57 -070045
Tai Lyad78daa2024-03-13 18:52:45 +000046DEF_ATTRIBUTE(TransposeConv, 7,
Eric Kunze7ffa1ff2022-06-01 17:26:48 -070047 int32_t, V, out_pad,
Eric Kunze2364dcd2021-04-26 11:06:57 -070048 int32_t, V, stride,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +000049 int32_t, V, output_shape,
50 int32_t, S, input_zp,
Eric Kunze4881c292023-11-01 16:12:07 -070051 int32_t, S, weight_zp,
Tai Lyad78daa2024-03-13 18:52:45 +000052 bool, S, local_bound,
53 DType, S, acc_type)
Eric Kunze2364dcd2021-04-26 11:06:57 -070054
Tai Lyce911a22024-03-21 17:01:14 +000055DEF_ATTRIBUTE(Pad, 2,
56 uint8_t, V, pad_const,
57 DType, S, type)
Eric Kunze2364dcd2021-04-26 11:06:57 -070058
59DEF_ATTRIBUTE(Axis, 1,
60 int32_t, S, axis)
61
TatWai Chong49b1ca62022-06-10 01:49:13 -070062DEF_ATTRIBUTE(Resize, 4,
63 int16_t, V, scale,
64 int16_t, V, offset,
65 int16_t, V, border,
Eric Kunze2364dcd2021-04-26 11:06:57 -070066 ResizeMode, S, mode)
67
Tai Lyce911a22024-03-21 17:01:14 +000068DEF_ATTRIBUTE(Clamp, 3,
Tai Ly0b6d7c22024-03-08 17:03:25 +000069 uint8_t, V, min_val,
Tai Lyce911a22024-03-21 17:01:14 +000070 uint8_t, V, max_val,
71 DType, S, type)
Eric Kunze2364dcd2021-04-26 11:06:57 -070072
Tai Ly0b6d7c22024-03-08 17:03:25 +000073DEF_ATTRIBUTE(Rescale, 7,
Eric Kunze2364dcd2021-04-26 11:06:57 -070074 int32_t, S, input_zp,
75 int32_t, S, output_zp,
Eric Kunze2364dcd2021-04-26 11:06:57 -070076 bool, S, scale32,
77 bool, S, double_round,
Eric Kunze9601cbd2023-08-17 20:44:39 +000078 bool, S, per_channel,
79 bool, S, input_unsigned,
80 bool, S, output_unsigned)
Eric Kunze2364dcd2021-04-26 11:06:57 -070081
82DEF_ATTRIBUTE(Mul, 1,
83 int32_t, S, shift)
84
85DEF_ATTRIBUTE(ArithmeticRightShift, 1,
86 bool, S, round)
87
88DEF_ATTRIBUTE(CondIf, 2,
Tai Ly81db8ee2024-02-14 19:57:38 +000089 string, S, then_graph,
90 string, S, else_graph)
Eric Kunze2364dcd2021-04-26 11:06:57 -070091
92DEF_ATTRIBUTE(WhileLoop, 2,
Tai Ly81db8ee2024-02-14 19:57:38 +000093 string, S, cond_graph,
94 string, S, body_graph)
Kevin Cheng38d214c2021-10-15 15:49:19 -070095
96DEF_ATTRIBUTE(Transpose, 1,
TatWai Chong7be71652022-05-10 17:26:20 -070097 int32_t, V, perms)
Kevin Cheng38d214c2021-10-15 15:49:19 -070098
99DEF_ATTRIBUTE(Table, 1,
TatWai Chong7be71652022-05-10 17:26:20 -0700100 int16_t, V, table)
Kevin Cheng38d214c2021-10-15 15:49:19 -0700101
James Wardea00fd02023-01-20 16:03:50 +0000102DEF_ATTRIBUTE(MatMul, 2,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000103 int32_t, S, a_zp,
James Wardea00fd02023-01-20 16:03:50 +0000104 int32_t, S, b_zp)
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000105
James Wardea00fd02023-01-20 16:03:50 +0000106DEF_ATTRIBUTE(FullyConnected, 2,
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000107 int32_t, S, input_zp,
James Wardea00fd02023-01-20 16:03:50 +0000108 int32_t, S, weight_zp)
Eric Kunzebdcc3fe2022-06-07 05:17:37 +0000109
110DEF_ATTRIBUTE(Negate, 2,
111 int32_t, S, input1_zp,
112 int32_t, S, output_zp)
Eric Kunze497ab5d2022-10-21 16:39:01 -0700113
114DEF_ATTRIBUTE(Custom, 3,
Jerry Gecd914da2023-11-09 18:41:12 +0000115 string, S, operator_name,
116 string, S, domain_name,
Eric Kunze497ab5d2022-10-21 16:39:01 -0700117 uint8_t, V, implementation_attrs)
Luke Hutton5e268092023-01-12 22:20:53 +0000118
Eric Kunze4881c292023-11-01 16:12:07 -0700119DEF_ATTRIBUTE(FFT, 2,
120 bool, S, inverse,
121 bool, S, local_bound)
122
123DEF_ATTRIBUTE(RFFT, 1,
124 bool, S, local_bound)