Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 1 | |
Tai Ly | 0b6d7c2 | 2024-03-08 17:03:25 +0000 | [diff] [blame] | 2 | // Copyright (c) 2020-2024, ARM Limited. |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 3 | // |
| 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 Ward | 485a11d | 2022-08-05 13:48:37 +0100 | [diff] [blame] | 29 | DEF_ATTRIBUTE(Pool, 6, |
TatWai Chong | 7be7165 | 2022-05-10 17:26:20 -0700 | [diff] [blame] | 30 | int32_t, V, pad, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 31 | int32_t, V, kernel, |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 32 | int32_t, V, stride, |
| 33 | int32_t, S, input_zp, |
James Ward | 485a11d | 2022-08-05 13:48:37 +0100 | [diff] [blame] | 34 | int32_t, S, output_zp, |
Tai Ly | 81db8ee | 2024-02-14 19:57:38 +0000 | [diff] [blame] | 35 | DType, S, acc_type) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 36 | |
Tai Ly | ad78daa | 2024-03-13 18:52:45 +0000 | [diff] [blame] | 37 | DEF_ATTRIBUTE(Conv, 7, |
TatWai Chong | 7be7165 | 2022-05-10 17:26:20 -0700 | [diff] [blame] | 38 | int32_t, V, pad, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 39 | int32_t, V, stride, |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 40 | int32_t, V, dilation, |
| 41 | int32_t, S, input_zp, |
Eric Kunze | 4881c29 | 2023-11-01 16:12:07 -0700 | [diff] [blame] | 42 | int32_t, S, weight_zp, |
Tai Ly | ad78daa | 2024-03-13 18:52:45 +0000 | [diff] [blame] | 43 | bool, S, local_bound, |
| 44 | DType, S, acc_type) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 45 | |
Suraj Sudhir | 50256e1 | 2024-03-14 23:44:54 +0000 | [diff] [blame^] | 46 | DEF_ATTRIBUTE(TransposeConv, 6, |
Eric Kunze | 7ffa1ff | 2022-06-01 17:26:48 -0700 | [diff] [blame] | 47 | int32_t, V, out_pad, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 48 | int32_t, V, stride, |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 49 | int32_t, S, input_zp, |
Eric Kunze | 4881c29 | 2023-11-01 16:12:07 -0700 | [diff] [blame] | 50 | int32_t, S, weight_zp, |
Tai Ly | ad78daa | 2024-03-13 18:52:45 +0000 | [diff] [blame] | 51 | bool, S, local_bound, |
| 52 | DType, S, acc_type) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 53 | |
Tai Ly | 57d7818 | 2024-04-09 19:31:24 +0000 | [diff] [blame] | 54 | DEF_ATTRIBUTE(Pad, 1, |
| 55 | uint8_t, V, pad_const) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 56 | |
| 57 | DEF_ATTRIBUTE(Axis, 1, |
| 58 | int32_t, S, axis) |
| 59 | |
TatWai Chong | 49b1ca6 | 2022-06-10 01:49:13 -0700 | [diff] [blame] | 60 | DEF_ATTRIBUTE(Resize, 4, |
| 61 | int16_t, V, scale, |
| 62 | int16_t, V, offset, |
| 63 | int16_t, V, border, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 64 | ResizeMode, S, mode) |
| 65 | |
Tai Ly | 57d7818 | 2024-04-09 19:31:24 +0000 | [diff] [blame] | 66 | DEF_ATTRIBUTE(Clamp, 2, |
Tai Ly | 0b6d7c2 | 2024-03-08 17:03:25 +0000 | [diff] [blame] | 67 | uint8_t, V, min_val, |
Tai Ly | 57d7818 | 2024-04-09 19:31:24 +0000 | [diff] [blame] | 68 | uint8_t, V, max_val) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 69 | |
Tai Ly | 0b6d7c2 | 2024-03-08 17:03:25 +0000 | [diff] [blame] | 70 | DEF_ATTRIBUTE(Rescale, 7, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 71 | int32_t, S, input_zp, |
| 72 | int32_t, S, output_zp, |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 73 | bool, S, scale32, |
| 74 | bool, S, double_round, |
Eric Kunze | 9601cbd | 2023-08-17 20:44:39 +0000 | [diff] [blame] | 75 | bool, S, per_channel, |
| 76 | bool, S, input_unsigned, |
| 77 | bool, S, output_unsigned) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 78 | |
| 79 | DEF_ATTRIBUTE(Mul, 1, |
| 80 | int32_t, S, shift) |
| 81 | |
| 82 | DEF_ATTRIBUTE(ArithmeticRightShift, 1, |
| 83 | bool, S, round) |
| 84 | |
| 85 | DEF_ATTRIBUTE(CondIf, 2, |
Tai Ly | 81db8ee | 2024-02-14 19:57:38 +0000 | [diff] [blame] | 86 | string, S, then_graph, |
| 87 | string, S, else_graph) |
Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 88 | |
| 89 | DEF_ATTRIBUTE(WhileLoop, 2, |
Tai Ly | 81db8ee | 2024-02-14 19:57:38 +0000 | [diff] [blame] | 90 | string, S, cond_graph, |
| 91 | string, S, body_graph) |
Kevin Cheng | 38d214c | 2021-10-15 15:49:19 -0700 | [diff] [blame] | 92 | |
| 93 | DEF_ATTRIBUTE(Transpose, 1, |
TatWai Chong | 7be7165 | 2022-05-10 17:26:20 -0700 | [diff] [blame] | 94 | int32_t, V, perms) |
Kevin Cheng | 38d214c | 2021-10-15 15:49:19 -0700 | [diff] [blame] | 95 | |
| 96 | DEF_ATTRIBUTE(Table, 1, |
TatWai Chong | 7be7165 | 2022-05-10 17:26:20 -0700 | [diff] [blame] | 97 | int16_t, V, table) |
Kevin Cheng | 38d214c | 2021-10-15 15:49:19 -0700 | [diff] [blame] | 98 | |
James Ward | ea00fd0 | 2023-01-20 16:03:50 +0000 | [diff] [blame] | 99 | DEF_ATTRIBUTE(MatMul, 2, |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 100 | int32_t, S, a_zp, |
James Ward | ea00fd0 | 2023-01-20 16:03:50 +0000 | [diff] [blame] | 101 | int32_t, S, b_zp) |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 102 | |
James Ward | ea00fd0 | 2023-01-20 16:03:50 +0000 | [diff] [blame] | 103 | DEF_ATTRIBUTE(FullyConnected, 2, |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 104 | int32_t, S, input_zp, |
James Ward | ea00fd0 | 2023-01-20 16:03:50 +0000 | [diff] [blame] | 105 | int32_t, S, weight_zp) |
Eric Kunze | bdcc3fe | 2022-06-07 05:17:37 +0000 | [diff] [blame] | 106 | |
| 107 | DEF_ATTRIBUTE(Negate, 2, |
| 108 | int32_t, S, input1_zp, |
| 109 | int32_t, S, output_zp) |
Eric Kunze | 497ab5d | 2022-10-21 16:39:01 -0700 | [diff] [blame] | 110 | |
| 111 | DEF_ATTRIBUTE(Custom, 3, |
Jerry Ge | cd914da | 2023-11-09 18:41:12 +0000 | [diff] [blame] | 112 | string, S, operator_name, |
| 113 | string, S, domain_name, |
Eric Kunze | 497ab5d | 2022-10-21 16:39:01 -0700 | [diff] [blame] | 114 | uint8_t, V, implementation_attrs) |
Luke Hutton | 5e26809 | 2023-01-12 22:20:53 +0000 | [diff] [blame] | 115 | |
Eric Kunze | 4881c29 | 2023-11-01 16:12:07 -0700 | [diff] [blame] | 116 | DEF_ATTRIBUTE(FFT, 2, |
| 117 | bool, S, inverse, |
| 118 | bool, S, local_bound) |
| 119 | |
| 120 | DEF_ATTRIBUTE(RFFT, 1, |
| 121 | bool, S, local_bound) |