Eric Kunze | 2364dcd | 2021-04-26 11:06:57 -0700 | [diff] [blame] | 1 | |
| 2 | // Copyright (c) 2020-2021, ARM Limited. |
| 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 | |
| 29 | DEF_ATTRIBUTE(Pool2d, 3, |
| 30 | int32_t, V, padding, |
| 31 | int32_t, V, kernel, |
| 32 | int32_t, V, stride) |
| 33 | |
| 34 | DEF_ATTRIBUTE(Conv2d, 3, |
| 35 | int32_t, V, padding, |
| 36 | int32_t, V, stride, |
| 37 | int32_t, V, dilation) |
| 38 | |
| 39 | DEF_ATTRIBUTE(TransposeConv2d, 4, |
| 40 | int32_t, V, outpad, |
| 41 | int32_t, V, stride, |
| 42 | int32_t, V, dilation, |
| 43 | int32_t, V, output_shape) |
| 44 | |
| 45 | DEF_ATTRIBUTE(ReluN, 2, |
| 46 | int32_t, S, max_int, |
| 47 | float, S, max_fp) |
| 48 | |
| 49 | DEF_ATTRIBUTE(Axis, 1, |
| 50 | int32_t, S, axis) |
| 51 | |
| 52 | DEF_ATTRIBUTE(Reshape, 1, |
| 53 | int32_t, V, shape) |
| 54 | |
| 55 | DEF_ATTRIBUTE(Slice, 2, |
| 56 | int32_t, V, begin, |
| 57 | int32_t, V, size) |
| 58 | |
| 59 | DEF_ATTRIBUTE(Tile, 1, |
| 60 | int32_t, V, multiples) |
| 61 | |
| 62 | DEF_ATTRIBUTE(Resize, 7, |
| 63 | int32_t, V, output_size, |
| 64 | int32_t, V, stride, |
| 65 | int32_t, V, offset, |
| 66 | int32_t, S, shift, |
| 67 | float, V, stride_fp, |
| 68 | float, V, offset_fp, |
| 69 | ResizeMode, S, mode) |
| 70 | |
| 71 | DEF_ATTRIBUTE(Clamp, 4, |
| 72 | int32_t, S, min_int, |
| 73 | int32_t, S, max_int, |
| 74 | float, S, min_fp, |
| 75 | float, S, max_fp) |
| 76 | |
| 77 | DEF_ATTRIBUTE(Rescale, 7, |
| 78 | int32_t, S, input_zp, |
| 79 | int32_t, S, output_zp, |
| 80 | int32_t, V, multiplier, |
| 81 | int32_t, V, shift, |
| 82 | bool, S, scale32, |
| 83 | bool, S, double_round, |
| 84 | bool, S, per_channel) |
| 85 | |
| 86 | DEF_ATTRIBUTE(Mul, 1, |
| 87 | int32_t, S, shift) |
| 88 | |
| 89 | DEF_ATTRIBUTE(ArithmeticRightShift, 1, |
| 90 | bool, S, round) |
| 91 | |
| 92 | DEF_ATTRIBUTE(CondIf, 2, |
| 93 | string, S, then_branch, |
| 94 | string, S, else_branch) |
| 95 | |
| 96 | DEF_ATTRIBUTE(WhileLoop, 2, |
| 97 | string, S, cond_branch, |
| 98 | string, S, body_branch) |