aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chapters/activation_funcs.adoc49
-rw-r--r--chapters/appendix_a.adoc274
-rw-r--r--chapters/comparison.adoc3
-rw-r--r--chapters/custom.adoc6
-rw-r--r--chapters/enumerations.adoc16
-rw-r--r--chapters/ewise_binary.adoc19
-rw-r--r--chapters/ewise_ternary.adoc1
-rw-r--r--chapters/introduction.adoc157
-rw-r--r--chapters/operators.adoc32
-rw-r--r--chapters/pseudocode.adoc24
-rw-r--r--chapters/scatter_gather.adoc12
-rw-r--r--chapters/tensor_ops.adoc5
-rw-r--r--chapters/type_conversion.adoc4
-rw-r--r--figures/sigmoid.svg120
-rw-r--r--figures/tanh.svg129
-rw-r--r--tools/dictionary.dic2
-rwxr-xr-xtools/genspec.py73
-rwxr-xr-xtools/get_descriptions.py2
-rw-r--r--tools/tosa.py82
-rw-r--r--tosa.xml814
-rw-r--r--tosa.xsd73
-rw-r--r--tosa_spec.adoc2
22 files changed, 416 insertions, 1483 deletions
diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc
index 46fa19d..3bbeb30 100644
--- a/chapters/activation_funcs.adoc
+++ b/chapters/activation_funcs.adoc
@@ -30,24 +30,17 @@ for_each(index in shape) {
==== SIGMOID
-Applies the sigmoid logistic function to each element of the input tensor.
+Sigmoid function: output = 1 / (1 + exp(-input))
-// sigmoid(x) = \frac{1}{1 + e^{-x}}
+For quantized integer data types, the TABLE operator should be used instead with
+the following definition.
-.Calculation for the sigmoid function
-image::sigmoid.svg["Sigmoid definition"]
+The sigmoid table has 513 entries each of 16-bit precision and covering the input range -16.0 to +16.0 in steps of 1/16.
-For quantized integer data types, the TABLE operator should be used instead.
-Each implementation may choose an appropriate TABLE given the scale and zero point of the input data.
-Eight or sixteen bit precision tables may be used based on the input tensor to the sigmoid function.
-Below we give an example table generation for 16-bit sigmoid.
-This sigmoid table has 513 entries each of 16-bit precision and covering the input range -16.0 to +16.0 in steps of 1/16.
-
-.Code for generating 16-bit sigmoid table
[source,c++]
----
int16_t sigmoid_reference(int16_t x) { // input x range is -256 to + 256 inclusive
- fp64_t v = (fp64_t)x / (fp64_t)16;
+ F64 v = (double)x / (double)16;
v = 1.0/(1.0 + exp(-v));
return round_to_nearest_int(32768.0 * v);
}
@@ -57,34 +50,19 @@ generate_lookup_table(&sigmoid_table, &sigmoid_reference);
include::{generated}/operators/SIGMOID.adoc[]
-[source,c++]
-----
-for_each(index in shape) {
- in_out_t value1 = tensor_read<in_out_t>(input, shape, index);
- value = sigmoid<in_out_t>(value1);
- tensor_write<in_out_t>(output, shape, index, value);
-}
-----
-
==== TANH
Parameterized hyperbolic tangent.
-// tanh(x) = \frac{1 - e^{-2x}}{1 + e^{-2x}}
-.Calculation for the sigmoid function
-image::tanh.svg["Hyperbolic tangent definition"]
+For quantized integer data types, the TABLE operator should be used instead with
+the following definition.
-For quantized integer data types, the TABLE operator should be used instead.
-Each implementation may choose an appropriate TABLE given the scale and zero point of the input data.
-Eight or sixteen bit precision tables may be used based on the input tensor to the sigmoid function.
-Below we give an example table generation for 16-bit hyperbolic tangent.
-This tanh_table has 513 entries each of 16-bit precision and covering the input range -8.0 to +8.0 in steps of 1/32.
+The tanh_table has 513 entries each of 16-bit precision and covering the input range -8.0 to +8.0 in steps of 1/32. The table is specified by:
-.Calculation of an example 16-bit tanh table
[source,c++]
----
int16_t tanh_reference(int16_t x) { // input x range is -256 to +256 inclusive
- fp64_t v = (fp64_t)x/(fp64_t)32;
+ F64 v = (double)x/(double)32;
v = exp(-2.0*v);
v = (1.0-v)/(1.0+v);
return round_to_nearest_int(32768.0 * v);
@@ -94,12 +72,3 @@ generate_lookup_table(&tanh_table, &tanh_reference);
----
include::{generated}/operators/TANH.adoc[]
-
-[source,c++]
-----
-for_each(index in shape) {
- in_out_t value1 = tensor_read<in_out_t>(input, shape, index);
- value = tanh<in_out_t>(value1);
- tensor_write<in_out_t>(output, shape, index, value);
-}
-----
diff --git a/chapters/appendix_a.adoc b/chapters/appendix_a.adoc
index f601d5d..33a4f11 100644
--- a/chapters/appendix_a.adoc
+++ b/chapters/appendix_a.adoc
@@ -30,257 +30,37 @@ float set_data(uint32_t set, uint32_t index)
}
----
-=== Main Inference test data generator
+=== Dot product floating-point test data sets
-This section describes the function tosa_mi_data(S, KS, p, k, i) that generates test data for main inference compliance.
-This function takes the following arguments:
+Each test set is indexed by a pair (S, N) where:
-* S is the test set number which identifies which generator is used
-* KS is the kernel size
-* p is the parameter number of 0 for the first input (usually data) and 1 for the second input (usually weights)
-* k is the index within the kernel in the range 0 \<= k < KS
-* i is the index within the tensor to write
+* S is the test set number
+* N is the number of elements in a single test vector
-Some test data values are scaled by the bound parameter B which is defined in the table below.
-B is set to be the largest value that is both representable by the input type and such that B*B does not overflow the accumulator precision.
+Each test set (S, N) contains multiple tests that statistics are calculated over.
+The parameter T is the number of tests in a given set.
+In the table below, t is the test number within a set in the range 0 to T-1.
+[cols="1,1,1,5,5"]
|===
-| inputs type | accumulator type | B value
-| fp16 | fp16 | (1<<8) - (1/8) = 255.875
-| fp16 | fp32 | (1<<16) - (1<<5) = 65504
-| bf16 | fp32 | (1<<64) - (1<<56)
-| fp32 | fp32 | (1<<64) - (1<<40)
-|===
-
-==== Test set S=0 generator
-
-The aim of this generator is to check that sum of products with zero gives zero result.
-
-[cols="1,9"]
-|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | set_data(2*S, i) < 0 ? 0.0 : set_data(2*S+1, i)
-| 1 | set_data(2*S, i) < 0 ? set_data(2*S+1, i) : 0.0
-|===
-
-==== Test set S=1
-
-The aim of this test set is to check values with large exponents.
-
-[cols="1,9"]
-|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (B/sqrt(N))*(0.75 + 0.25*set_data(2*S+0, i))
-| 1 | (B/sqrt(N))*(0.75 + 0.25*set_data(2*S+1, i))
-|===
-
-==== Test set S=2
-
-The aim of this test set is to check rounding error when accumulating small values onto a large value.
-In this case the small values are of similar magnitude.
-If the implementation changes the order of the sum, then the test data must also be reordered so that the largest values occur first in the sum.
-
-[cols="1,9"]
-|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (k==0) ? 1.0 : set_data(2*S+0, i)/sqrt(KS)
-| 1 | (k==0) ? 1.0 : set_data(2*S+1, i)/sqrt(KS)
-|===
-
-==== Test set S=3
-
-The aim of this test set is to check rounding error when accumulating small values onto a large value.
-In this case the small values are of varying magnitude.
-If the implementation changes the order of the sum, then the test data must also be reordered so that the largest values occur first in the sum.
-
-[cols="1,9"]
-|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (k==0) ? 16.0 : exp(2*set_data(2*S+0, 2*i+0)) * set_data(2*S+0, 2*i+1)
-| 1 | (k==0) ? 16.0 : exp(2*set_data(2*S+1, 2*i+0)) * set_data(2*S+1, 2*i+1)
-|===
-
-==== Test set S=4
-
-The aim of this test set is to check a mixture of zero and non-zero products.
-
-[cols="1,9"]
-|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (k==KS/2) ? +0.5 : (set_data(2*S, i) < 0 ? 0.0 : B*set_data(2*S+1, i))
-| 1 | (k==KS/2) ? -0.5 : (set_data(2*S, i) < 0 ? B*set_data(2*S+1, i) : 0.0)
-|===
+| Set S | N range | T | x[k] formula for k < N | w[k] formula for k < N
+
+| 0
+| 2-25,50,100,1000
+| 10
+| x[k]=set_data(S, 2*t*N+2*k) < 0 ? 0.0 : set_data(S, 2*t*N+2*k+1)
+| w[k]=set_data(S, 2*t*N+2*k) < 0 ? set_data(S, 2*t*N+2*k+1) : 0.0
+
+| 1
+| 2-25,50,100,1000
+| 1000
+| x[k]=2.0*set_data(S, 2*t*N + k)
+| w[k]=2.0*set_data(S, (2*t+1)*N + k)
+
+| 2
+| 2-25,50,100,1000
+| 1000
+| x[0]=1.0, x[k]=set_data(S, 2*t*N + k)/sqrt(N) for k>0
+| w[0]=1.0, w[k]=set_data(S, (2*t+1)*N + k)/sqrt(N) for k>0
-==== Test set S=5
-
-The aim of this test set is to check signed inputs of large range.
-
-[cols="1,9"]
|===
-| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (B/sqrt(KS))*set_data(2*S+0, i)
-| 1 | (B/sqrt(KS))*set_data(2*S+1, i)
-|===
-
-=== Main Inference operator test data
-
-For each operator, this section defines how to generate test data for test set S.
-For the results to be statistically significant the operation must calculate at least MIN_DOT_PRODUCTS dot products.
-For most operations this means that the output tensor must have at least MIN_DOT_PRODUCTS output values.
-For most operations batch size can be increased if necessary so that this holds.
-For this version of the specification, MIN_DOT_PRODUCTS is set to 1000.
-
-==== CONV2D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OH*OW*OC >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = KW*KH*IC;
-for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= ic < IC) {
- input [ n, iy, ix, ic] = tosa_mi_data(S, KS, 0, ((iy % KH)*KW+(ix % KW))*IC+ic, ((n*IH+iy)*IW+ix)*IC+ic);
-}
-for (0 <= oc < OC, 0 <= ky < KH, 0 <= kx < KW, 0 <= ic < IC) {
- weight[oc, ky, kx, ic] = tosa_mi_data(S, KS, 1, (ky*KW+kx)*IC+ic, ((oc*KH+ky)*KW+kx)*IC+ic);
-}
-----
-
-==== CONV3D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OD*OH*OW*OC >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = KD*KW*KH*IC;
-for (0 <= n < N, 0 <= id < UD, 0 <= iy < IH, 0 <= ix < IW, 0 <= ic < IC) {
- input [ n, id, iy, ix, ic] = tosa_mi_data(S, KS, 0, (((id % KD)*KH+(iy % KH))*KW+(ix % KW))*IC+ic, (((n*ID+id)*IH+iy)*IW+ix)*IC+ic);
-}
-for (0 <= oc < OC, 0 <= kd < KD, 0 <= ky < KH, 0 <= kx < KW, 0 <= ic < IC) {
- weight[oc, kd, ky, kx, ic] = tosa_mi_data(S, KS, 1, ((kd*KH+ky)*KW+kx)*IC+ic, (((oc*KD+kd)*KH+ky)*KW+kx)*IC+ic);
-}
-----
-
-==== DEPTHWISE_CONV2D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OH*OW*C*M >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = KW*KH*C;
-for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= c < C) {
- input [ n, iy, ix, c] = tosa_mi_data(S, KS, 0, ((iy % KH)*KW+(ix % KW))*C+c, ((n*IH+iy)*IW+ix)*C+c);
-}
-for (0 <= ky < KH, 0 <= kx < KW, 0 <= c < C, 0 <= m < M) {
- weight[ky, kx, c, m] = tosa_mi_data(S, KS, 1, (ky*KW+kx)*C+c, ((ky*KW+kx)*C+c)*M+m);
-}
-----
-
-==== FULLY_CONNECTED
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OC >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = IC;
-for (0 <= n < N, 0 <= ic < IC) {
- input [ n, ic] = tosa_mi_data(S, KS, 0, ic, n*IC+ic);
-}
-for (0 <= oc < OC, 0 <= ic < IC) {
- weight[oc, ic] = tosa_mi_data(S, KS, 1, ic, oc*IC+ic);
-}
-----
-
-==== MATMUL
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*H*W >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = C;
-for (0 <= n < N, 0 <= y < H, 0 <= c < C) {
- A[n, y, c] = tosa_mi_data(S, KS, 0, c, (n*H+y)*C+c);
-}
-for (0 <= n < N, 0 <= c < C, 0 <= x < W) {
- B[n, c, x] = tosa_mi_data(S, KS, 1, c, (n*C+c)*W+x);
-}
-----
-
-==== TRANSPOSE_CONV2D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OH*OW*OC >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = KW*KH*IC;
-for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= ic < IC) {
- input [ n, iy, ix, ic] = tosa_mi_data(S, KS, 0, ((iy % KH)*KW+(ix % KW))*IC+ic, ((n*IH+iy)*IW+ix)*IC+ic);
-}
-for (0 <= oc < OC, 0 <= ky < KH, 0 <= kx < KW, 0 <= ic < IC) {
- weight[oc, ky, kx, ic] = tosa_mi_data(S, KS, 1, (ky*KW+kx)*IC+ic, ((oc*KH+ky)*KW+kx)*IC+ic);
-}
-----
-
-==== FFT2D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*H*W >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = 2*H*W;
-for (0 <= n < N, 0 <= y < H, 0 <= x < W) {
- input_real[n, y, x] = tosa_mi_data(S, KS, 0, y*W+x, ((0*N+n)*H+y)*IW+x);
- input_imag[n, y, x] = tosa_mi_data(S, KS, 0, y*W+x, ((1*N+n)*H+y)*IW+x);
-}
-for (0 <= y < H, 0 <= x < W, 0 <= m < H, 0 <= n < W) {
- weight_real[y, x, m, n] = real(exp(2*pi*i*((m*h/H) + (n*w/W))));
- weight_imag[y, x, m, n] = imag(exp(2*pi*i*((m*h/H) + (n*w/W))));
-}
-----
-
-==== REDUCE_SUM
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`tensor_size(shape) >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = shape1[axis];
-for (index in shape1) {
- input[index] = tosa_mi_data(S, KS, 0, index[axis], tensor_index_to_offset(index));
-}
-for (0 <= c < KS) {
- weight[c] = 1;
-}
-----
-
-==== AVG_POOL2D
-
-The following generates input test data for test set S.
-For compliant implementation, the test must pass whenever the attributes satisfy:
-`N*OH*OW*C >= MIN_DOT_PRODUCTS`
-
-[source,c++]
-----
-KS = KY*KX;
-for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= c < C) {
- input [ n, iy, ix, c] = tosa_mi_data(S, KS, 0, ((iy % KH)*KW+(ix % KW))*C+c, ((n*IH+iy)*IW+ix)*C+c);
-}
-for (0 <= ky < KH, 0 <= kx < KW, 0 <= c < C, 0 <= m < M) {
- weight[ky, kx] = 1/KS;
-}
-----
diff --git a/chapters/comparison.adoc b/chapters/comparison.adoc
index 4ef52d6..f4da361 100644
--- a/chapters/comparison.adoc
+++ b/chapters/comparison.adoc
@@ -17,7 +17,6 @@ include::{generated}/operators/EQUAL.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -40,7 +39,6 @@ include::{generated}/operators/GREATER.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -63,7 +61,6 @@ include::{generated}/operators/GREATER_EQUAL.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
diff --git a/chapters/custom.adoc b/chapters/custom.adoc
index e748f38..4804e25 100644
--- a/chapters/custom.adoc
+++ b/chapters/custom.adoc
@@ -12,9 +12,9 @@
Hardware implementing TOSA may choose to add additional custom operators that are not expressed in the existing TOSA operations. These operators are not expected to be portable across TOSA implementations. The input and output signatures must be expressed in the corresponding TOSA node.
==== CUSTOM
-Input arguments:
+Input Operands:
-* Num input arguments – Scalar number of input arguments
-* Num output arguments – Scalar number of output arguments
+* Num input operands – Scalar number of input operands
+* Num output operands – Scalar number of output operands
* Operator code – untyped data consisting of the operator data
* Affine transform description for each tensor
diff --git a/chapters/enumerations.adoc b/chapters/enumerations.adoc
deleted file mode 100644
index 9ef6dce..0000000
--- a/chapters/enumerations.adoc
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-// This confidential and proprietary software may be used only as
-// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2023 ARM Limited
-// ALL RIGHTS RESERVED
-// The entire notice above must be reproduced on all authorised
-// copies and copies may only be made to the extent permitted
-// by a licensing agreement from ARM Limited.
-
-== Enumerations
-
-Where enumerated types are specified for an operator, the provided value must be a valid enumerant for that type.
-The included tables provide reference values for the enumerations.
-Implementations do not need to use these values, they may substitute other values as long as they are functionally equivalent.
-
-include::{generated}/enums.adoc[]
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc
index 864cf5b..963d712 100644
--- a/chapters/ewise_binary.adoc
+++ b/chapters/ewise_binary.adoc
@@ -18,7 +18,6 @@ include::{generated}/operators/ADD.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -38,7 +37,6 @@ include::{generated}/operators/ARITHMETIC_RIGHT_SHIFT.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -68,7 +66,6 @@ include::{generated}/operators/BITWISE_AND.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -88,7 +85,6 @@ include::{generated}/operators/BITWISE_OR.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -108,7 +104,6 @@ include::{generated}/operators/BITWISE_XOR.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -131,7 +126,6 @@ include::{generated}/operators/INTDIV.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -155,7 +149,6 @@ include::{generated}/operators/LOGICAL_AND.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -175,7 +168,6 @@ include::{generated}/operators/LOGICAL_LEFT_SHIFT.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -196,7 +188,6 @@ include::{generated}/operators/LOGICAL_RIGHT_SHIFT.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -217,7 +208,6 @@ include::{generated}/operators/LOGICAL_OR.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -237,7 +227,6 @@ include::{generated}/operators/LOGICAL_XOR.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -257,7 +246,6 @@ include::{generated}/operators/MAXIMUM.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -277,7 +265,6 @@ include::{generated}/operators/MINIMUM.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -297,9 +284,7 @@ include::{generated}/operators/MUL.adoc[]
[source,c++]
----
-REQUIRE(0 <= shift && shift <= 63);
-REQUIRE(in_t == int32_t || shift == 0);
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
+ERROR_IF(in_t != int32_t && shift > 0);
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -328,7 +313,6 @@ include::{generated}/operators/POW.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
@@ -348,7 +332,6 @@ include::{generated}/operators/SUB.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(shape1, shape2));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
diff --git a/chapters/ewise_ternary.adoc b/chapters/ewise_ternary.adoc
index 57cf599..0b8097d 100644
--- a/chapters/ewise_ternary.adoc
+++ b/chapters/ewise_ternary.adoc
@@ -17,7 +17,6 @@ include::{generated}/operators/SELECT.adoc[]
[source,c++]
----
-ERROR_IF(shape != broadcast_shape(broadcast_shape(shape1, shape2), shape3));
for_each(index in shape) {
dim_t index1 = apply_broadcast(shape, shape1, index);
dim_t index2 = apply_broadcast(shape, shape2, index);
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc
index b369070..cae23d4 100644
--- a/chapters/introduction.adoc
+++ b/chapters/introduction.adoc
@@ -79,7 +79,7 @@ The following principles govern the selection of operators within TOSA.
|Consistent sub-operation definition reduces the operator implementation cost.
|P4
-|The valid input and output ranges for all arguments shall be specified.
+|The valid input and output ranges for all operands shall be specified.
|Ranges are required to make consistent (numerically agreeing) implementations possible.
|P5
@@ -108,11 +108,11 @@ The following table summarizes the three profiles:
=== Levels
-A TOSA level defines operator argument ranges that an implementation shall support.
+A TOSA level defines operator parameter ranges that an implementation shall support.
This is distinct from a profile that defines the operations and data-types supported.
This version of the specification defines two TOSA levels:
-* No level : allows the full range of arguments specified by the operations according to the operation data types.
+* No level : allows the full range of parameters specified by the operations according to the operation data types.
* Level 8K : ranges are expected to be sufficient for applications with frame sizes up to 8K.
Later versions of the specification may define additional levels.
@@ -120,7 +120,11 @@ The following table defines the value ranges for Level 1.0.
These ranges are checked using the LEVEL_CHECK() function with the operator descriptions.
.Level maximums
-include::{generated}/levels.adoc[]
+|===
+| Level | tosa_level_t | MAX_RANK | MAX_KERNEL | MAX_STRIDE | MAX_SCALE
+| None | tosa_level_none | NA | NA | NA | NA
+| 8K | tosa_level_8k | 6 | 8192 | 8192 | 64
+|===
=== Status
@@ -135,10 +139,7 @@ The TOSA specification is a work in progress.
=== Compliance
This section defines when a TOSA implementation is compliant to a given TOSA specification profile and level.
-To be compliant an implementation must achieve the results and accuracy defined by this specification.
-TOSA also defines a set of conformance tests.
-A compliant implementation must pass the conformance tests.
-The conformance tests are not exhaustive, so an implementation that passes the conformance tests may not be compliant if there is a non-compliance that is undetected by the tests.
+The term conformant will mean the same as compliant.
==== Base Inference Profile Compliance
@@ -180,7 +181,7 @@ bool tosa_test_compliance(tosa_graph_t graph, tosa_list_t input_list, tosa_level
}
----
-==== Main Inference Profile Compliance
+==== Main Inference Profile
A Main Inference compliant implementation must satisfy the following:
@@ -219,7 +220,7 @@ The following criteria apply to all operations:
| Operation | Accuracy bound
| <<ARGMAX>>, <<MAX_POOL2D>>, <<CLAMP>>, <<MAXIMUM>>, <<MINIMUM>>, <<ABS>>, <<NEGATE>>, , <<CONST>>, <<IDENTITY>>
-| Non NaN results must be exact.
+| The result must be exact.
| <<EQUAL>>, <<GREATER>>, <<GREATER_EQUAL>>
| The result must be exact with: +
@@ -231,25 +232,19 @@ The following criteria apply to all operations:
The dot product must meet the <<Dot product accuracy requirements>>
| <<FFT2D>>, <<RFFT2D>>
-| Each output can be expressed as a dot product of an input vector with a constant coefficient vector. +
+| Each output can be expressed as a dot product of an input vector with a costant vector. +
The dot product must meet the <<Dot product accuracy requirements>>
-| <<ADD>>, <<MUL>>, <<SUB>>, <<CEIL>>, <<FLOOR>>
+| <<ADD>>, <<MUL>>, <<SUB>>, <<CEIL>>, <<FLOOR>>, <<CAST>>
| Floating-point result overflows must be set to infinity of the correct sign. +
Floating-point result underflows must be set to zero of the correct sign. +
+Integer result overflows must be saturated. +
Addition of infinites of different signs must produce a NaN. +
Subtraction of infinities of the same sign must produce a NaN. +
Multiplication of an infinity by a zero must produce a NaN. +
Otherwise for fp32_t the result must be rounded to the nearest representable value using the round to nearest, ties to even rounding mode. +
Otherwise for fp16_t and bf16_t the result must be within 0.5 ulp of the mathematical result.
-| <<CAST>>
-| Floating-point result overflows must be set to infinity of the correct sign. +
-Floating-point result underflows must be set to zero of the correct sign. +
-Cast from floating-point to integer result overflows must be saturated. +
-Otherwise for fp32_t the result must be rounded to the nearest representable value using the round to nearest, ties to even rounding mode. +
-Otherwise for fp16_t and bf16_t the result must be within 0.5 ulp of the mathematical result.
-
| <<RECIPROCAL>>
| If the input is a zero or the result overlows the output must be an infinity of the same sign. +
If the input is an infinty or the result underflows the output must be a zero of the same sign. +
@@ -273,7 +268,7 @@ Otherwise the result must be within 5 ulp of the mathematical result.
This dot product must meet the <<Dot product accuracy requirements>>
| <<AVG_POOL2D>>
-| Each output can be expressed as a dot product of an input vector with a vector with elements 1/KS where KS is the kernel size. +
+| Each output can be expressed as a dot product of an input vector with a vector with elements 1/d where d is the kernel size. +
This dot product must meet the <<Dot product accuracy requirements>>
| <<REDUCE_PRODUCT>>
@@ -286,65 +281,36 @@ where `E = pow(1 + pow(2, -M-1), N) - 1`. In this expression M is the number of
===== Dot product accuracy requirements
-This section assumes an operation acting on two tensors named 'input' and 'weight'.
-Each output tensor element can be expressed as a dot product of elements between the input and weight tensors.
-The dot product has length KS, the kernel size.
-Note: KS is defined for each relevant operator in the appendix section <<Main Inference operator test data>>.
-
-In other words each output element `out` can be expressed as a dot product between input elements `in[k]` and weight elements `w[k]`:
-
-`out = in[0] * w[0] + in[1] * w[1] + ... + in[KS-1] * w[KS-1]`
-
-The positions of `in[k]` and `w[k]` in the input and weight tensors depends on the operation being performed (for example a convolution).
-
-This section defines the accuracy required for these operations.
-The term "fp64 arithmetic" refers to double-precision floating-point arithmetic defined by <<Other publications>>[1].
-
-For an operation with given sizes and attributes to be compliant the following must hold for each data set S defined in <<Appendix A>>:
-
-* Let input be the input tensor generated by <<Main Inference operator test data>> for test set S
-* Let weight be the weight tensor generated by <<Main Inference operator test data>> for test set S
-* Let output_ref be the output tensor calculated by the operation using fp64 arithemic
-* Let output_imp be the output tensor calculated by the implementation to test
-* Let input_abs be the input tensor with each element replaced with its absolute value
-* Let weight_abs be the weight tensor with each element replaced with its absolute value
-* Let output_bnd be the output tensor calculated using fp64 arithmetic on input_abs and weight_abs
-
-The following checks must then pass:
-
-[source,c++]
-----
-size_t T = tensor_size(output_shape) // number dot product results
-fp64_t out_err_sum = 0.0;
-fp64_t out_err_sumsq = 0.0;
-fp64_t acc_prec; // 1<<(M+1) where M is the number of mantissa bits
-switch (acc_t) {
- case fp32_t: acc_prec = (fp64_t)(1<<24); break;
- case fp16_t: acc_prec = (fp64_t)(1<<11); break;
- default: ERROR_IF(true);
-}
-for_each(index in output_shape) {
- fp64_t out_bnd = tensor_read<fp64_t>(output_bnd, output_shape, index);
- fp64_t out_ref = tensor_read<fp64_t>(output_ref, output_shape, index);
- acc_t out_imp = tensor_read<acc_t> (output_imp, output_shape, index);
- fp64_t out_err;
- if (out_bnd == 0.0) {
- REQUIRE(out_ref == 0.0 && out_imp == 0.0);
- out_err = 0.0;
- } else { // out_bnd > 0.0
- out_err = ((fp64_t)out_imp - out_ref)*acc_prec/out_bnd;
- REQUIRE(abs(out_err) <= KS);
- }
- out_err_sum += out_err;
- out_err_sumsq += out_err * out_err;
-}
-if (S!=1 && S!=2) {
- // check output error bias magnitude for data sets S which are not positive biased
- REQUIRE(abs(out_err_sum) <= 2*sqrt(KS*T));
-}
-// check output error variance magnitude
-REQUIRE(out_err_sumsq <= 0.4*KS*T)
-----
+This section gives accuracy constraints for operations where the result is a sum of products of N floating-point inputs:
+
+`y = x[0] * w[0] + x[1] * w[1] + ... + x[N-1] * w[N-1]`
+
+Let M be the number of mantissa bits in the accumulator.
+So M=23 for an `fp32_t` accumulator and M=10 for an `fp16_t` accumulator.
+
+In this section "fp64 arithmetic" refers to double-precision floating-point arithmetic defined by <<Other publications>>[1].
+
+Appendix A, defines a number of <<Dot product floating-point test data sets>>.
+For each data test set (S, N) consisting of T tests the following must hold:
+
+* For each test t in the range 0 to T-1, calculate:
+** `y_imp[t] = x[0] * w[0] + ... + x[N-1] * w[N-1]` calculated by the implementation
+** `y_ref[t] = x[0] * w[0] + ... + x[N-1] * w[N-1]` calculated using fp64 arithmetic
+** `y_bnd[t] = abs(x[0] * w[0]) + ... + abs(x[N-1] * w[N-1])` calculated using fp64 arithmetic
+* if `y_bnd[t] == 0` then
+** `y_imp[t]` must be zero and set `y_err[t] = 0`
+* if `y_bnd[t] > 0` then set:
+** `y_err[t] = (y_imp[t] - y_ref[t]) * (1<<(M+1)) / y_bnd[t]` calculated using fp64 arithmetic
+* For each test t the following must be satisfied:
+** `y_ref[t], y_bnd[t], y_imp[t]` must be finite
+** `abs(y_err[t]) \<= N`
+* Calculate the sum of y_err using fp64 arithmetic:
+** `y_err_sum = y_err[0] + .... + y_err[T-1]`
+* Calculate the sum of y_err squared using fp64 arithmetic:
+** `y_err_sumsq = y_err[0] * y_err[0] + ... + y_err[T-1] * y_err[T-1]`
+* The error sum and sum squares must satisfy the following. The first equation bounds the bias and the second the error variance.
+** `abs(y_err_sum) \<= 2*sqrt(N*T)`
+** `y_err_sumsq \<= 0.4*N*T`
=== Tensor Definitions
@@ -369,13 +335,10 @@ Tensor elements are addressed using dim_t values, where each element of the vect
==== Tensor size limit
-The tensor overall size is limited by the data type size_t.
-This type must be able to hold integers in the range 0 to (1++<<++(MAX_LOG2_SIZE+1)) - 1 where MAX_LOG2_SIZE is defined in <<Levels>>.
-For each tensor, the number of tensor elements multiplied by the element size in bytes (which is taken to be 1 for elements smaller than a 8-bit) must be less than or equal to (1<<(MAX_LOG2_SIZE+1)) - 1.
-
-The size of tensors along each of their dimensions is limited by the data type index_t.
-This type must be able to hold integers in the range 0 to (1++<<++MAX_LOG2_SIZE) - 1 where MAX_LOG2_SIZE is defined in <<Levels>>.
-This means that the maximum size of a tensor along each dimension is (1<<MAX_LOG2_SIZE) - 1 and therefore the maximum coordinate value is (1<<MAX_LOG2_SIZE) - 2.
+The tensor overall size in elements is limited by the data type size_t.
+In this version of the specification, size_t is defined as an unsigned 32-bit integer representing size from 1 to (1<<32) - 1.
+A tensor dimension co-ordinate is limited by the data type index_t.
+In this version of the specification, index_t is defined as a signed 32-bit integer.
Indices used to access tensors must be non-negative.
==== Data Layouts
@@ -480,17 +443,7 @@ Signed zero must be supported.
|fp32_t
| -infinity
| +infinity
-| 32-bit single-precision floating-point defined by <<Other publications>>[1]. +
-Normal values must be supported. +
-Denormal values must either be supported or flushed to zero. +
-Positive and negative infinity must be supported. +
-At least one NaN encoding must be supported. +
-Signed zero must be supported.
-
-|fp64_t
-| -infinity
-| + infinity
-| 64-bit double-precision floating-point defined by <<Other publications>>[1]. +
+| 16-bit single-precision floating-point defined by <<Other publications>>[1]. +
Normal values must be supported. +
Denormal values must either be supported or flushed to zero. +
Positive and negative infinity must be supported. +
@@ -522,7 +475,7 @@ To convert a network containing quantized tensors to TOSA, generate explicit RES
This reduces quantized operations to purely integer operations.
As an example, an ADD between two quantized tensors requires the integer values represent the same range.
-The scale arguments for RESCALE can be calculated to ensure that the resulting tensors represent the same range.
+The scale parameters for RESCALE can be calculated to ensure that the resulting tensors represent the same range.
Then the ADD is performed, and a RESCALE can be used to ensure that the result is scaled properly.
RESCALE provides support for per-tensor and per-channel scaling values to ensure compatibility with a range of possible quantization implementations.
@@ -554,7 +507,7 @@ The values to achieve a scaling of 1.0 are shift=30, multiplier=1<<30 for apply_
[source,c++]
----
-int32_t apply_scale_32(int32_t value, int32_t multiplier, int8_t shift, bool_t double_round=false) {
+int32_t apply_scale_32(int32_t value, int32_t multiplier, uint6_t shift, bool_t double_round=false) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
REQUIRE(value >= (-1 << (shift - 1)) && value < (1 << (shift - 1));
@@ -569,7 +522,7 @@ int32_t apply_scale_32(int32_t value, int32_t multiplier, int8_t shift, bool_t d
return (int32_t)result;
}
-int32_t apply_scale_16(int48_t value, int16_t multipler, int8_t shift) {
+int32_t apply_scale_16(int48_t value, int16_t multipler, uint6_t shift) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
int64_t round = (1 << (shift - 1));
@@ -586,7 +539,7 @@ In some functions, the multiplier and shift are combined into a scale_t structur
----
typedef struct {
int32_t multiplier;
- int8_t shift;
+ uint6_t shift;
} scale_t;
----
@@ -662,4 +615,4 @@ void generate_lookup_table(int16_t *table, int32_t (*reference)(int32_t))
The following publications are referred to in this specification, or provide more information:
-. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008.
+. IEEE Std 754-2008, _IEEE Standard for Floating-point Arithmetic_, August 2008. \ No newline at end of file
diff --git a/chapters/operators.adoc b/chapters/operators.adoc
index 3a4c831..d6d1f13 100644
--- a/chapters/operators.adoc
+++ b/chapters/operators.adoc
@@ -9,23 +9,14 @@
== Operators
-=== Operator Arguments
+=== Operator Parameters
-Operators process input arguments to produce output arguments.
-Their behavior can be configured using attribute arguments.
-Arguments may have one of the following types:
+An operator processes input operands to produce output operands. An operator can have three types of parameters:
-* `tensor_t<element_type>`, abbreviated `T<element_type>`, represents a tensor whose elements are of type `element_type` where `element_type` can be any of the data types supported in TOSA.
-* `tensor_list_t` represents a list of tensors. When lists are homogeneous, i.e. contain tensors of the same type, their type is further qualified as follows: `tensor_list_t<T<element_type>>`.
-* `tosa_graph_t` represents a TOSA graph (see <<operator-graphs>>).
+* An input operand. This must be a tensor or a list of tensors and data is read by the operation.
+* An output operand. This must be a tensor or a list of tensors and data is written by the operation.
+* An attribute. This is a parameter that is constant for a particular instance of the operator. It may have any data type supported by TOSA. It is expected to be set at compile time.
-Arguments belong to one of three categories: Input, Output, or Attribute. The category to which an argument belongs further constrains its type:
-
-* An Input argument must be a tensor or a list of tensors used to provide the data read by the operation.
-* An Output argument must be a tensor or a list of tensors into which the data produced by the operation is written.
-* An Attribute argument is constant, i.e. its value is known at compilation time. It may have any data type supported by TOSA.
-
-[[operator-graphs]]
=== Operator Graphs
A TOSA graph is a collection of TOSA operators where:
@@ -36,7 +27,7 @@ A TOSA graph is a collection of TOSA operators where:
* The attributes must be in the valid range permitted for the operator
* The tensor dimensions must be in the valid range permitted for the operator
-Some operators, such as control flow operators, take a graph of other operators as an attribute. The type `tosa_graph_t` will denote a graph of operators and the following functions define the tensor shape list for the graph input and outputs:
+Some operators, such as control flow operators, take a graph of other operators as an attribute. The type tosa_graph_t will denote a graph of operators and the following functions define the tensor shape list for the graph input and outputs:
[source,c++]
----
@@ -50,16 +41,11 @@ Similarly the type tensor_list_t will be used for a list of tensors and the foll
shape_list_t tensor_list_shape(tosa_list_t tensor_list);
----
-The following function denotes the execution of a TOSA graph within a TOSA context,
-on an input tensor list to produce an output tensor list. A TOSA context, represented
-by `tosa_context_t` provides the environment in which a TOSA graph is executed.
-Any side-effects that result from the execution of a graph within a context are not
-observable by graphs executing in a different context. Operators are executed in an
-implementation-defined order that must be a topological ordering of the TOSA graph.
+The following function denotes the execution of a TOSA graph, on an input tensor list to produce an output tensor list.
[source,c++]
----
-tosa_execute_graph(tosa_context_t context, tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list, tosa_level_t level) {
+tosa_execute_graph(tosa_graph_t graph, tosa_list_t input_list, tosa_list_t output_list, tosa_level_t level) {
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(graph));
ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(graph));
for_each(operator in graph order) {
@@ -68,7 +54,7 @@ tosa_execute_graph(tosa_context_t context, tosa_graph_t graph, tosa_list_t input
ERROR_IF(operator output tensors do not meet requirement of operator Arguments outputs)
ERROR_IF(operator data types do not meet requirement of operator Supported Data Types)
// Execute the operator as defined by the operation function pseduo-code
- tosa_execute_operator(context, operator, level);
+ tosa_execute_operator(operator, level);
}
}
----
diff --git a/chapters/pseudocode.adoc b/chapters/pseudocode.adoc
index 422188a..db699d1 100644
--- a/chapters/pseudocode.adoc
+++ b/chapters/pseudocode.adoc
@@ -62,7 +62,7 @@ void LEVEL_CHECK(condition) {
[source,c++]
----
-// Convert tensor index coordinates to an element offset
+// Convert tensor index co-ordinates to an element offset
size_t tensor_index_to_offset(dim_t shape, dim_t index) {
size_t size = tensor_size(shape); // check tensor shape is valid
size_t offset = 0;
@@ -73,7 +73,7 @@ size_t tensor_index_to_offset(dim_t shape, dim_t index) {
return offset;
}
-// Convert an element offset to tensor index coordinates
+// Convert an element offset to tensor index co-ordinates
dim_t tensor_offset_to_index(dim_t shape, size_t offset) {
size_t size = tensor_size(shape); // check tensor shape is valid
REQUIRE(offset < size);
@@ -125,25 +125,7 @@ void tensor_write<type>(<type> *address, dim_t shape, dim_t index, <type> value)
}
----
-==== Broadcast Helpers
-
-The following function derives the broadcast output shape from the input shapes.
-
-[source,c++]
-----
-dim_t broadcast_shape(dim_t shape1, dim_t shape2) {
- ERROR_IF(rank(shape1) != rank(shape2));
- dim_t shape = shape1;
- for (int32_t i = 0; i < rank(shape); i++) {
- if (shape[i] == 1) {
- shape[i] = shape2[i];
- } else {
- ERROR_IF(shape2[i] != 1 && shape2[i] != shape[i]);
- }
- }
- return shape;
-}
-----
+==== Broadcast Helper
The following function maps an index in the output tensor to an index in the input tensor.
diff --git a/chapters/scatter_gather.adoc b/chapters/scatter_gather.adoc
index 1dbda4f..89942f2 100644
--- a/chapters/scatter_gather.adoc
+++ b/chapters/scatter_gather.adoc
@@ -21,8 +21,8 @@ include::{generated}/operators/GATHER.adoc[]
for_each(0 <= n < N, 0 <= w < W, 0 <= c < C) {
index_t k = tensor_read<index_t>(indices, [N,W], [n,w]);
REQUIRE(0 <= k && k < K);
- in_out_t value = tensor_read<in_out_t>(values, [N,K,C], [n,k,c]);
- tensor_write<in_out_t>(output, [N,W,C], [n,w,c], value);
+ value_t value = tensor_read<value_t>(values, [N,K,C], [n,k,c]);
+ tensor_write<value_t>(output, [N,W,C], [n,w,c], value);
}
----
@@ -45,8 +45,8 @@ bool_t output_modified[N,K,C];
// Copy the values_in tensor to the values_out tensor.
// Values not written by the scatter operation are unchanged in the output.
for_each(0 <= n < N, 0 <= k < K, 0 <= c < C) {
- in_out_t value = tensor_read<in_out_t>(values_in, [N,K,C], [n,k,c]);
- tensor_write<in_out_t>(values_out, [N,K,C], [n, k, c], value);
+ value_t value = tensor_read<value_t>(values_in, [N,K,C], [n,k,c]);
+ tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value);
output_modified[n,k,c]=false;
}
@@ -55,8 +55,8 @@ for_each(0 <= n < N, 0 <= w < W, 0 <= c < C) {
index_t k = tensor_read<index_t>(indices, [N,W], [n,w]);
REQUIRE(0 <= k && k < K);
REQUIRE(output_modified[n,k,c] == false);
- in_out_t value = tensor_read<in_out_t>(input, [N,W,C], [n,w,c]);
- tensor_write<in_out_t>(values_out, [N,K,C], [n, k, c], value);
+ value_t value = tensor_read<value_t>(input, [N,W,C], [n,w,c]);
+ tensor_write<value_t>(values_out, [N,K,C], [n, k, c], value);
output_modified[n,k,c] = true;
}
----
diff --git a/chapters/tensor_ops.adoc b/chapters/tensor_ops.adoc
index 656af85..cb268fa 100644
--- a/chapters/tensor_ops.adoc
+++ b/chapters/tensor_ops.adoc
@@ -17,7 +17,7 @@ include::{generated}/operators/ARGMAX.adoc[]
[source,c++]
----
-ERROR_IF(axis < 0 || axis >= rank(shape1));
+ERROR_IF(axis < 0 || axis >= rank(shape1) || rank(shape1) > 4);
if (axis == 0) {
left_shape = [];
} else {
@@ -111,6 +111,7 @@ ERROR_IF(dilation_y < 1 || dilation_x < 1);
ERROR_IF(OH != idiv_check(IH - 1 + pad_top + pad_bottom - (KH - 1) * dilation_y, stride_y) + 1);
ERROR_IF(OW != idiv_check(IW - 1 + pad_left + pad_right - (KW - 1) * dilation_x, stride_x) + 1);
+pad = flatten([0,0], pad, [0,0]);
for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
out_t acc = 0;
index_t iy = oy * stride_y - pad_top;
@@ -148,6 +149,7 @@ ERROR_IF(OD != idiv_check(ID - 1 + pad_d0 + pad_d1 - (KD - 1) * dilation_d,
ERROR_IF(OH != idiv_check(IH - 1 + pad_top + pad_bottom - (KH - 1) * dilation_y, stride_y) + 1);
ERROR_IF(OW != idiv_check(IW - 1 + pad_left + pad_right - (KW - 1) * dilation_x, stride_x) + 1);
+pad = flatten([0,0], pad, [0,0]);
for_each(0 <= n < N, 0 <= od < OD, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
out_t acc = 0;
index_t id = od * stride_d - pad_d0;
@@ -186,6 +188,7 @@ ERROR_IF(dilation_y < 1 || dilation_x < 1);
ERROR_IF(OH != idiv_check(IH - 1 + pad_top + pad_bottom - (KH - 1) * dilation_y, stride_y) + 1);
ERROR_IF(OW != idiv_check(IW - 1 + pad_left + pad_right - (KW - 1) * dilation_x, stride_x) + 1);
+pad = flatten([0,0], pad, [0,0]);
for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C, 0 <= m < M) {
out_t acc = 0;
index_t iy = oy * stride_y - pad_top;
diff --git a/chapters/type_conversion.adoc b/chapters/type_conversion.adoc
index 415c5d9..d6cd1b2 100644
--- a/chapters/type_conversion.adoc
+++ b/chapters/type_conversion.adoc
@@ -55,8 +55,8 @@ for_each(index in shape) {
ERROR_IF(out_t != int8_t &&
out_t != uint8_t &&
out_t != uint16_t && output_zp != 0);
- ERROR_IF(in_t == uint16_t && input_zp != 0 && input_zp != 32768);
- ERROR_IF(out_t == uint16_t && output_zp != 0 && output_zp != 32768);
+ ERROR_IF(in_t == uint16_t && (input_zp != 0 || input_zp != 32768));
+ ERROR_IF(out_t == uint16_t && (output_zp != 0 || output_zp != 32768));
ERROR_IF(scale32 && in_t == int48_t);
ERROR_IF(!scale32 && double_round);
int48_t value = tensor_read<in_t>(input, shape, index);
diff --git a/figures/sigmoid.svg b/figures/sigmoid.svg
deleted file mode 100644
index fdd53ba..0000000
--- a/figures/sigmoid.svg
+++ /dev/null
@@ -1,120 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="124.770913pt" height="27.392703pt" viewBox="0 0 124.770913 27.392703" version="1.1">
-<defs>
-<g>
-<symbol overflow="visible" id="glyph0-0">
-<path style="stroke:none;" d="M 0.59375 2.125 L 0.59375 -8.46875 L 6.59375 -8.46875 L 6.59375 2.125 Z M 1.265625 1.453125 L 5.9375 1.453125 L 5.9375 -7.78125 L 1.265625 -7.78125 Z M 1.265625 1.453125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-1">
-<path style="stroke:none;" d="M 0.421875 -1.796875 L 1.03125 -1.796875 C 1.019531 -1.679688 1.015625 -1.578125 1.015625 -1.484375 C 1.015625 -0.765625 1.5 -0.40625 2.46875 -0.40625 C 3.4375 -0.40625 3.988281 -0.765625 4.125 -1.484375 C 4.132812 -1.546875 4.140625 -1.640625 4.140625 -1.765625 C 4.140625 -1.890625 4.070312 -2.023438 3.9375 -2.171875 C 3.8125 -2.316406 3.46875 -2.484375 2.90625 -2.671875 L 2.171875 -2.9375 C 1.671875 -3.113281 1.335938 -3.3125 1.171875 -3.53125 C 1.015625 -3.75 0.9375 -3.988281 0.9375 -4.25 C 0.9375 -4.34375 0.945312 -4.453125 0.96875 -4.578125 C 1.082031 -5.140625 1.378906 -5.582031 1.859375 -5.90625 C 2.335938 -6.238281 2.925781 -6.40625 3.625 -6.40625 C 4.3125 -6.40625 5.019531 -6.234375 5.75 -5.890625 L 5.484375 -4.53125 L 4.859375 -4.53125 C 4.878906 -4.625 4.890625 -4.707031 4.890625 -4.78125 C 4.890625 -5.070312 4.789062 -5.316406 4.59375 -5.515625 C 4.394531 -5.710938 4.066406 -5.8125 3.609375 -5.8125 C 2.691406 -5.8125 2.171875 -5.492188 2.046875 -4.859375 C 2.023438 -4.796875 2.015625 -4.703125 2.015625 -4.578125 C 2.015625 -4.460938 2.078125 -4.332031 2.203125 -4.1875 C 2.335938 -4.050781 2.648438 -3.90625 3.140625 -3.75 L 3.953125 -3.484375 C 4.503906 -3.296875 4.882812 -3.066406 5.09375 -2.796875 C 5.238281 -2.597656 5.3125 -2.398438 5.3125 -2.203125 C 5.3125 -1.390625 4.984375 -0.769531 4.328125 -0.34375 C 3.804688 0 3.148438 0.171875 2.359375 0.171875 C 1.578125 0.171875 0.835938 0 0.140625 -0.34375 Z M 0.421875 -1.796875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-2">
-<path style="stroke:none;" d="M 1.890625 -8.15625 C 1.929688 -8.34375 2.03125 -8.5 2.1875 -8.625 C 2.34375 -8.757812 2.507812 -8.828125 2.6875 -8.828125 C 2.863281 -8.828125 3.007812 -8.757812 3.125 -8.625 C 3.195312 -8.53125 3.234375 -8.421875 3.234375 -8.296875 C 3.234375 -8.253906 3.226562 -8.207031 3.21875 -8.15625 C 3.1875 -7.976562 3.09375 -7.820312 2.9375 -7.6875 C 2.78125 -7.5625 2.609375 -7.5 2.421875 -7.5 C 2.242188 -7.5 2.101562 -7.5625 2 -7.6875 C 1.914062 -7.789062 1.875 -7.90625 1.875 -8.03125 C 1.875 -8.070312 1.878906 -8.113281 1.890625 -8.15625 Z M 1.8125 -0.625 L 2.828125 -0.625 L 2.703125 0 L 0.609375 0 L 1.6875 -5.609375 L 0.65625 -5.609375 L 0.78125 -6.234375 L 2.890625 -6.234375 Z M 1.8125 -0.625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-3">
-<path style="stroke:none;" d="M 7.171875 -6.234375 L 5.984375 -0.140625 C 5.796875 0.796875 5.414062 1.488281 4.84375 1.9375 C 4.207031 2.425781 3.457031 2.671875 2.59375 2.671875 C 2.175781 2.671875 1.785156 2.628906 1.421875 2.546875 C 1.066406 2.472656 0.734375 2.363281 0.421875 2.21875 L 0.6875 0.921875 L 1.25 0.921875 C 1.226562 1.328125 1.332031 1.625 1.5625 1.8125 C 1.789062 2 2.148438 2.09375 2.640625 2.09375 C 3.273438 2.09375 3.769531 1.910156 4.125 1.546875 C 4.488281 1.191406 4.75 0.628906 4.90625 -0.140625 L 5.0625 -0.96875 C 4.78125 -0.582031 4.457031 -0.296875 4.09375 -0.109375 C 3.726562 0.078125 3.316406 0.171875 2.859375 0.171875 C 2.171875 0.171875 1.65625 -0.0625 1.3125 -0.53125 C 1.09375 -0.820312 0.96875 -1.171875 0.9375 -1.578125 C 0.925781 -1.816406 0.945312 -2.078125 1 -2.359375 C 1.269531 -3.734375 1.882812 -4.773438 2.84375 -5.484375 C 3.65625 -6.085938 4.539062 -6.394531 5.5 -6.40625 C 6.375 -6.40625 6.929688 -6.347656 7.171875 -6.234375 Z M 5.96875 -5.609375 C 5.96875 -5.734375 5.753906 -5.796875 5.328125 -5.796875 C 4.566406 -5.796875 3.898438 -5.503906 3.328125 -4.921875 C 2.753906 -4.328125 2.363281 -3.5 2.15625 -2.4375 C 2.09375 -2.113281 2.070312 -1.832031 2.09375 -1.59375 C 2.101562 -1.351562 2.15625 -1.148438 2.25 -0.984375 C 2.445312 -0.660156 2.796875 -0.5 3.296875 -0.5 C 3.835938 -0.5 4.289062 -0.695312 4.65625 -1.09375 C 5.019531 -1.488281 5.273438 -2.0625 5.421875 -2.8125 L 5.53125 -3.421875 Z M 5.96875 -5.609375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-4">
-<path style="stroke:none;" d="M 6.5625 -5.015625 C 6.863281 -5.472656 7.195312 -5.816406 7.5625 -6.046875 C 7.925781 -6.285156 8.328125 -6.40625 8.765625 -6.40625 C 9.410156 -6.40625 9.859375 -6.203125 10.109375 -5.796875 C 10.242188 -5.546875 10.3125 -5.222656 10.3125 -4.828125 C 10.3125 -4.578125 10.28125 -4.289062 10.21875 -3.96875 L 9.578125 -0.625 L 10.546875 -0.625 L 10.4375 0 L 8.375 0 L 9.125 -3.84375 C 9.1875 -4.144531 9.21875 -4.40625 9.21875 -4.625 C 9.21875 -4.863281 9.179688 -5.054688 9.109375 -5.203125 C 8.972656 -5.472656 8.6875 -5.609375 8.25 -5.609375 C 7.769531 -5.609375 7.367188 -5.425781 7.046875 -5.0625 C 6.722656 -4.695312 6.492188 -4.164062 6.359375 -3.46875 L 5.6875 0 L 4.609375 0 L 5.375 -3.875 C 5.425781 -4.164062 5.453125 -4.421875 5.453125 -4.640625 C 5.453125 -4.878906 5.414062 -5.066406 5.34375 -5.203125 C 5.207031 -5.472656 4.921875 -5.609375 4.484375 -5.609375 C 4.003906 -5.609375 3.601562 -5.425781 3.28125 -5.0625 C 2.957031 -4.695312 2.726562 -4.164062 2.59375 -3.46875 L 1.921875 0 L 0.84375 0 L 1.9375 -5.609375 L 0.90625 -5.609375 L 1.015625 -6.234375 L 3.125 -6.234375 L 2.921875 -5.125 C 3.191406 -5.539062 3.503906 -5.859375 3.859375 -6.078125 C 4.210938 -6.296875 4.582031 -6.40625 4.96875 -6.40625 C 5.457031 -6.40625 5.835938 -6.28125 6.109375 -6.03125 C 6.390625 -5.789062 6.539062 -5.453125 6.5625 -5.015625 Z M 6.5625 -5.015625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-5">
-<path style="stroke:none;" d="M 3.078125 -0.40625 C 3.660156 -0.40625 4.144531 -0.632812 4.53125 -1.09375 C 4.914062 -1.550781 5.191406 -2.226562 5.359375 -3.125 C 5.441406 -3.53125 5.484375 -3.890625 5.484375 -4.203125 C 5.484375 -4.578125 5.425781 -4.890625 5.3125 -5.140625 C 5.101562 -5.585938 4.707031 -5.8125 4.125 -5.8125 C 3.550781 -5.8125 3.070312 -5.582031 2.6875 -5.125 C 2.300781 -4.675781 2.023438 -4.007812 1.859375 -3.125 C 1.773438 -2.71875 1.734375 -2.359375 1.734375 -2.046875 C 1.734375 -1.660156 1.789062 -1.34375 1.90625 -1.09375 C 2.113281 -0.632812 2.503906 -0.40625 3.078125 -0.40625 Z M 2.96875 0.171875 C 2.0625 0.171875 1.394531 -0.128906 0.96875 -0.734375 C 0.664062 -1.148438 0.515625 -1.65625 0.515625 -2.25 C 0.515625 -2.519531 0.539062 -2.8125 0.59375 -3.125 C 0.789062 -4.113281 1.222656 -4.90625 1.890625 -5.5 C 2.554688 -6.101562 3.34375 -6.40625 4.25 -6.40625 C 5.15625 -6.40625 5.828125 -6.101562 6.265625 -5.5 C 6.554688 -5.082031 6.703125 -4.578125 6.703125 -3.984375 C 6.703125 -3.710938 6.675781 -3.425781 6.625 -3.125 C 6.425781 -2.125 5.992188 -1.320312 5.328125 -0.71875 C 4.671875 -0.125 3.882812 0.171875 2.96875 0.171875 Z M 2.96875 0.171875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-6">
-<path style="stroke:none;" d="M 7.203125 -9.125 L 5.4375 0 L 4.359375 0 L 4.546875 -0.96875 C 4.253906 -0.582031 3.925781 -0.296875 3.5625 -0.109375 C 3.207031 0.078125 2.785156 0.171875 2.296875 0.171875 C 1.535156 0.171875 0.972656 -0.128906 0.609375 -0.734375 C 0.359375 -1.140625 0.234375 -1.625 0.234375 -2.1875 C 0.234375 -2.476562 0.265625 -2.789062 0.328125 -3.125 C 0.523438 -4.09375 0.921875 -4.878906 1.515625 -5.484375 C 2.117188 -6.097656 2.804688 -6.40625 3.578125 -6.40625 C 4.054688 -6.40625 4.441406 -6.3125 4.734375 -6.125 C 5.023438 -5.9375 5.238281 -5.644531 5.375 -5.25 L 6 -8.5 L 4.984375 -8.5 L 5.109375 -9.125 Z M 4.90625 -2.8125 L 5.015625 -3.421875 C 5.078125 -3.722656 5.109375 -4 5.109375 -4.25 C 5.109375 -4.601562 5.046875 -4.898438 4.921875 -5.140625 C 4.710938 -5.523438 4.332031 -5.71875 3.78125 -5.71875 C 3.226562 -5.71875 2.765625 -5.5 2.390625 -5.0625 C 2.023438 -4.625 1.757812 -3.976562 1.59375 -3.125 C 1.519531 -2.726562 1.484375 -2.375 1.484375 -2.0625 C 1.484375 -1.707031 1.535156 -1.410156 1.640625 -1.171875 C 1.835938 -0.722656 2.210938 -0.5 2.765625 -0.5 C 3.316406 -0.5 3.769531 -0.695312 4.125 -1.09375 C 4.488281 -1.488281 4.75 -2.0625 4.90625 -2.8125 Z M 4.90625 -2.8125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-7">
-<path style="stroke:none;" d="M 0.765625 0 L 0.03125 0 L 2.78125 -2.984375 L 1.40625 -5.609375 L 0.640625 -5.609375 L 0.75 -6.234375 L 2.328125 -6.234375 L 3.625 -3.796875 L 5.859375 -6.234375 L 6.59375 -6.234375 L 3.890625 -3.296875 L 5.328125 -0.625 L 6.140625 -0.625 L 6.015625 0 L 4.390625 0 L 3.0625 -2.484375 Z M 0.765625 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-8">
-<path style="stroke:none;" d="M 1.765625 -2.390625 C 1.742188 -2.242188 1.734375 -2.101562 1.734375 -1.96875 C 1.734375 -1.601562 1.800781 -1.300781 1.9375 -1.0625 C 2.164062 -0.625 2.585938 -0.40625 3.203125 -0.40625 C 3.660156 -0.40625 4 -0.472656 4.21875 -0.609375 C 4.613281 -0.859375 4.859375 -1.140625 4.953125 -1.453125 L 5.75 -1.453125 C 5.59375 -0.960938 5.222656 -0.539062 4.640625 -0.1875 C 4.234375 0.0507812 3.628906 0.171875 2.828125 0.171875 C 2.023438 0.171875 1.40625 -0.128906 0.96875 -0.734375 C 0.664062 -1.148438 0.515625 -1.660156 0.515625 -2.265625 C 0.515625 -2.523438 0.539062 -2.804688 0.59375 -3.109375 C 0.789062 -4.097656 1.21875 -4.894531 1.875 -5.5 C 2.53125 -6.101562 3.328125 -6.40625 4.265625 -6.40625 C 5.796875 -6.40625 6.5625 -5.863281 6.5625 -4.78125 C 6.5625 -3.988281 6.160156 -3.394531 5.359375 -3 C 4.546875 -2.613281 3.347656 -2.410156 1.765625 -2.390625 Z M 4.765625 -3.703125 C 5.203125 -3.960938 5.421875 -4.332031 5.421875 -4.8125 C 5.421875 -5.476562 4.976562 -5.8125 4.09375 -5.8125 C 3.570312 -5.8125 3.128906 -5.613281 2.765625 -5.21875 C 2.398438 -4.820312 2.101562 -4.085938 1.875 -3.015625 C 3.132812 -3.066406 4.097656 -3.296875 4.765625 -3.703125 Z M 4.765625 -3.703125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-0">
-<path style="stroke:none;" d="M 1.328125 0 L 1.328125 -6.25 L 6.671875 -6.25 L 6.671875 0 Z M 6.5 -0.15625 L 6.5 -6.09375 L 1.5 -6.09375 L 1.5 -0.15625 Z M 6.5 -0.15625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-1">
-<path style="stroke:none;" d="M 4.171875 11.578125 C 3.296875 10.878906 2.648438 10.003906 2.234375 8.953125 C 1.828125 7.910156 1.625 6.789062 1.625 5.59375 C 1.625 4.394531 1.828125 3.269531 2.234375 2.21875 C 2.648438 1.164062 3.296875 0.300781 4.171875 -0.375 C 4.171875 -0.394531 4.1875 -0.40625 4.21875 -0.40625 L 4.359375 -0.40625 C 4.378906 -0.40625 4.394531 -0.394531 4.40625 -0.375 C 4.425781 -0.351562 4.4375 -0.332031 4.4375 -0.3125 C 4.4375 -0.28125 4.429688 -0.257812 4.421875 -0.25 C 4.035156 0.125 3.707031 0.539062 3.4375 1 C 3.175781 1.457031 2.96875 1.929688 2.8125 2.421875 C 2.664062 2.921875 2.5625 3.4375 2.5 3.96875 C 2.4375 4.507812 2.40625 5.054688 2.40625 5.609375 C 2.40625 8.191406 3.078125 10.132812 4.421875 11.4375 C 4.429688 11.445312 4.4375 11.46875 4.4375 11.5 C 4.4375 11.519531 4.425781 11.539062 4.40625 11.5625 C 4.382812 11.582031 4.367188 11.59375 4.359375 11.59375 L 4.21875 11.59375 C 4.1875 11.59375 4.171875 11.585938 4.171875 11.578125 Z M 4.171875 11.578125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-2">
-<path style="stroke:none;" d="M 0.53125 11.59375 C 0.46875 11.59375 0.4375 11.5625 0.4375 11.5 C 0.4375 11.46875 0.441406 11.445312 0.453125 11.4375 C 0.960938 10.9375 1.363281 10.367188 1.65625 9.734375 C 1.957031 9.109375 2.164062 8.445312 2.28125 7.75 C 2.40625 7.050781 2.46875 6.332031 2.46875 5.59375 C 2.46875 3 1.796875 1.050781 0.453125 -0.25 C 0.441406 -0.257812 0.4375 -0.28125 0.4375 -0.3125 C 0.4375 -0.375 0.46875 -0.40625 0.53125 -0.40625 L 0.65625 -0.40625 C 0.675781 -0.40625 0.695312 -0.394531 0.71875 -0.375 C 1.59375 0.300781 2.234375 1.164062 2.640625 2.21875 C 3.046875 3.269531 3.25 4.394531 3.25 5.59375 C 3.25 6.789062 3.046875 7.910156 2.640625 8.953125 C 2.234375 10.003906 1.59375 10.878906 0.71875 11.578125 C 0.695312 11.585938 0.675781 11.59375 0.65625 11.59375 Z M 0.53125 11.59375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-0">
-<path style="stroke:none;" d="M 0.59375 2.125 L 0.59375 -8.46875 L 6.59375 -8.46875 L 6.59375 2.125 Z M 1.265625 1.453125 L 5.9375 1.453125 L 5.9375 -7.78125 L 1.265625 -7.78125 Z M 1.265625 1.453125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-1">
-<path style="stroke:none;" d="M 1.265625 -5.421875 L 8.78125 -5.421875 L 8.78125 -4.484375 L 1.265625 -4.484375 Z M 1.265625 -3.03125 L 8.78125 -3.03125 L 8.78125 -2.09375 L 1.265625 -2.09375 Z M 1.265625 -3.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-2">
-<path style="stroke:none;" d="M 1.703125 0 L 1.703125 -0.625 L 3.234375 -0.625 L 3.234375 -7.90625 L 1.46875 -6.75 L 1.46875 -7.53125 L 3.59375 -8.90625 L 4.40625 -8.90625 L 4.40625 -0.625 L 5.9375 -0.625 L 5.9375 0 Z M 1.703125 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-3">
-<path style="stroke:none;" d="M 5.5 -7.53125 L 5.5 -4.234375 L 8.78125 -4.234375 L 8.78125 -3.28125 L 5.5 -3.28125 L 5.5 0 L 4.5625 0 L 4.5625 -3.28125 L 1.265625 -3.28125 L 1.265625 -4.234375 L 4.5625 -4.234375 L 4.5625 -7.53125 Z M 5.5 -7.53125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-0">
-<path style="stroke:none;" d="M 0.421875 1.5 L 0.421875 -6 L 4.6875 -6 L 4.6875 1.5 Z M 0.90625 1.03125 L 4.203125 1.03125 L 4.203125 -5.53125 L 0.90625 -5.53125 Z M 0.90625 1.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-1">
-<path style="stroke:none;" d="M 0.90625 -3 L 6.234375 -3 L 6.234375 -2.328125 L 0.90625 -2.328125 Z M 0.90625 -3 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-0">
-<path style="stroke:none;" d="M 0.421875 1.5 L 0.421875 -6 L 4.6875 -6 L 4.6875 1.5 Z M 0.90625 1.03125 L 4.203125 1.03125 L 4.203125 -5.53125 L 0.90625 -5.53125 Z M 0.90625 1.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-1">
-<path style="stroke:none;" d="M 0.546875 0 L 0.03125 0 L 1.96875 -2.125 L 1 -3.96875 L 0.453125 -3.96875 L 0.53125 -4.421875 L 1.65625 -4.421875 L 2.578125 -2.703125 L 4.15625 -4.421875 L 4.671875 -4.421875 L 2.765625 -2.34375 L 3.78125 -0.4375 L 4.359375 -0.4375 L 4.265625 0 L 3.109375 0 L 2.171875 -1.765625 Z M 0.546875 0 "/>
-</symbol>
-</g>
-</defs>
-<g id="surface1">
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-1" x="0.53125" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-2" x="7.003906" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-3" x="11.15625" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-4" x="18.8125" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-5" x="30.179688" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-2" x="37.613281" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-6" x="41.953125" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-1" x="48.867188" y="9.240381"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-7" x="54.605469" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-2" x="62.09375" y="9.240381"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-1" x="68.742188" y="18.603516"/>
-</g>
-<path style="fill:none;stroke-width:1.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 82.859375 -3.760805 L 123.4375 -3.760805 " transform="matrix(1,0,0,1,0,18.600648)"/>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-2" x="99.453125" y="8.904297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-2" x="82.0625" y="27.224609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-3" x="90.71875" y="27.220703"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-8" x="102.992188" y="27.224609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-1" x="111.128906" y="23.462891"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph4-1" x="118.285156" y="23.462891"/>
-</g>
-</g>
-</svg>
diff --git a/figures/tanh.svg b/figures/tanh.svg
deleted file mode 100644
index 0220450..0000000
--- a/figures/tanh.svg
+++ /dev/null
@@ -1,129 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="107.45977pt" height="29.539187pt" viewBox="0 0 107.45977 29.539187" version="1.1">
-<defs>
-<g>
-<symbol overflow="visible" id="glyph0-0">
-<path style="stroke:none;" d="M 0.59375 2.125 L 0.59375 -8.46875 L 6.59375 -8.46875 L 6.59375 2.125 Z M 1.265625 1.453125 L 5.9375 1.453125 L 5.9375 -7.78125 L 1.265625 -7.78125 Z M 1.265625 1.453125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-1">
-<path style="stroke:none;" d="M 1.609375 -5.609375 L 0.65625 -5.609375 L 0.78125 -6.234375 L 1.734375 -6.234375 L 2.109375 -8.15625 L 3.1875 -8.15625 L 2.8125 -6.234375 L 4.84375 -6.234375 L 4.71875 -5.609375 L 2.6875 -5.609375 L 1.921875 -1.640625 C 1.859375 -1.335938 1.828125 -1.097656 1.828125 -0.921875 C 1.828125 -0.796875 1.84375 -0.703125 1.875 -0.640625 C 1.945312 -0.484375 2.117188 -0.40625 2.390625 -0.40625 C 2.671875 -0.40625 2.894531 -0.488281 3.0625 -0.65625 C 3.226562 -0.820312 3.347656 -1.09375 3.421875 -1.46875 L 4.234375 -1.46875 C 4.097656 -0.894531 3.863281 -0.476562 3.53125 -0.21875 C 3.207031 0.0390625 2.757812 0.171875 2.1875 0.171875 C 1.570312 0.171875 1.160156 0.03125 0.953125 -0.25 C 0.828125 -0.414062 0.765625 -0.65625 0.765625 -0.96875 C 0.765625 -1.164062 0.789062 -1.390625 0.84375 -1.640625 Z M 1.609375 -5.609375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-2">
-<path style="stroke:none;" d="M 4.359375 -0.96875 C 3.835938 -0.207031 3.160156 0.171875 2.328125 0.171875 C 1.640625 0.171875 1.117188 -0.0625 0.765625 -0.53125 C 0.523438 -0.851562 0.40625 -1.25 0.40625 -1.71875 C 0.40625 -1.914062 0.425781 -2.128906 0.46875 -2.359375 C 0.738281 -3.734375 1.351562 -4.773438 2.3125 -5.484375 C 3.125 -6.097656 4.023438 -6.40625 5.015625 -6.40625 C 5.679688 -6.40625 6.128906 -6.347656 6.359375 -6.234375 L 5.265625 -0.625 L 6.1875 -0.625 L 6.078125 0 L 4.171875 0 Z M 1.546875 -1.765625 C 1.546875 -0.921875 1.945312 -0.5 2.75 -0.5 C 3.25 -0.5 3.664062 -0.695312 4 -1.09375 C 4.332031 -1.488281 4.570312 -2.0625 4.71875 -2.8125 L 5.265625 -5.625 C 5.265625 -5.738281 5.109375 -5.796875 4.796875 -5.796875 C 4.046875 -5.796875 3.378906 -5.503906 2.796875 -4.921875 C 2.210938 -4.328125 1.820312 -3.5 1.625 -2.4375 C 1.570312 -2.1875 1.546875 -1.960938 1.546875 -1.765625 Z M 1.546875 -1.765625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-3">
-<path style="stroke:none;" d="M 0.84375 0 L 1.9375 -5.609375 L 0.90625 -5.609375 L 1.015625 -6.234375 L 3.125 -6.234375 L 2.921875 -5.125 C 3.203125 -5.539062 3.519531 -5.859375 3.875 -6.078125 C 4.238281 -6.296875 4.628906 -6.40625 5.046875 -6.40625 C 5.734375 -6.40625 6.203125 -6.207031 6.453125 -5.8125 C 6.609375 -5.570312 6.6875 -5.253906 6.6875 -4.859375 C 6.6875 -4.585938 6.648438 -4.289062 6.578125 -3.96875 L 5.9375 -0.625 L 6.890625 -0.625 L 6.78125 0 L 4.734375 0 L 5.4375 -3.625 C 5.507812 -4.019531 5.546875 -4.351562 5.546875 -4.625 C 5.546875 -4.863281 5.515625 -5.050781 5.453125 -5.1875 C 5.316406 -5.46875 5.015625 -5.609375 4.546875 -5.609375 C 4.046875 -5.609375 3.628906 -5.425781 3.296875 -5.0625 C 2.960938 -4.695312 2.726562 -4.164062 2.59375 -3.46875 L 1.921875 0 Z M 0.84375 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-4">
-<path style="stroke:none;" d="M 0.578125 0 L 2.234375 -8.5 L 1.203125 -8.5 L 1.3125 -9.125 L 3.421875 -9.125 L 2.65625 -5.125 C 2.9375 -5.539062 3.253906 -5.859375 3.609375 -6.078125 C 3.972656 -6.296875 4.363281 -6.40625 4.78125 -6.40625 C 5.46875 -6.40625 5.9375 -6.207031 6.1875 -5.8125 C 6.34375 -5.570312 6.421875 -5.253906 6.421875 -4.859375 C 6.421875 -4.585938 6.382812 -4.289062 6.3125 -3.96875 L 5.671875 -0.625 L 6.625 -0.625 L 6.515625 0 L 4.46875 0 L 5.171875 -3.625 C 5.242188 -4.019531 5.28125 -4.351562 5.28125 -4.625 C 5.28125 -4.863281 5.25 -5.050781 5.1875 -5.1875 C 5.0625 -5.46875 4.757812 -5.609375 4.28125 -5.609375 C 3.78125 -5.609375 3.363281 -5.425781 3.03125 -5.0625 C 2.695312 -4.695312 2.460938 -4.164062 2.328125 -3.46875 L 1.65625 0 Z M 0.578125 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-5">
-<path style="stroke:none;" d="M 0.765625 0 L 0.03125 0 L 2.78125 -2.984375 L 1.40625 -5.609375 L 0.640625 -5.609375 L 0.75 -6.234375 L 2.328125 -6.234375 L 3.625 -3.796875 L 5.859375 -6.234375 L 6.59375 -6.234375 L 3.890625 -3.296875 L 5.328125 -0.625 L 6.140625 -0.625 L 6.015625 0 L 4.390625 0 L 3.0625 -2.484375 Z M 0.765625 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-6">
-<path style="stroke:none;" d="M 1.765625 -2.390625 C 1.742188 -2.242188 1.734375 -2.101562 1.734375 -1.96875 C 1.734375 -1.601562 1.800781 -1.300781 1.9375 -1.0625 C 2.164062 -0.625 2.585938 -0.40625 3.203125 -0.40625 C 3.660156 -0.40625 4 -0.472656 4.21875 -0.609375 C 4.613281 -0.859375 4.859375 -1.140625 4.953125 -1.453125 L 5.75 -1.453125 C 5.59375 -0.960938 5.222656 -0.539062 4.640625 -0.1875 C 4.234375 0.0507812 3.628906 0.171875 2.828125 0.171875 C 2.023438 0.171875 1.40625 -0.128906 0.96875 -0.734375 C 0.664062 -1.148438 0.515625 -1.660156 0.515625 -2.265625 C 0.515625 -2.523438 0.539062 -2.804688 0.59375 -3.109375 C 0.789062 -4.097656 1.21875 -4.894531 1.875 -5.5 C 2.53125 -6.101562 3.328125 -6.40625 4.265625 -6.40625 C 5.796875 -6.40625 6.5625 -5.863281 6.5625 -4.78125 C 6.5625 -3.988281 6.160156 -3.394531 5.359375 -3 C 4.546875 -2.613281 3.347656 -2.410156 1.765625 -2.390625 Z M 4.765625 -3.703125 C 5.203125 -3.960938 5.421875 -4.332031 5.421875 -4.8125 C 5.421875 -5.476562 4.976562 -5.8125 4.09375 -5.8125 C 3.570312 -5.8125 3.128906 -5.613281 2.765625 -5.21875 C 2.398438 -4.820312 2.101562 -4.085938 1.875 -3.015625 C 3.132812 -3.066406 4.097656 -3.296875 4.765625 -3.703125 Z M 4.765625 -3.703125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-0">
-<path style="stroke:none;" d="M 1.328125 0 L 1.328125 -6.25 L 6.671875 -6.25 L 6.671875 0 Z M 6.5 -0.15625 L 6.5 -6.09375 L 1.5 -6.09375 L 1.5 -0.15625 Z M 6.5 -0.15625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-1">
-<path style="stroke:none;" d="M 4.171875 11.578125 C 3.296875 10.878906 2.648438 10.003906 2.234375 8.953125 C 1.828125 7.910156 1.625 6.789062 1.625 5.59375 C 1.625 4.394531 1.828125 3.269531 2.234375 2.21875 C 2.648438 1.164062 3.296875 0.300781 4.171875 -0.375 C 4.171875 -0.394531 4.1875 -0.40625 4.21875 -0.40625 L 4.359375 -0.40625 C 4.378906 -0.40625 4.394531 -0.394531 4.40625 -0.375 C 4.425781 -0.351562 4.4375 -0.332031 4.4375 -0.3125 C 4.4375 -0.28125 4.429688 -0.257812 4.421875 -0.25 C 4.035156 0.125 3.707031 0.539062 3.4375 1 C 3.175781 1.457031 2.96875 1.929688 2.8125 2.421875 C 2.664062 2.921875 2.5625 3.4375 2.5 3.96875 C 2.4375 4.507812 2.40625 5.054688 2.40625 5.609375 C 2.40625 8.191406 3.078125 10.132812 4.421875 11.4375 C 4.429688 11.445312 4.4375 11.46875 4.4375 11.5 C 4.4375 11.519531 4.425781 11.539062 4.40625 11.5625 C 4.382812 11.582031 4.367188 11.59375 4.359375 11.59375 L 4.21875 11.59375 C 4.1875 11.59375 4.171875 11.585938 4.171875 11.578125 Z M 4.171875 11.578125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph1-2">
-<path style="stroke:none;" d="M 0.53125 11.59375 C 0.46875 11.59375 0.4375 11.5625 0.4375 11.5 C 0.4375 11.46875 0.441406 11.445312 0.453125 11.4375 C 0.960938 10.9375 1.363281 10.367188 1.65625 9.734375 C 1.957031 9.109375 2.164062 8.445312 2.28125 7.75 C 2.40625 7.050781 2.46875 6.332031 2.46875 5.59375 C 2.46875 3 1.796875 1.050781 0.453125 -0.25 C 0.441406 -0.257812 0.4375 -0.28125 0.4375 -0.3125 C 0.4375 -0.375 0.46875 -0.40625 0.53125 -0.40625 L 0.65625 -0.40625 C 0.675781 -0.40625 0.695312 -0.394531 0.71875 -0.375 C 1.59375 0.300781 2.234375 1.164062 2.640625 2.21875 C 3.046875 3.269531 3.25 4.394531 3.25 5.59375 C 3.25 6.789062 3.046875 7.910156 2.640625 8.953125 C 2.234375 10.003906 1.59375 10.878906 0.71875 11.578125 C 0.695312 11.585938 0.675781 11.59375 0.65625 11.59375 Z M 0.53125 11.59375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-0">
-<path style="stroke:none;" d="M 0.59375 2.125 L 0.59375 -8.46875 L 6.59375 -8.46875 L 6.59375 2.125 Z M 1.265625 1.453125 L 5.9375 1.453125 L 5.9375 -7.78125 L 1.265625 -7.78125 Z M 1.265625 1.453125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-1">
-<path style="stroke:none;" d="M 1.265625 -5.421875 L 8.78125 -5.421875 L 8.78125 -4.484375 L 1.265625 -4.484375 Z M 1.265625 -3.03125 L 8.78125 -3.03125 L 8.78125 -2.09375 L 1.265625 -2.09375 Z M 1.265625 -3.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-2">
-<path style="stroke:none;" d="M 1.703125 0 L 1.703125 -0.625 L 3.234375 -0.625 L 3.234375 -7.90625 L 1.46875 -6.75 L 1.46875 -7.53125 L 3.59375 -8.90625 L 4.40625 -8.90625 L 4.40625 -0.625 L 5.9375 -0.625 L 5.9375 0 Z M 1.703125 0 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-3">
-<path style="stroke:none;" d="M 1.265625 -4.234375 L 8.78125 -4.234375 L 8.78125 -3.28125 L 1.265625 -3.28125 Z M 1.265625 -4.234375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph2-4">
-<path style="stroke:none;" d="M 5.5 -7.53125 L 5.5 -4.234375 L 8.78125 -4.234375 L 8.78125 -3.28125 L 5.5 -3.28125 L 5.5 0 L 4.5625 0 L 4.5625 -3.28125 L 1.265625 -3.28125 L 1.265625 -4.234375 L 4.5625 -4.234375 L 4.5625 -7.53125 Z M 5.5 -7.53125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-0">
-<path style="stroke:none;" d="M 0.421875 1.5 L 0.421875 -6 L 4.6875 -6 L 4.6875 1.5 Z M 0.90625 1.03125 L 4.203125 1.03125 L 4.203125 -5.53125 L 0.90625 -5.53125 Z M 0.90625 1.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-1">
-<path style="stroke:none;" d="M 0.90625 -3 L 6.234375 -3 L 6.234375 -2.328125 L 0.90625 -2.328125 Z M 0.90625 -3 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-2">
-<path style="stroke:none;" d="M 1.09375 -4.734375 L 0.625 -4.734375 L 0.625 -5.828125 C 0.914062 -5.992188 1.210938 -6.113281 1.515625 -6.1875 C 1.816406 -6.269531 2.113281 -6.3125 2.40625 -6.3125 C 3.050781 -6.3125 3.5625 -6.15625 3.9375 -5.84375 C 4.3125 -5.53125 4.5 -5.109375 4.5 -4.578125 C 4.5 -3.960938 4.070312 -3.234375 3.21875 -2.390625 C 3.15625 -2.328125 3.109375 -2.28125 3.078125 -2.25 L 1.5 -0.6875 L 4.09375 -0.6875 L 4.09375 -1.453125 L 4.578125 -1.453125 L 4.578125 0 L 0.578125 0 L 0.578125 -0.453125 L 2.46875 -2.328125 C 2.875 -2.742188 3.164062 -3.125 3.34375 -3.46875 C 3.53125 -3.820312 3.625 -4.191406 3.625 -4.578125 C 3.625 -4.992188 3.515625 -5.316406 3.296875 -5.546875 C 3.078125 -5.785156 2.773438 -5.90625 2.390625 -5.90625 C 1.992188 -5.90625 1.6875 -5.804688 1.46875 -5.609375 C 1.25 -5.410156 1.125 -5.117188 1.09375 -4.734375 Z M 1.09375 -4.734375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-0">
-<path style="stroke:none;" d="M 0.421875 1.5 L 0.421875 -6 L 4.6875 -6 L 4.6875 1.5 Z M 0.90625 1.03125 L 4.203125 1.03125 L 4.203125 -5.53125 L 0.90625 -5.53125 Z M 0.90625 1.03125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-1">
-<path style="stroke:none;" d="M 0.546875 0 L 0.03125 0 L 1.96875 -2.125 L 1 -3.96875 L 0.453125 -3.96875 L 0.53125 -4.421875 L 1.65625 -4.421875 L 2.578125 -2.703125 L 4.15625 -4.421875 L 4.671875 -4.421875 L 2.765625 -2.34375 L 3.78125 -0.4375 L 4.359375 -0.4375 L 4.265625 0 L 3.109375 0 L 2.171875 -1.765625 Z M 0.546875 0 "/>
-</symbol>
-</g>
-</defs>
-<g id="surface1">
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-1" x="0.0117188" y="19.779297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-2" x="5.777344" y="19.779297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-3" x="12.621094" y="19.779297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-4" x="20.265625" y="19.779297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-1" x="26.601562" y="10.420068"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-5" x="32.339844" y="19.779297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-2" x="39.828125" y="10.420068"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-1" x="46.476562" y="19.783203"/>
-</g>
-<path style="fill:none;stroke-width:1.2;stroke-linecap:butt;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 60.597656 -3.759828 L 106.125 -3.759828 " transform="matrix(1,0,0,1,0,19.779359)"/>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-2" x="59.796875" y="10.083984"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-3" x="68.453125" y="10.083984"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-6" x="80.730469" y="10.083984"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-1" x="88.863281" y="6.326172"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-2" x="95.46875" y="6.322266"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph4-1" x="100.972656" y="6.322266"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-2" x="59.796875" y="29.369141"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-4" x="68.453125" y="29.369141"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-6" x="80.730469" y="29.369141"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-1" x="88.863281" y="25.611328"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-2" x="95.46875" y="25.607422"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph4-1" x="100.972656" y="25.607422"/>
-</g>
-</g>
-</svg>
diff --git a/tools/dictionary.dic b/tools/dictionary.dic
index da2e28c..325db9b 100644
--- a/tools/dictionary.dic
+++ b/tools/dictionary.dic
@@ -1,7 +1,6 @@
personal_ws-1.1 en 500
activations
adoc
-acc
ARGMAX
AsciiDoc
BILINEAR
@@ -45,7 +44,6 @@ MUL
multipler
NaN
NPUs
-OC
pre
precisions
pseudocode
diff --git a/tools/genspec.py b/tools/genspec.py
index 11a3e72..38ae6e3 100755
--- a/tools/genspec.py
+++ b/tools/genspec.py
@@ -3,26 +3,16 @@ import os
import tosa
+
class TOSASpecAsciidocGenerator:
def __init__(self, spec):
self.spec = spec
- def generate_enum(self, enum, file):
- file.write(f"\n=== {enum.name}\n")
- file.write(f"{enum.description}\n")
- file.write("|===\n")
- file.write("|Name|Value|Description\n\n")
- for val in enum.values:
- file.write(f"|{val[0]}|{val[1]}|{val[2]}\n")
- file.write("|===\n")
-
def generate_operator(self, op, file):
file.write("\n*Arguments:*\n")
- file.write("[cols='3,3,2,2,4,8']")
file.write("\n|===\n")
- file.write("|Argument|Type|Name|Shape|Rank|Description\n\n")
+ file.write("|Argument|Type|Name|Shape|Description\n\n")
for arg in op.arguments:
- # Argument
cats = arg.categories
if len(cats) > 1:
cattext = ""
@@ -34,32 +24,9 @@ class TOSASpecAsciidocGenerator:
sep = " "
else:
cattext = cats[0].name.title()
-
- # Type
- if arg.type == 'tensor_t':
- argtype = 'T<{}>'.format(arg.tensor_element_type)
- elif arg.type == 'tensor_list_t':
- if arg.tensor_element_type == '-':
- argtype = 'tensor_list_t'
- else:
- argtype = 'tensor_list_t<T<{}>>'.format(arg.tensor_element_type)
- else:
- argtype = arg.type
-
- # Rank
- if len(arg.rank) > 0:
- if (arg.rank[0] == arg.rank[1]):
- rank = f'{arg.rank[0]}'
- else:
- rank = f'{arg.rank[0]} to {arg.rank[1]}'
- else:
- rank = ""
-
- # Format and write line
file.write(
- f"|{cattext}|{argtype}|{arg.name}|{arg.shape}|{rank}|{arg.description}\n"
+ f"|{cattext}|{arg.type}|{arg.name}|{arg.shape}|{arg.description}\n"
)
-
file.write("|===\n")
if op.typesupports:
file.write("\n*Supported Data Types:*\n\n")
@@ -82,9 +49,11 @@ class TOSASpecAsciidocGenerator:
for arg in op.arguments:
if (len(arg.levellimits) > 0):
for limit in arg.levellimits:
- leveltext += "LEVEL_CHECK(" + limit[0] + " <= " + limit[1] + ");\n"
+ leveltext += " LEVEL_CHECK(" + limit[0] + " <= " + limit[1] + ");\n"
if (len(leveltext) > 0):
- file.write(f"[source,c++]\n----\n{leveltext}\n----\n")
+ file.write(
+ f"[source,c++]\n----\nif (level != tosa_level_none) {{\n{leveltext}}}\n----\n"
+ )
def generate(self, outdir):
os.makedirs(outdir, exist_ok=True)
@@ -99,24 +68,6 @@ class TOSASpecAsciidocGenerator:
f.write(' draft')
f.write('\n')
- # Generate level maximums table
- with open(os.path.join(outdir, "levels.adoc"), 'w') as f:
- f.write('|===\n')
- f.write('|tosa_level_t')
- for level in self.spec.levels:
- f.write('|tosa_level_{}'.format(level.name))
- f.write('\n')
- f.write('|Description')
- for level in self.spec.levels:
- f.write('|{}'.format(level.desc))
- f.write('\n')
- for param in self.spec.levels[0].maximums:
- f.write('|{}'.format(param))
- for level in self.spec.levels:
- f.write('|{}'.format(level.maximums[param]))
- f.write('\n')
- f.write('|===\n')
-
# Generator operators
opdir = os.path.join(outdir, "operators")
os.makedirs(opdir, exist_ok=True)
@@ -124,9 +75,7 @@ class TOSASpecAsciidocGenerator:
for op in group.operators:
with open(os.path.join(opdir, op.name + ".adoc"), "w") as f:
self.generate_operator(op, f)
- with open(os.path.join(outdir, "enums.adoc"), 'w') as f:
- for enum in self.spec.enums:
- self.generate_enum(enum, f)
+
if __name__ == "__main__":
import argparse
@@ -136,11 +85,7 @@ if __name__ == "__main__":
parser.add_argument("--outdir", required=True, help="Output directory")
args = parser.parse_args()
- try:
- spec = tosa.TOSASpec(args.xml)
- except RuntimeError as e:
- print(f"Failure reading/validating XML spec: {str(e)}")
- exit(1)
+ spec = tosa.TOSASpec(args.xml)
generator = TOSASpecAsciidocGenerator(spec)
generator.generate(args.outdir)
diff --git a/tools/get_descriptions.py b/tools/get_descriptions.py
index 2f29879..0a39a19 100755
--- a/tools/get_descriptions.py
+++ b/tools/get_descriptions.py
@@ -49,7 +49,5 @@ for name in args.filenames:
# skip comments
elif re.match(r"\w*\/\/", text):
continue
- elif re.match(r"include::", text):
- continue
else:
print(text)
diff --git a/tools/tosa.py b/tools/tosa.py
index d01d9c2..74d43d6 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -1,50 +1,21 @@
import re
import xml.etree.ElementTree as ET
-# possible shapes: shape1, [2], [N,H,W,C]
-# returns (checkable, rank)
-# checkable is false if shape doesn't contain []
-def get_rank_from_shape(shape):
- if '[' not in shape or '[]' in shape:
- return (False, -1)
- # Check for fixed rank requirement [N]
- m = re.match(r'\[(\d+)\]', shape)
- if m:
- return (True, 1)
- # Check for comma separated rank descriptors, return count
- m = re.match(r'\[(.*)\]', shape)
- if m:
- return (True, len(m.group(1).split(',')))
- else:
- raise RuntimeError(f'Unable to parse shape {shape}')
class TOSAOperatorArgumentCategory:
def __init__(self, name, profiles=None):
self.name = name
self.profiles = profiles
-class TOSAEnum:
- def __init__(self, name, description, values):
- self.name = name
- self.description = description
- self.values = values
-
-class TOSALevel:
- def __init__(self, name, desc, maximums):
- self.name = name
- self.desc = desc
- self.maximums = maximums
class TOSAOperatorArgument:
- def __init__(self, name, description, categories, ty, elty, shape, levellimits, rank):
+ def __init__(self, name, description, categories, ty, shape, levellimits):
self.name = name
self.description = description
self.categories = categories
self.type = ty
- self.tensor_element_type = elty
self.shape = shape
self.levellimits = levellimits
- self.rank = rank
class TOSAOperatorDataTypeSupport:
@@ -72,19 +43,13 @@ class TOSASpec:
def __init__(self, xmlpath):
tree = ET.parse(xmlpath)
self.xmlroot = tree.getroot()
- self.levels = []
self.operatorgroups = []
- self.enums = []
self.__load_spec()
def __load_spec(self):
self.__load_version()
- for level in self.xmlroot.findall("./levels/level"):
- self.levels.append(self.__load_level(level))
for group in self.xmlroot.findall("./operators/operatorgroup"):
self.operatorgroups.append(self.__load_operator_group(group))
- for enum in self.xmlroot.findall("./enum"):
- self.enums.append(self.__load_enum(enum))
def __load_version(self):
version = self.xmlroot.find("./version")
@@ -96,18 +61,6 @@ class TOSASpec:
else:
self.version_is_draft = False
- def __load_level(self, level):
- name = level.get("name")
- desc = level.text.strip()
- maximums = {
- 'MAX_RANK': level.get("max_rank"),
- 'MAX_KERNEL': level.get("max_kernel"),
- 'MAX_STRIDE': level.get("max_stride"),
- 'MAX_SCALE': level.get("max_scale"),
- 'MAX_LOG2_SIZE' : level.get("max_log2_size"),
- }
- return TOSALevel(name, desc, maximums)
-
def __load_operator_group(self, group):
name = group.get("name")
operators = []
@@ -121,7 +74,7 @@ class TOSASpec:
types = []
typesupports = []
for arg in op.findall("arguments/argument"):
- args.append(self.__load_operator_argument(arg, name))
+ args.append(self.__load_operator_argument(arg))
# TODO add pseudo-code to operator object?
@@ -140,27 +93,13 @@ class TOSASpec:
typesupports.append(TOSAOperatorDataTypeSupport(tsmode, tsmap, tsprofiles))
return TOSAOperator(name, args, types, typesupports)
- def __load_operator_argument(self, arg, op_name):
+ def __load_operator_argument(self, arg):
name = arg.get("name")
desc = arg.find("description").text.strip()
argcats = []
argtype = arg.get("type")
- argtelty = arg.get("tensor-element-type")
shape = arg.get("shape")
levellimits = []
- rank = []
- r = arg.find("rank")
- if r != None:
- rank = [r.get('min'),r.get('max')]
- if shape == "-" and (rank[0] != '0' or rank[1] != '0'):
- raise RuntimeError(f"rank is not empty or non-zero, but shape is '-' for {op_name}: {name}")
- # validate rank against the shape argument
- (shape_check, shape_rank) = get_rank_from_shape(shape)
- if shape_check and (shape_rank < int(rank[0]) or shape_rank > int(rank[1])):
- raise RuntimeError(f"Description of shape rank doesn't match XML rank min/max: {op_name} {name} shape: {shape} shape_rank: {shape_rank} min/max: {rank[0]} {rank[1]}")
- else:
- if shape != "-":
- raise RuntimeError(f"Rank not present for {op_name}: {name} when shape is {shape}")
for levellimit in arg.findall("levellimit"):
value = levellimit.get("value")
limit = levellimit.get("limit")
@@ -172,17 +111,4 @@ class TOSASpec:
for cat in cats:
argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(",")))
- return TOSAOperatorArgument(name, desc, argcats, argtype, argtelty, shape, levellimits, rank)
-
- def __load_enum(self, arg):
- name = arg.get("name")
- desc = arg.get("description").strip()
- values = []
- for val in arg.findall("enumval"):
- values.append((val.get("name"), val.get("value"), val.get("description")))
- return TOSAEnum(name, desc, values)
-
- def get_enum_by_name(self, name):
- for e in self.enums:
- if e.name == name:
- return e
+ return TOSAOperatorArgument(name, desc, argcats, argtype, shape, levellimits)
diff --git a/tosa.xml b/tosa.xml
index 16b8219..1c17bb5 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -1,33 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tosa SYSTEM "tosa.dtd">
<tosa>
- <version major="0" minor="70" patch="0" draft="false"/>
+ <version major="0" minor="60" patch="0" draft="false"/>
<profiles>
<profile name="BI">Base Inference</profile>
<profile name="MI">Main Inference</profile>
<profile name="MT">Main Training</profile>
</profiles>
<levels>
- <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048" max_log2_size="63">No level</level>
- <level name="8K" max_rank="6" max_kernel="8192" max_stride="8192" max_scale="64" max_log2_size="31">Level 8K</level>
+ <level name="none" max_rank="32" max_kernel="2147483647" max_stride="2147483647" max_scale="2048">No level</level>
+ <level name="8K" max_rank="6" max_kernel="8192" max_stride="8192" max_scale="64" >Level 8K</level>
</levels>
<operators>
<operatorgroup name="tensor">
<operator>
<name>ARGMAX</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_t">
- <description>Input tensor</description>
- <levellimit value="rank(shape1)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
+ <argument category="input" name="input" type="in_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
- <description>Axis in range from 0 to rank(shape1) - 1</description>
- <rank min="0" max="0"/>
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
+ <description>Axis in range from 0 to rank(shape1)-1</description>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
- <description>Output tensor, with rank = rank(shape1) - 1</description>
- <rank min="0" max="MAX_RANK - 1"/>
+ <argument category="output" name="output" type="out_t*" shape="shape">
+ <description>Output tensor, with rank = rank(shape1)-1</description>
</argument>
</arguments>
<types>
@@ -52,45 +48,37 @@
<operator>
<name>AVG_POOL2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IH,IW,C]" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="4" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="[N,IH,IW,C]">
+ <description>Input tensor 4D</description>
</argument>
- <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="kernel" type="int32_t*" shape="[2]">
<description>[kernel_y, kernel_x]</description>
<levellimit value="kernel_y" limit="MAX_KERNEL"/>
<levellimit value="kernel_x" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[2]">
<description>[stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="pad" type="int32_t*" shape="[4]">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="pad_left" limit="MAX_KERNEL"/>
<levellimit value="pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="acc_size" type="tensor_t" shape="-" tensor-element-type="acc_size_t">
+ <argument category="attribute" name="acc_size" type="acc_t" shape="-">
<description>Enumerated type, must be one of INT32, FP16, FP32, as defined in the Supported Data Types table for this operation</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="input_zp" type="in_out_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="output_zp" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="output_zp" type="in_out_t" shape="-">
<description>Output tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,C]" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="[N,OH,OW,C]">
<description>Output tensor 4D</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -119,49 +107,40 @@
<operator>
<name>CONV2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IH,IW,IC]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,IH,IW,IC]">
<description>Input tensor</description>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="weight" type="tensor_t" shape="[OC,KH,KW,IC]" tensor-element-type="weight_t">
+ <argument category="input" name="weight" type="weight_t*" shape="[OC,KH,KW,IC]">
<description>Weight kernel size KH x KW</description>
<levellimit value="dilation_y * KH" limit="MAX_KERNEL"/>
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="out_t*" shape="[OC]">
<description>Per output channel bias data.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="pad" type="int32_t*" shape="[4]">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="pad_left" limit="MAX_KERNEL"/>
<levellimit value="pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[2]">
<description>[stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="dilation" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="dilation" type="int32_t*" shape="[2]">
<description>[dilation_y, dilation_x]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="weight_zp" type="tensor_t" shape="-" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight_zp" type="weight_t" shape="-">
<description>Weight zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,OC]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OH,OW,OC]">
<description>Output tensor</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -192,22 +171,19 @@
<operator>
<name>CONV3D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,ID,IH,IW,IC]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,ID,IH,IW,IC]">
<description>Input tensor</description>
- <rank min="5" max="5"/>
</argument>
- <argument category="input" name="weight" type="tensor_t" shape="[OC,KD,KH,KW,IC]" tensor-element-type="weight_t">
+ <argument category="input" name="weight" type="weight_t*" shape="[OC,KD,KH,KW,IC]">
<description>Weight kernel size KDxKHxKW</description>
<levellimit value="dilation_d * KD" limit="MAX_KERNEL"/>
<levellimit value="dilation_y * KH" limit="MAX_KERNEL"/>
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
- <rank min="5" max="5"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="out_t*" shape="[OC]">
<description>Per output channel bias data.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="pad" type="tensor_t" shape="[6]" tensor-element-type="int32_t">
+ <argument category="attribute" name="pad" type="int32_t*" shape="[6]">
<description>[pad_d0, pad_d1, pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_d0" limit="MAX_KERNEL"/>
<levellimit value="pad_d1" limit="MAX_KERNEL"/>
@@ -215,30 +191,24 @@
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="pad_left" limit="MAX_KERNEL"/>
<levellimit value="pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[3]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[3]">
<description>[stride_d, stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
<levellimit value="stride_d" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="dilation" type="tensor_t" shape="[3]" tensor-element-type="int32_t">
+ <argument category="attribute" name="dilation" type="int32_t*" shape="[3]">
<description>[dilation_d, dilation_y, dilation_x]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="weight_zp" type="tensor_t" shape="-" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight_zp" type="weight_t" shape="-">
<description>Weight zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OD,OH,OW,OC]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OD,OH,OW,OC]">
<description>Output tensor</description>
- <rank min="5" max="5"/>
</argument>
</arguments>
<types>
@@ -269,49 +239,40 @@
<operator>
<name>DEPTHWISE_CONV2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,H,W,C]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,H,W,C]">
<description>Input tensor</description>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="weight" type="tensor_t" shape="[KH,KW,C,M]" tensor-element-type="weight_t">
+ <argument category="input" name="weight" type="weight_t*" shape="[KH,KW,C,M]">
<description>Weight kernel size KH x KW</description>
<levellimit value="dilation_y * KH" limit="MAX_KERNEL"/>
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[C*M]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="out_t*" shape="[C*M]">
<description>Per output channel bias data.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="pad" type="int32_t*" shape="[4]">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="pad_left" limit="MAX_KERNEL"/>
<levellimit value="pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[2]">
<description>[stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="dilation" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="dilation" type="int32_t*" shape="[2]">
<description>[dilation_y, dilation_x]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="weight_zp" type="tensor_t" shape="-" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight_zp" type="weight_t" shape="-">
<description>Weight zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,C*M]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OH,OW,C*M]">
<description>Output tensor</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -342,27 +303,22 @@
<operator>
<name>FFT2D</name>
<arguments>
- <argument category="input" name="input_real" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
+ <argument category="input" name="input_real" type="in_out_t*" shape="[N,H,W]">
<description>Real part of the complex input. H,W must be powers of two.</description>
<levellimit value="H" limit="MAX_KERNEL"/>
<levellimit value="W" limit="MAX_KERNEL"/>
- <rank min="3" max="3"/>
</argument>
- <argument category="input" name="input_imag" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
+ <argument category="input" name="input_imag" type="in_out_t*" shape="[N,H,W]">
<description>Imaginary part of the complex input. H,W must be powers of two.</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="attribute" name="inverse" type="tensor_t" shape="-" tensor-element-type="bool_t">
+ <argument category="attribute" name="inverse" type="bool_t" shape="-">
<description>false for forward FFT, true for inverse FFT</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output_real" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
+ <argument category="output" name="output_real" type="in_out_t*" shape="[N,H,W]">
<description>Real part of the complex output.</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="output" name="output_imag" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
+ <argument category="output" name="output_imag" type="in_out_t*" shape="[N,H,W]">
<description>Imaginary part of the complex output.</description>
- <rank min="3" max="3"/>
</argument>
</arguments>
<types>
@@ -376,29 +332,23 @@
<operator>
<name>FULLY_CONNECTED</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IC]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,IC]">
<description>Input tensor</description>
- <rank min="2" max="2"/>
</argument>
- <argument category="attribute" name="weight" type="tensor_t" shape="[OC,IC]" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight" type="weight_t*" shape="[OC,IC]">
<description>Weights</description>
- <rank min="2" max="2"/>
</argument>
- <argument category="attribute" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
+ <argument category="attribute" name="bias" type="out_t*" shape="[OC]">
<description>Per output channel bias data.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="weight_zp" type="tensor_t" shape="-" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight_zp" type="weight_t" shape="-">
<description>Weight zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OC]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OC]">
<description>Output tensor</description>
- <rank min="2" max="2"/>
</argument>
</arguments>
<types>
@@ -429,25 +379,20 @@
<operator>
<name>MATMUL</name>
<arguments>
- <argument category="input" name="A" type="tensor_t" shape="[N,H,C]" tensor-element-type="in_t">
+ <argument category="input" name="A" type="in_t*" shape="[N,H,C]">
<description>Input tensor A, N matrices of size HxC</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="input" name="B" type="tensor_t" shape="[N,C,W]" tensor-element-type="in_t">
+ <argument category="input" name="B" type="in_t*" shape="[N,C,W]">
<description>Input tensor B, N matrices of size CxW</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="attribute" name="A_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="A_zp" type="in_t" shape="-">
<description>Input tensor A zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="B_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="B_zp" type="in_t" shape="-">
<description>Input tensor B zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,H,W]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,H,W]">
<description>Output tensor, N matrices of size HxW</description>
- <rank min="3" max="3"/>
</argument>
</arguments>
<types>
@@ -476,33 +421,28 @@
<operator>
<name>MAX_POOL2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IH,IW,C]" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="[N,IH,IW,C]">
<description>Input tensor 4D</description>
- <rank min="4" max="4"/>
</argument>
- <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="kernel" type="int32_t*" shape="[2]">
<description>[kernel_y, kernel_x]</description>
<levellimit value="kernel_y" limit="MAX_KERNEL"/>
<levellimit value="kernel_x" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[2]">
<description>[stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="pad" type="int32_t*" shape="[4]">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="pad_left" limit="MAX_KERNEL"/>
<levellimit value="pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,C]" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="[N,OH,OW,C]">
<description>Output tensor 4D</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -526,19 +466,16 @@
<operator>
<name>RFFT2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="[N,H,W]">
<description>Real input. H,W must be powers of two.</description>
<levellimit value="H" limit="MAX_KERNEL"/>
<levellimit value="W" limit="MAX_KERNEL"/>
- <rank min="3" max="3"/>
</argument>
- <argument category="output" name="output_real" type="tensor_t" shape="[N,H,W/2 + 1]" tensor-element-type="in_out_t">
+ <argument category="output" name="output_real" type="in_out_t*" shape="[N,H,W/2 + 1]">
<description>Real part of the complex output</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="output" name="output_imag" type="tensor_t" shape="[N,H,W/2 + 1]" tensor-element-type="in_out_t">
+ <argument category="output" name="output_imag" type="in_out_t*" shape="[N,H,W/2 + 1]">
<description>Imaginary part of the complex output.</description>
- <rank min="3" max="3"/>
</argument>
</arguments>
<types>
@@ -552,49 +489,40 @@
<operator>
<name>TRANSPOSE_CONV2D</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IH,IW,IC]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,IH,IW,IC]">
<description>Input tensor</description>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="weight" type="tensor_t" shape="[OC,KH,KW,IC]" tensor-element-type="weight_t">
+ <argument category="input" name="weight" type="weight_t*" shape="[OC,KH,KW,IC]">
<description>Weight kernel size KH x KW</description>
<levellimit value="KH" limit="MAX_KERNEL"/>
<levellimit value="KW" limit="MAX_KERNEL"/>
- <rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="out_t*" shape="[OC]">
<description>Per output channel bias data.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="out_pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="out_pad" type="int32_t*" shape="[4]">
<description>[out_pad_top, out_pad_bottom, out_pad_left, out_pad_right]</description>
<levellimit value="out_pad_top" limit="MAX_KERNEL"/>
<levellimit value="out_pad_bottom" limit="MAX_KERNEL"/>
<levellimit value="out_pad_left" limit="MAX_KERNEL"/>
<levellimit value="out_pad_right" limit="MAX_KERNEL"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="stride" type="int32_t*" shape="[2]">
<description>[stride_y, stride_x]</description>
<levellimit value="stride_y" limit="MAX_STRIDE"/>
<levellimit value="stride_x" limit="MAX_STRIDE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="out_shape" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
+ <argument category="attribute" name="out_shape" type="int32_t*" shape="[4]">
<description>[N,OH,OW,OC]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="weight_zp" type="tensor_t" shape="-" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight_zp" type="weight_t" shape="-">
<description>Weight zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,OC]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OH,OW,OC]">
<description>Output tensor</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -627,22 +555,18 @@
<operator>
<name>CLAMP</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="min_val" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="min_val" type="in_out_t" shape="-">
<description>Minimum clip value</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="max_val" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="max_val" type="in_out_t" shape="-">
<description>Maximum clip value</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type and shape as input</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -666,14 +590,12 @@
<operator>
<name>SIGMOID</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type and shape as input</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -695,14 +617,12 @@
<operator>
<name>TANH</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type and shape as input</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -726,18 +646,15 @@
<operator>
<name>ADD</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -760,22 +677,18 @@
<operator>
<name>ARITHMETIC_RIGHT_SHIFT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="round" type="tensor_t" shape="-" tensor-element-type="bool_t">
+ <argument category="attribute" name="round" type="bool_t" shape="-">
<description>If true then the shift is rounded</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -788,18 +701,15 @@
<operator>
<name>BITWISE_AND</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -812,18 +722,15 @@
<operator>
<name>BITWISE_OR</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -836,18 +743,15 @@
<operator>
<name>BITWISE_XOR</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -860,18 +764,15 @@
<operator>
<name>INTDIV</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -882,18 +783,15 @@
<operator>
<name>LOGICAL_AND</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -904,18 +802,15 @@
<operator>
<name>LOGICAL_LEFT_SHIFT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -928,18 +823,15 @@
<operator>
<name>LOGICAL_RIGHT_SHIFT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -952,18 +844,15 @@
<operator>
<name>LOGICAL_OR</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -974,18 +863,15 @@
<operator>
<name>LOGICAL_XOR</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -996,18 +882,15 @@
<operator>
<name>MAXIMUM</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1030,18 +913,15 @@
<operator>
<name>MINIMUM</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1064,22 +944,18 @@
<operator>
<name>MUL</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_t">
+ <argument category="input" name="input1" type="in_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_t">
+ <argument category="input" name="input2" type="in_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="shift" type="tensor_t" shape="-" tensor-element-type="int8_t">
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="uint6_t" shape="-">
<description>Result right shift (int32_t data type only)</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1105,18 +981,15 @@
<operator>
<name>POW</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1138,18 +1011,15 @@
<operator>
<name>SUB</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1172,18 +1042,15 @@
<operator>
<name>TABLE</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="shape">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="table" type="tensor_t" shape="[TABLE_SIZE]" tensor-element-type="table_t">
+ <argument category="input(MT)|attribute(BI,MI)" name="table" type="table_t*" shape="[TABLE_SIZE]">
<description>Lookup table tensor</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1200,14 +1067,12 @@
<operator>
<name>ABS</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1230,14 +1095,12 @@
<operator>
<name>BITWISE_NOT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1250,14 +1113,12 @@
<operator>
<name>CEIL</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1279,14 +1140,12 @@
<operator>
<name>CLZ</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1297,14 +1156,12 @@
<operator>
<name>EXP</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1326,14 +1183,12 @@
<operator>
<name>FLOOR</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1355,14 +1210,12 @@
<operator>
<name>LOG</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1384,14 +1237,12 @@
<operator>
<name>LOGICAL_NOT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1402,22 +1253,17 @@
<operator>
<name>NEGATE</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
- <levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="input1_zp" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="input1_zp" type="in_out_t" shape="-">
<description>Input 1 zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="output_zp" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="output_zp" type="in_out_t" shape="-">
<description>Output zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1443,14 +1289,12 @@
<operator>
<name>RECIPROCAL</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1472,14 +1316,12 @@
<operator>
<name>RSQRT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1503,22 +1345,18 @@
<operator>
<name>SELECT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="bool_t">
+ <argument category="input" name="input1" type="bool_t" shape="shape1">
<description>Input selector tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_out_t">
+ <argument category="input" name="input2" type="in_out_t*" shape="shape2">
<description>Input value tensor if input1 is True</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input3" type="tensor_t" shape="shape3" tensor-element-type="in_out_t">
+ <argument category="input" name="input3" type="in_out_t*" shape="shape3">
<description>Input value tensor if input1 is False</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type as input2 and input3, with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1546,18 +1384,15 @@
<operator>
<name>EQUAL</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_t">
+ <argument category="input" name="input1" type="in_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_t">
+ <argument category="input" name="input2" type="in_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1581,18 +1416,15 @@
<operator>
<name>GREATER</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_t">
+ <argument category="input" name="input1" type="in_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_t">
+ <argument category="input" name="input2" type="in_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1616,18 +1448,15 @@
<operator>
<name>GREATER_EQUAL</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_t">
+ <argument category="input" name="input1" type="in_t*" shape="shape1">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="input" name="input2" type="tensor_t" shape="shape2" tensor-element-type="in_t">
+ <argument category="input" name="input2" type="in_t*" shape="shape2">
<description>Input tensor with the same rank as input1</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor with broadcast shape if necessary</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1653,17 +1482,14 @@
<operator>
<name>REDUCE_ALL</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1674,17 +1500,14 @@
<operator>
<name>REDUCE_ANY</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1695,17 +1518,14 @@
<operator>
<name>REDUCE_MAX</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1730,17 +1550,14 @@
<operator>
<name>REDUCE_MIN</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1765,17 +1582,14 @@
<operator>
<name>REDUCE_PRODUCT</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="4"/>
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
+ <description>Input tensor with rank from 1 to 4</description>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1797,17 +1611,14 @@
<operator>
<name>REDUCE_SUM</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="in_out_t*" shape="shape1">
<description>Input tensor with rank from 1 to 4</description>
- <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reduce, in range from 0 to rank(shape1)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1832,18 +1643,16 @@
<operator>
<name>CONCAT</name>
<arguments>
- <argument category="input" name="input1" type="tensor_list_t" shape="shapes1" tensor-element-type="in_out_t">
+ <!-- FIXME express list of tensors better -->
+ <argument category="input" name="input1" type="in_out_t*" shape="shapes1[]">
<description>List of input tensors. All inputs must have the same rank and data type</description>
- <rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis along which concatenation is to occur, in range from 0 to rank(shape)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1869,22 +1678,18 @@
<operator>
<name>PAD</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="MAX_RANK"/>
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
+ <description>Input tensor with minimum rank of one.</description>
</argument>
- <argument category="attribute" name="padding" type="tensor_t" shape="[rank(shape1),2]" tensor-element-type="int32_t">
+ <argument category="attribute" name="padding" type="int32_t" shape="[rank(shape1),2]">
<description>Number of pad elements at the start and end of each dimension</description>
- <rank min="2" max="2"/>
</argument>
- <argument category="attribute" name="pad_const" type="tensor_t" shape="-" tensor-element-type="in_out_t">
+ <argument category="attribute" name="pad_const" type="in_out_t" shape="-">
<description>Constant value to be used as padding</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type as the input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1910,19 +1715,16 @@
<operator>
<name>RESHAPE</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
<description>Input tensor</description>
<levellimit value="rank(shape1)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="new_shape" type="tensor_t" shape="[rank(shape)]" tensor-element-type="int32_t">
+ <argument category="attribute" name="new_shape" type="int32_t" shape="[rank(shape)]">
<description>List of values, with each element giving the size of the result tensor for the given dimension. At most one dimension may be given as -1 to automatically calculate the dimension size.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, size as the input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1948,18 +1750,15 @@
<operator>
<name>REVERSE</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
- <description>Input tensor</description>
+ <argument category="input" name="input" type="in_out_t*" shape="shape">
+ <description>Input tensor with minimum rank of one.</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
+ <argument category="attribute" name="axis" type="int32_t" shape="-">
<description>Axis to reverse, in range from 0 to rank(shape)-1</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor. Same shape as input tensor</description>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -1985,23 +1784,19 @@
<operator>
<name>SLICE</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="MAX_RANK"/>
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
+ <description>Input tensor with minimum rank of one.</description>
</argument>
- <argument category="attribute" name="start" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="index_t">
+ <argument category="attribute" name="start" type="int32_t" shape="[rank(shape1)]">
<description>List of integer coordinates, of length equal to the rank of input1. Start coordinate for slicing.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="size" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="index_t">
+ <argument category="attribute" name="size" type="int32_t" shape="[rank(shape1)]">
<description>List of integer size values, of length equal to the rank of input1. Size of the input to be
used.</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type as the input tensor</description>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2027,18 +1822,15 @@ used.</description>
<operator>
<name>TILE</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="MAX_RANK"/>
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
+ <description>Input tensor with minimum rank of one.</description>
</argument>
- <argument category="attribute" name="multiples" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="int32_t">
+ <argument category="attribute" name="multiplies" type="int32_t" shape="[rank(shape1)]">
<description>Number of times to replicate input1 in each dimension</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, rank as the input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2064,18 +1856,15 @@ used.</description>
<operator>
<name>TRANSPOSE</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
- <description>Input tensor</description>
- <rank min="1" max="MAX_RANK"/>
+ <argument category="input" name="input1" type="in_out_t*" shape="shape1">
+ <description>Input tensor with minimum rank of one.</description>
</argument>
- <argument category="attribute" name="perms" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="int32_t">
+ <argument category="attribute" name="perms" type="int32_t" shape="[rank(shape1)]">
<description>List of integers of length equal to the rank of input1. Values must be valid dimensions within shape1, and may not be repeated.</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of same type, rank as the input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="1" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2103,34 +1892,31 @@ used.</description>
<operator>
<name>GATHER</name>
<arguments>
- <argument category="input" name="values" type="tensor_t" shape="[N,K,C]" tensor-element-type="in_out_t">
+ <argument category="input" name="values" type="value_t*" shape="[N,K,C]">
<description>3D value tensor</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="input" name="indices" type="tensor_t" shape="[N,W]" tensor-element-type="index_t">
+ <argument category="input" name="indices" type="index_t*" shape="[N,W]">
<description>2D index tensor</description>
- <rank min="2" max="2"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,W,C]" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="value_t*" shape="[N,W,C]">
<description>3D output tensor</description>
- <rank min="3" max="3"/>
</argument>
</arguments>
<types>
- <type name='in_out_t'/>
+ <type name='value_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="int8_t"/>
- <typesupport mode="signed 16" in_out_t="int16_t"/>
- <typesupport mode="signed 32" in_out_t="int32_t"/>
- <typesupport mode="fp16" in_out_t="fp16_t">
+ <typesupport mode="signed 8" value_t="int8_t"/>
+ <typesupport mode="signed 16" value_t="int16_t"/>
+ <typesupport mode="signed 32" value_t="int32_t"/>
+ <typesupport mode="fp16" value_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16" in_out_t="bf16_t">
+ <typesupport mode="bf16" value_t="bf16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32" in_out_t="fp32_t">
+ <typesupport mode="fp32" value_t="fp32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -2138,38 +1924,34 @@ used.</description>
<operator>
<name>SCATTER</name>
<arguments>
- <argument category="input" name="values_in" type="tensor_t" shape="[N,K,C]" tensor-element-type="in_out_t">
+ <argument category="input" name="values_in" type="value_t*" shape="[N,K,C]">
<description>3D values in tensor</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="input" name="indices" type="tensor_t" shape="[N,W]" tensor-element-type="index_t">
+ <argument category="input" name="indices" type="index_t*" shape="[N,W]">
<description>2D index tensor</description>
- <rank min="2" max="2"/>
</argument>
- <argument category="input" name="input" type="tensor_t" shape="[N,W,C]" tensor-element-type="in_out_t">
+ <argument category="input" name="input" type="value_t*" shape="[N,W,C]">
<description>3D input tensor</description>
- <rank min="3" max="3"/>
</argument>
- <argument category="output" name="values_out" type="tensor_t" shape="[N,K,C]" tensor-element-type="in_out_t">
+ <argument category="output" name="values_out" type="value_t*" shape="[N,K,C]">
<description>3D output tensor</description>
- <rank min="3" max="3"/>
</argument>
</arguments>
<types>
- <type name='in_out_t'/>
+ <type name='value_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="int8_t"/>
- <typesupport mode="signed 16" in_out_t="int16_t"/>
- <typesupport mode="signed 32" in_out_t="int32_t"/>
- <typesupport mode="fp16" in_out_t="fp16_t">
+ <typesupport mode="signed 8" value_t="int8_t"/>
+ <typesupport mode="signed 16" value_t="int16_t"/>
+ <typesupport mode="signed 32" value_t="int32_t"/>
+ <typesupport mode="fp16" value_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16" in_out_t="bf16_t">
+ <typesupport mode="bf16" value_t="bf16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32" in_out_t="fp32_t">
+ <typesupport mode="fp32" value_t="fp32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -2179,31 +1961,25 @@ used.</description>
<operator>
<name>RESIZE</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="[N,IH,IW,C]" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t*" shape="[N,IH,IW,C]">
<description>Input tensor</description>
- <rank min="4" max="4"/>
</argument>
- <argument category="attribute" name="scale" type="tensor_t" shape="[4]" tensor-element-type="int16_t">
+ <argument category="attribute" name="scale" type="int16_t*" shape="[4]">
<description>[scale_y_n, scale_y_d, scale_x_n, scale_x_d]</description>
<levellimit value="scale_y_n/scale_y_d" limit="MAX_SCALE"/>
<levellimit value="scale_x_n/scale_x_d" limit="MAX_SCALE"/>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="offset" type="tensor_t" shape="[2]" tensor-element-type="int16_t">
+ <argument category="attribute" name="offset" type="int16_t*" shape="[2]">
<description>[offset_y, offset_x]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="border" type="tensor_t" shape="[2]" tensor-element-type="int16_t">
+ <argument category="attribute" name="border" type="int16_t*" shape="[2]">
<description>[border_y, border_x]</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="mode" type="tensor_t" shape="-" tensor-element-type="resize_mode_t">
+ <argument category="attribute" name="mode" type="mode_t" shape="-">
<description>BILINEAR or NEAREST</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="[N,OH,OW,C]" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="[N,OH,OW,C]">
<description>Output tensor</description>
- <rank min="4" max="4"/>
</argument>
</arguments>
<types>
@@ -2233,14 +2009,12 @@ used.</description>
<operator>
<name>CAST</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t" shape="shape">
<description>Output tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2351,42 +2125,33 @@ used.</description>
<operator>
<name>RESCALE</name>
<arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_t">
+ <argument category="input" name="input" type="in_t" shape="shape">
<description>Input tensor</description>
<levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t" shape="shape">
<description>Output tensor with the same shape as input</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
+ <argument category="attribute" name="input_zp" type="in_t" shape="-">
<description>Input tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="output_zp" type="tensor_t" shape="-" tensor-element-type="out_t">
+ <argument category="attribute" name="output_zp" type="out_t" shape="-">
<description>Output tensor zero point. Must be zero for non-int8 types.</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="multiplier" type="tensor_t" shape="[NC]" tensor-element-type="mul_t">
+ <argument category="input(MT)|attribute(BI,MI)" name="multiplier" type="mul_t*" shape="[NC]">
<description>Scaling multiplier array</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="input(MT)|attribute(BI,MI)" name="shift" type="tensor_t" shape="[NC]" tensor-element-type="int8_t">
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="uint6_t*" shape="[NC]">
<description>Scaling shift array</description>
- <rank min="1" max="1"/>
</argument>
- <argument category="attribute" name="scale32" type="tensor_t" shape="-" tensor-element-type="bool_t">
+ <argument category="attribute" name="scale32" type="bool_t" shape="-">
<description>if (scale32) mul_t=int32_t else mul_t=int16_t</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="double_round" type="tensor_t" shape="-" tensor-element-type="bool_t">
+ <argument category="attribute" name="double_round" type="bool_t" shape="-">
<description>Select double round mode</description>
- <rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="per_channel" type="tensor_t" shape="-" tensor-element-type="bool_t">
+ <argument category="attribute" name="per_channel" type="bool_t" shape="-">
<description>if (per_channel) NC=shape[rank(shape)-1] else NC=1</description>
- <rank min="0" max="0"/>
</argument>
</arguments>
<types>
@@ -2417,13 +2182,11 @@ used.</description>
<operator>
<name>CONST</name>
<arguments>
- <argument category="attribute" name="values" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="attribute" name="values" type="out_t*" shape="shape">
<description>Constant values</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="out_t">
+ <argument category="output" name="output" type="out_t*" shape="shape">
<description>Output tensor of the same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2450,13 +2213,11 @@ used.</description>
<operator>
<name>IDENTITY</name>
<arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="input" name="input1" type="in_out_t*" shape="shape">
<description>Input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
- <argument category="output" name="output" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
+ <argument category="output" name="output" type="in_out_t*" shape="shape">
<description>Output tensor of the same type, size as the input tensor</description>
- <rank min="0" max="MAX_RANK"/>
</argument>
</arguments>
<types>
@@ -2484,20 +2245,19 @@ used.</description>
<operator>
<name>COND_IF</name>
<arguments>
- <argument category="input" name="condition" type="tensor_t" shape="shape" tensor-element-type="bool_t">
- <description>Input condition as a size 1 tensor</description>
- <rank min="1" max="MAX_RANK"/>
- </argument>
- <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
+ <argument category="input" name="input_list" type="tensor_list_t" shape="-">
<description>List of input tensors</description>
</argument>
- <argument category="attribute" name="then_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
+ <argument category="input" name="condition" type="bool_t*" shape="shape">
+ <description>Input condition as a size 1 tensor</description>
+ </argument>
+ <argument category="attribute" name="then_graph" type="tosa_graph_t" shape="-">
<description>TOSA graph to execute if condition is true</description>
</argument>
- <argument category="attribute" name="else_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
+ <argument category="attribute" name="else_graph" type="tosa_graph_t" shape="-">
<description>TOSA graph to execute if condition is false</description>
</argument>
- <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
+ <argument category="output" name="output_list" type="tensor_list_t" shape="-">
<description>List of output tensors</description>
</argument>
</arguments>
@@ -2505,32 +2265,20 @@ used.</description>
<operator>
<name>WHILE_LOOP</name>
<arguments>
- <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
+ <argument category="input" name="input_list" type="tensor_list_t" shape="-">
<description>List of input tensors</description>
</argument>
- <argument category="attribute" name="cond_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
+ <argument category="attribute" name="cond_graph" type="tosa_graph_t" shape="-">
<description>TOSA graph to evaluate the condition</description>
</argument>
- <argument category="attribute" name="body_graph" type="tosa_graph_t" shape="-" tensor-element-type="-">
+ <argument category="attribute" name="body_graph" type="tosa_graph_t" shape="-">
<description>TOSA graph to execute the loop body</description>
</argument>
- <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
+ <argument category="output" name="output_list" type="tensor_list_t" shape="-">
<description>List of output tensors</description>
</argument>
</arguments>
</operator>
</operatorgroup>
</operators>
-
- <enum name="resize_mode_t" description="Valid resize types">
- <enumval value="0" name="NEAREST_NEIGHBOR" description="Nearest neighbor resize"/>
- <enumval value="1" name="BILINEAR" description="Bilinear resize"/>
- </enum>
-
- <enum name="acc_size_t" description="Allowed accumulator sizes">
- <enumval value="0" name="INT32" description="32-bit integer"/>
- <enumval value="1" name="FP16" description="16-bit floating-point"/>
- <enumval value="2" name="FP32" description="32-bit floating-point"/>
- </enum>
-
</tosa>
diff --git a/tosa.xsd b/tosa.xsd
index 40fd613..6f0d3b5 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -24,13 +24,11 @@
<xs:enumeration value="MAX_STRIDE"/>
<xs:enumeration value="MAX_SCALE"/>
<xs:enumeration value="MAX_RANK"/>
- <xs:enumeration value="MAX_LOG2_SIZE"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="datatype">
<xs:restriction base="xs:string">
- <xs:enumeration value="-"/>
<xs:enumeration value="bool_t"/>
<xs:enumeration value="int4_t"/>
<xs:enumeration value="int8_t"/>
@@ -45,13 +43,6 @@
</xs:restriction>
</xs:simpleType>
-<xs:simpleType name="enumtypename">
- <xs:restriction base="xs:string">
- <xs:enumeration value="resize_mode_t"/>
- <xs:enumeration value="acc_size_t"/>
- </xs:restriction>
-</xs:simpleType>
-
<xs:simpleType name="typename">
<xs:restriction base="xs:string">
<xs:enumeration value="in_t"/>
@@ -60,9 +51,8 @@
<xs:enumeration value="acc_t"/>
<xs:enumeration value="weight_t"/>
<xs:enumeration value="resize_t"/>
+ <xs:enumeration value="value_t"/>
<xs:enumeration value="table_t"/>
- <xs:enumeration value="index_t"/>
- <xs:enumeration value="mul_t"/>
<xs:enumeration value="TABLE_SIZE"/>
</xs:restriction>
</xs:simpleType>
@@ -76,18 +66,6 @@
</xs:restriction>
</xs:simpleType>
-<xs:simpleType name="argument-type">
- <xs:restriction base="xs:string">
- <xs:enumeration value="tensor_t"/>
- <xs:enumeration value="tensor_list_t"/>
- <xs:enumeration value="tosa_graph_t"/>
- </xs:restriction>
-</xs:simpleType>
-
-<xs:simpleType name="argument-tensor-element-type">
- <xs:union memberTypes="datatype typename enumtypename"/>
-</xs:simpleType>
-
<!-- Element definitions -->
<xs:element name="version">
@@ -118,7 +96,6 @@
<xs:attribute name="max_kernel" type="xs:int" use="required"/>
<xs:attribute name="max_stride" type="xs:int" use="required"/>
<xs:attribute name="max_scale" type="xs:int" use="required"/>
- <xs:attribute name="max_log2_size" type="xs:int" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@@ -147,62 +124,18 @@
</xs:complexType>
</xs:element>
-<!--- Valid values for the rank choices, either an integer or a string
- starting with MAX_RANK (to allow things like MAX_RANK - 1)
--->
-<xs:simpleType name="validRank">
- <xs:union>
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:pattern value="MAX_RANK.*"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:union>
-</xs:simpleType>
-
-<xs:element name="rank">
- <xs:complexType>
- <xs:attribute name="min" type="validRank" use="required"/>
- <xs:attribute name="max" type="validRank" use="required"/>
- </xs:complexType>
-</xs:element>
-
<!-- TODO pattern for attribute name -->
<!-- TODO enumerations/patterns for attribute type -->
<!-- TODO enumerations/patterns for attribute shape -->
-
-<xs:element name="enumval">
- <xs:complexType>
- <xs:attribute name="name" type="xs:string"/>
- <xs:attribute name="value" type="xs:integer"/>
- <xs:attribute name="description" type="xs:string"/>
- </xs:complexType>
-</xs:element>
-
-<xs:element name="enum">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="enumval" minOccurs="1" maxOccurs="unbounded"/>
- </xs:sequence>
- <xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="description" type="xs:string" use="required"/>
- </xs:complexType>
-</xs:element>
-
<xs:element name="argument">
<xs:complexType>
<xs:sequence>
<xs:element name="description" type="xs:string"/>
<xs:element ref="levellimit" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element ref="rank" minOccurs="0" maxOccurs="1"/>
</xs:sequence>
<xs:attribute name="category" type="argumentcategory" use="required"/>
<xs:attribute name="name" type="xs:string" use="required"/>
- <xs:attribute name="type" type="argument-type" use="required"/>
- <xs:attribute name="tensor-element-type" type="argument-tensor-element-type" use="required"/>
+ <xs:attribute name="type" type="xs:string" use="required"/>
<xs:attribute name="shape" type="xs:string" use="required"/>
</xs:complexType>
</xs:element>
@@ -241,6 +174,7 @@
<xs:attribute name="weight_t" type="datatype"/>
<xs:attribute name="acc_t" type="datatype"/>
<xs:attribute name="resize_t" type="datatype"/>
+ <xs:attribute name="value_t" type="datatype"/>
<xs:attribute name="table_t" type="datatype"/>
<xs:attribute name="TABLE_SIZE" type="xs:int"/>
</xs:complexType>
@@ -281,7 +215,6 @@
<xs:element ref="profiles"/>
<xs:element ref="levels"/>
<xs:element ref="operators"/>
- <xs:element ref="enum" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
diff --git a/tosa_spec.adoc b/tosa_spec.adoc
index 60404d9..64611f0 100644
--- a/tosa_spec.adoc
+++ b/tosa_spec.adoc
@@ -22,8 +22,6 @@ include::chapters/introduction.adoc[]
include::chapters/operators.adoc[]
-include::chapters/enumerations.adoc[]
-
include::chapters/pseudocode.adoc[]
include::chapters/appendix_a.adoc[]