From 2364dcd7241d730021bf68e000e5a6411b9f09d1 Mon Sep 17 00:00:00 2001 From: Eric Kunze Date: Mon, 26 Apr 2021 11:06:57 -0700 Subject: Initial commit of serialization library code Change-Id: Ie09a7245176aa799e59622e5118b145833b23590 Signed-off-by: Eric Kunze --- include/operator.def | 124 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 include/operator.def (limited to 'include/operator.def') diff --git a/include/operator.def b/include/operator.def new file mode 100644 index 0000000..80ae547 --- /dev/null +++ b/include/operator.def @@ -0,0 +1,124 @@ + +// Copyright (c) 2020-2021, ARM Limited. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/* + Syntax: + DEF_OPERATOR(MLIR_NAME, SCHEMA_NAME, REF_IMPL_NAME, OPTIONS, QUANT_INFO) + + Description: + MLIR_NAME: the symbolic string of this op, must match tosa_ops.td + SCHEMA_NAME: corresponding operator name, must match "enum Op" in serialization/tosa.fbs + REF_IMPL_NAME: name used internally in tosa reference implementation + OPTIONS: compile time constant options of this op, corresponding to operator_option.def + QUANT_INFO: quantization infomation of this op, corresponding to quant_info.def +*/ + + +/* tensor operators */ +DEF_OPERATOR(argmax, ARGMAX, ArgMax, Axis, None) +DEF_OPERATOR(avg_pool2d, AVG_POOL2D, AvgPool2d, Pool2d, Unary) +DEF_OPERATOR(conv2d, CONV2D, Conv2d, Conv2d, Conv) +DEF_OPERATOR(conv3d, CONV3D, Conv3d, None, None) +DEF_OPERATOR(depthwise_conv2d, DEPTHWISE_CONV2D, DepthwiseConv2d, Conv2d, Conv) +DEF_OPERATOR(fully_connected, FULLY_CONNECTED, FullyConnected, None, Conv) +DEF_OPERATOR(matmul, MATMUL, MatMul, None, MatMul) +DEF_OPERATOR(max_pool2d, MAX_POOL2D, MaxPool2d, Pool2d, None) +DEF_OPERATOR(transpose_conv2d, TRANSPOSE_CONV2D, TransposeConv2d, TransposeConv2d, Conv) + +/* activation */ +DEF_OPERATOR(clamp, CLAMP, Clamp, Clamp, None) +DEF_OPERATOR(reluN, RELUN, ReluN, ReluN, None) +DEF_OPERATOR(sigmoid, SIGMOID, Sigmoid, None, None) +DEF_OPERATOR(tanh, TANH, Tanh, None, None) + +/* elementwise - binary */ +DEF_OPERATOR(add, ADD, Add, None, None) +DEF_OPERATOR(arithmetic_right_shift, ARITHMETIC_RIGHT_SHIFT, ArithmeticRightShift, ArithmeticRightShift, None) +DEF_OPERATOR(bitwise_and, BITWISE_AND, BitwiseAnd, None, None) +DEF_OPERATOR(bitwise_or, BITWISE_OR, BitwiseOr, None, None) +DEF_OPERATOR(bitwise_xor, BITWISE_XOR, BitwiseXor, None, None) +DEF_OPERATOR(logical_and, LOGICAL_AND, LogicalAnd, None, None) +DEF_OPERATOR(logical_left_shift, LOGICAL_LEFT_SHIFT, LogicalLeftShift, None, None) +DEF_OPERATOR(logical_right_shift, LOGICAL_RIGHT_SHIFT, LogicalRightShift, None, None) +DEF_OPERATOR(logical_or, LOGICAL_OR, LogicalOr, None, None) +DEF_OPERATOR(logical_xor, LOGICAL_XOR, LogicalXor, None, None) +DEF_OPERATOR(maximum, MAXIMUM, Maximum, None, None) +DEF_OPERATOR(minimum, MINIMUM, Minimum, None, None) +DEF_OPERATOR(mul, MUL, Mul, Mul, None) +DEF_OPERATOR(pow, POW, Pow, None, None) +DEF_OPERATOR(sub, SUB, Sub, None, None) +DEF_OPERATOR(table, TABLE, Table, None, None) + +/* elementwise - unary */ +DEF_OPERATOR(abs, ABS, Abs, None, None) +DEF_OPERATOR(bitwise_not, BITWISE_NOT, BitwiseNot, None, None) +DEF_OPERATOR(ceil, CEIL, Ceil, None, None) +DEF_OPERATOR(clz, CLZ, Clz, None, None) +DEF_OPERATOR(exp, EXP, Exp, None, None) +DEF_OPERATOR(floor, FLOOR, Floor, None, None) +DEF_OPERATOR(log, LOG, Log, None, None) +DEF_OPERATOR(logical_not, LOGICAL_NOT, LogicalNot, None, None) +DEF_OPERATOR(negate, NEGATE, Negate, None, Unary) +DEF_OPERATOR(reciprocal, RECIPROCAL, Reciprocal, None, None) +DEF_OPERATOR(rsqrt, RSQRT, Rsqrt, None, None) + +/* elementwise - ternary */ +DEF_OPERATOR(select, SELECT, Select, None, None) + +/* logical */ +DEF_OPERATOR(equal, EQUAL, Equal, None, None) +DEF_OPERATOR(greater, GREATER, Greater, None, None) +DEF_OPERATOR(greater_equal, GREATER_EQUAL, GreaterEqual, None, None) + +/* reduction */ +DEF_OPERATOR(reduce_any, REDUCE_ANY, ReduceAny, Reduce, None) +DEF_OPERATOR(reduce_all, REDUCE_ALL, ReduceAll, Reduce, None) +DEF_OPERATOR(reduce_max, REDUCE_MAX, ReduceMax, Reduce, None) +DEF_OPERATOR(reduce_min, REDUCE_MIN, ReduceMin, Reduce, None) +DEF_OPERATOR(reduce_prod, REDUCE_PRODUCT, ReduceProduct, Reduce, None) +DEF_OPERATOR(reduce_sum, REDUCE_SUM, ReduceSum, Reduce, None) + +/* memory operation */ +DEF_OPERATOR(concat, CONCAT, Concat, Axis, None) +DEF_OPERATOR(pad, PAD, Pad, None, Pad) +DEF_OPERATOR(reshape, RESHAPE, Reshape, Reshape, None) +DEF_OPERATOR(reverse, REVERSE, Reverse, Reverse, None) +DEF_OPERATOR(slice, SLICE, Slice, Slice, None) +DEF_OPERATOR(tile, TILE, Tile, Tile, None) +DEF_OPERATOR(transpose, TRANSPOSE, Transpose, None, None) + +/* gather/scatter */ +DEF_OPERATOR(gather, GATHER, Gather, None, None) +DEF_OPERATOR(scatter, SCATTER, Scatter, None, None) + +/* image */ +DEF_OPERATOR(resize, RESIZE, Resize, Resize, None) + +/* quantization */ +DEF_OPERATOR(cast, CAST, Cast, None, None) +DEF_OPERATOR(rescale, RESCALE, Rescale, Rescale, None) + +/* data nodes */ +DEF_OPERATOR(const, CONST, Const, None, None) +DEF_OPERATOR(placeholder, PLACEHOLDER, Placeholder, None, None) +DEF_OPERATOR(identity, IDENTITY, Identity, None, None) +DEF_OPERATOR(identityn, IDENTITYN, IdentityN, None, None) + +/* custom operations */ +DEF_OPERATOR(custom, CUSTOM, Custom, None, None) + +/* control flow operators */ +DEF_OPERATOR(cond_if, COND_IF, CondIf, CondIf, None) +DEF_OPERATOR(while_loop, WHILE_LOOP, WhileLoop, WhileLoop, None) -- cgit v1.2.1