aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chapters/activation_funcs.adoc26
-rw-r--r--chapters/appendix_a.adoc52
-rw-r--r--chapters/control_flow.adoc6
-rw-r--r--chapters/custom.adoc18
-rw-r--r--chapters/data_layout.adoc23
-rw-r--r--chapters/ewise_binary.adoc151
-rw-r--r--chapters/ewise_unary.adoc23
-rw-r--r--chapters/image.adoc23
-rw-r--r--chapters/introduction.adoc146
-rw-r--r--chapters/operators.adoc12
-rw-r--r--chapters/pseudocode.adoc210
-rw-r--r--chapters/reduction.adoc10
-rw-r--r--chapters/tensor_ops.adoc137
-rw-r--r--chapters/type_conversion.adoc55
-rw-r--r--chapters/variable.adoc106
-rw-r--r--figures/erf.svg145
-rw-r--r--tools/dictionary.dic6
-rwxr-xr-xtools/genspec.py65
-rw-r--r--tools/tosa.py72
-rw-r--r--tosa.xml655
-rw-r--r--tosa.xsd18
21 files changed, 523 insertions, 1436 deletions
diff --git a/chapters/activation_funcs.adoc b/chapters/activation_funcs.adoc
index 1acaf56..46fa19d 100644
--- a/chapters/activation_funcs.adoc
+++ b/chapters/activation_funcs.adoc
@@ -28,32 +28,6 @@ for_each(index in shape) {
}
----
-==== ERF
-
-// erf(z) = \frac{2}{\sqrt{\pi}} \int_{0}^{z} e^{-t^2} dt
-Error function:
-
-.Calculation for the error function
-image::erf.svg["Error function", align="center"]
-
-For quantized integer data types, the TABLE operator should be used instead with
-the following definition.
-
-The ERF table has 513 entries each of 16-bit precision and covering the input range -4.0 to +4.0 in steps of 1/64.
-
-[source,c++]
-----
-int16_t erf_reference(int16_t x) { // input x range is -256 to + 256 inclusive
- F64 v = (double)x / (double)64;
- v = erf(v);
- return round_to_nearest_int(32768.0 * v);
-}
-
-generate_lookup_table(&erf_table, &erf_reference);
-----
-
-include::{generated}/operators/ERF.adoc[]
-
==== SIGMOID
Applies the sigmoid logistic function to each element of the input tensor.
diff --git a/chapters/appendix_a.adoc b/chapters/appendix_a.adoc
index ba3b6bb..f601d5d 100644
--- a/chapters/appendix_a.adoc
+++ b/chapters/appendix_a.adoc
@@ -37,10 +37,7 @@ This function takes the following arguments:
* 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)
-** 1 for the second input (usually weights)
-** 2 for the third input if present (usually bias)
+* 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
@@ -64,7 +61,6 @@ The aim of this generator is to check that sum of products with zero gives zero
| 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
-| 2 | 0.0
|===
==== Test set S=1
@@ -74,9 +70,8 @@ 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(KS+1))*(0.75 + 0.25*set_data(3*S+0, i))
-| 1 | (B/sqrt(KS+1))*(0.75 + 0.25*set_data(3*S+1, i))
-| 2 | (B*B/(KS+1))*(0.75 + 0.25*set_data(3*S+2, 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
@@ -90,7 +85,6 @@ If the implementation changes the order of the sum, then the test data must also
| 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)
-| 2 | 0.0
|===
==== Test set S=3
@@ -104,7 +98,6 @@ If the implementation changes the order of the sum, then the test data must also
| 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)
-| 2 | 0.0
|===
==== Test set S=4
@@ -114,9 +107,8 @@ 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/sqrt(KS))*set_data(2*S+1, i))
-| 1 | (k==KS/2) ? -0.5 : (set_data(2*S, i) < 0 ? (B/sqrt(KS))*set_data(2*S+1, i) : 0.0)
-| 2 | 0.0
+| 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)
|===
==== Test set S=5
@@ -126,9 +118,8 @@ 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+1))*set_data(3*S+0, i)
-| 1 | (B/sqrt(KS+1))*set_data(3*S+1, i)
-| 2 | (B*B/(KS+1))*set_data(3*S+2, 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
@@ -154,9 +145,6 @@ for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= 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);
}
-for (0 <= oc < OC) {
- bias[oc] = tosa_mi_data(S, KS, 2, oc)
-}
----
==== CONV3D
@@ -174,9 +162,6 @@ for (0 <= n < N, 0 <= id < UD, 0 <= iy < IH, 0 <= ix < IW, 0 <= 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);
}
-for (0 <= oc < OC) {
- bias[oc] = tosa_mi_data(S, KS, 2, oc)
-}
----
==== DEPTHWISE_CONV2D
@@ -187,15 +172,12 @@ For compliant implementation, the test must pass whenever the attributes satisfy
[source,c++]
----
-KS = KW*KH;
+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), ((n*IH+iy)*IW+ix)*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), ((ky*KW+kx)*C+c)*M+m);
-}
-for (0 <= oc < C*M) {
- bias[oc] = tosa_mi_data(S, KS, 2, oc)
+ weight[ky, kx, c, m] = tosa_mi_data(S, KS, 1, (ky*KW+kx)*C+c, ((ky*KW+kx)*C+c)*M+m);
}
----
@@ -214,9 +196,6 @@ for (0 <= n < N, 0 <= ic < IC) {
for (0 <= oc < OC, 0 <= ic < IC) {
weight[oc, ic] = tosa_mi_data(S, KS, 1, ic, oc*IC+ic);
}
-for (0 <= oc < OC) {
- bias[oc] = tosa_mi_data(S, KS, 2, oc)
-}
----
==== MATMUL
@@ -251,9 +230,6 @@ for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= 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);
}
-for (0 <= oc < OC) {
- bias[oc] = tosa_mi_data(S, KS, 2, oc)
-}
----
==== FFT2D
@@ -300,13 +276,11 @@ For compliant implementation, the test must pass whenever the attributes satisfy
[source,c++]
----
-KX = kernel_x;
-KY = kernel_y;
-KS = KX*KY;
+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 % KY)*KX+(ix % KX))*C+c, ((n*IH+iy)*IW+ix)*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 < KY, 0 <= kx < KX, 0 <= c < C, 0 <= m < M) {
+for (0 <= ky < KH, 0 <= kx < KW, 0 <= c < C, 0 <= m < M) {
weight[ky, kx] = 1/KS;
}
----
diff --git a/chapters/control_flow.adoc b/chapters/control_flow.adoc
index 9de9c72..e43ef51 100644
--- a/chapters/control_flow.adoc
+++ b/chapters/control_flow.adoc
@@ -19,20 +19,17 @@ include::{generated}/operators/COND_IF.adoc[]
[source,c++]
----
-ERROR_IF(tosa_nesting_depth >= MAX_NESTING);
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(then_graph));
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(else_graph));
ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(then_graph));
ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(else_graph));
ERROR_IF(tensor_size(shape) != 1);
-tosa_nesting_depth++;
if (condition[0]) {
tosa_execute_graph(then_graph, input_list, output_list);
} else {
tosa_execute_graph(else_graph, input_list, output_list);
}
-tosa_nesting_depth--;
----
==== WHILE_LOOP
@@ -43,7 +40,6 @@ include::{generated}/operators/WHILE_LOOP.adoc[]
[source,c++]
----
-ERROR_IF(tosa_nesting_depth >= MAX_NESTING);
ERROR_IF(tensor_list_shape(input_list) != tosa_list_shape(output_list));
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(cond_graph));
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(body_graph));
@@ -58,13 +54,11 @@ int32_t i=0; // iteration number
tensor_list_t list[]; // array of tensor lists indexed by iteration
bool_t *condition[]; // array of condition tensors indexed by iteration
list[i] = input_list; // copy input data as list[0]
-tosa_nesting_depth++;
tosa_execute_graph(cond_graph, list[i], [ condition[i] ]); // initial condition
while (condition[i][0]) {
tosa_execute_graph(body_graph, list[i], list[i+1]);
i = i+1;
tosa_execute_graph(cond_graph, list[i], [ condition[i] ]);
}
-tosa_nesting_depth--;
output_list = list[i];
----
diff --git a/chapters/custom.adoc b/chapters/custom.adoc
index cf99bc4..e748f38 100644
--- a/chapters/custom.adoc
+++ b/chapters/custom.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020,2023 ARM Limited
+// (C) COPYRIGHT 2020 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
@@ -12,15 +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:
-Runs an implementation defined custom operator.
-CUSTOM operators are not tested in the conformance suite as results will be implementation defined.
-The `domain` attribute should be unique to each implementation.
-To achieve this, using a domain name as the `domain` attribute is recommended.
-
-include::{generated}/operators/CUSTOM.adoc[]
-
-[source,c++]
-----
-// Implementation defined behavior
----- \ No newline at end of file
+* Num input arguments – Scalar number of input arguments
+* Num output arguments – Scalar number of output arguments
+* Operator code – untyped data consisting of the operator data
+* Affine transform description for each tensor
diff --git a/chapters/data_layout.adoc b/chapters/data_layout.adoc
index 2d48eb1..2dc7057 100644
--- a/chapters/data_layout.adoc
+++ b/chapters/data_layout.adoc
@@ -17,14 +17,13 @@ include::{generated}/operators/CONCAT.adoc[]
[source,c]
----
-ERROR_IF(axis < 0 || axis >= max(1,rank(shapes1[0])));
-ERROR_IF(shape[axis] != sum(shape_dim(shapes1[k], axis) for all k))
-ERROR_IF(in_out_t == shape_t && rank(shape) > 1);
+ERROR_IF(axis < 0 || axis >= rank(shapes1[0]));
+ERROR_IF(shape[axis] != sum(shape1[k][axis] for all k))
// The following checks ensure all inputs are compatible for concatenation
for_each(input_shape in shapes1) {
ERROR_IF(rank(input_shape) != rank(shapes1[0]));
for_each(index in input_shape) {
- ERROR_IF(index != axis && input_shape[index] != shapes1[0][index]);
+ ERROR_IF(input_shape[index] != shapes1[0][index] && index != axis);
}
}
for_each(index1 in shape) {
@@ -33,11 +32,11 @@ for_each(index1 in shape) {
// Continue to concatenate along axis from each tensor
// For each output location, we are looking for the
// appropriate input tensor
- if (index2[axis] >= 0 && index2[axis] < shape_dim(shapes1[t], axis)) {
+ if (index2[axis] >= 0 && index2[axis] < shapes1[t][axis]) {
in_out_t value = tensor_read<in_out_t>(input1[t], shapes1[t], index2);
tensor_write<in_out_t>(output, shape, index1, value);
}
- index2[axis] = index2[axis] - shape_dim(shapes1[t], axis);
+ index2[axis] = index2[axis] - shapes1[t][axis];
}
}
@@ -73,18 +72,6 @@ for_each(index in shape) {
}
----
-==== DIM
-
-Returns a rank 0 tensor of the size of the input tensor for the given axis.
-
-include::{generated}/operators/DIM.adoc[]
-
-[source,c++]
-----
-ERROR_IF(axis >= rank(shape));
-tensor_write<shape_t>(output, [], [], shape_dim(shape, axis));
-----
-
==== RESHAPE
Returns a tensor with the same type/values as the input, with a new shape specified by the shape argument. Reshape may operate on tensors of any rank. No data conversion happens during a reshape operation.
diff --git a/chapters/ewise_binary.adoc b/chapters/ewise_binary.adoc
index 876ab4b..864cf5b 100644
--- a/chapters/ewise_binary.adoc
+++ b/chapters/ewise_binary.adoc
@@ -18,22 +18,14 @@ include::{generated}/operators/ADD.adoc[]
[source,c++]
----
-if (in_out_t == shape_t) {
- ERROR_IF(rank(shape) != 0 || rank(shape1) != 0 || rank(shape2) != 0);
- shape_t value1 = tensor_read<shape_t>(input1, [], []);
- shape_t value2 = tensor_read<shape_t>(input2, [], []);
- shape_t result = apply_add_s<shape_t>(value1, value2);
- tensor_write<shape_t>(output, [], [], result);
-} else {
- 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);
- in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
- in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- in_out_t result = apply_add_s<in_out_t>(value1, value2);
- tensor_write<in_out_t>(output, shape, index, result);
- }
+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);
+ in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
+ in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
+ in_out_t result = apply_add<in_out_t>(value1, value2);
+ tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -54,16 +46,15 @@ for_each(index in shape) {
in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
// Ensure that shift amount is appropriate for the data type
- REQUIRE((in_out_t == i32_t && 0 <= value2 && value2 <= 31) ||
- (in_out_t == i16_t && 0 <= value2 && value2 <= 15) ||
- (in_out_t == i8_t && 0 <= value2 && value2 <= 7));
+ REQUIRE((in_out_t == int32_t && 0 <= value2 && value2 <= 31) ||
+ (in_out_t == int16_t && 0 <= value2 && value2 <= 15) ||
+ (in_out_t == int8_t && 0 <= value2 && value2 <= 7));
- in_out_t result = apply_arith_rshift<in_out_t>(value1, value2);
- if (round == true && static_cast<int32_t>(value2) > 0 &&
- (apply_arith_rshift<in_out_t>(value1, apply_sub_s<in_out_t>(value2, 1)) & 1 != 0) {
+ in_out_t result = value1 >> value2;
+ if (round == true && value2 > 0 && (value1 >> (value2 - 1)) & 1 != 0) {
result = result + 1;
}
- result = apply_clip_s<in_out_t>(result, minimum_s<in_out_t>, maximum_s<in_out_t>);
+ result = apply_clip<in_out_t>(result, minimum<in_out_t>, maximum<in_out_t>);
tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -140,27 +131,18 @@ include::{generated}/operators/INTDIV.adoc[]
[source,c++]
----
-if (in_out_t == shape_t) {
- ERROR_IF(rank(shape) != 0 || rank(shape1) != 0 || rank(shape2) != 0);
- shape_t value1 = tensor_read<shape_t>(input1, [], []);
- shape_t value2 = tensor_read<shape_t>(input2, [], []);
+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);
+ in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
+ in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
REQUIRE(value2 != 0);
- shape_t result = value1 / value2;
- tensor_write<shape_t>(output, [], [], result);
-} else {
- 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);
- in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
- in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- REQUIRE(value2 != 0);
- // This catches the case where we divide minimum<in_out_t> by -1
- // which is not representable in two's complement
- REQUIRE(static_cast<int64_t>(value1) / static_cast<int64_t>(value2) <= maximum_s<in_out_t>);
- in_out_t result = apply_intdiv_s<in_out_t>(value1, value2);
- tensor_write<in_out_t>(output, shape, index, result);
- }
+ // This catches the case where we divide minimum<in_out_t> by -1
+ // which is not representable in two's complement
+ REQUIRE((int64_t)value1 / value2 <= maximum<in_out_t>);
+ in_out_t result = value1 / value2;
+ tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -220,9 +202,8 @@ for_each(index in shape) {
dim_t index2 = apply_broadcast(shape, shape2, index);
in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- REQUIRE(0 <= static_cast<int32_t>(value2) && static_cast<int32_t>(value2) <= 31);
- // Logical shifts happen as unsigned types internally
- in_out_t result = apply_logical_rshift<in_out_t>(value1, value2);
+ REQUIRE(0 <= value2 && value2 <= 31);
+ in_out_t result = (in_out_t)((unsigned in_out_t)value1 >> value2);
tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -282,7 +263,7 @@ for_each(index in shape) {
dim_t index2 = apply_broadcast(shape, shape2, index);
in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- in_out_t result = apply_max_s<in_out_t>(value1, value2);
+ in_out_t result = apply_max(value1, value2);
tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -302,7 +283,7 @@ for_each(index in shape) {
dim_t index2 = apply_broadcast(shape, shape2, index);
in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- in_out_t result = apply_min_s(value1, value2);
+ in_out_t result = apply_min(value1, value2);
tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -316,33 +297,25 @@ include::{generated}/operators/MUL.adoc[]
[source,c++]
----
-if (in_out_t == shape_t) {
- ERROR_IF(rank(shape) != 0 || rank(shape1) != 0 || rank(shape2) != 0);
- shape_t value1 = tensor_read<shape_t>(input1, [], []);
- shape_t value2 = tensor_read<shape_t>(input2, [], []);
- shape_t result = value1 * value2;
- tensor_write<shape_t>(output, [], [], result);
-} else {
- REQUIRE(0 <= shift && shift <= 63);
- REQUIRE(in_t == int32_t || shift == 0);
- 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);
- in_t value1 = tensor_read<in_t>(input1, shape1, index1);
- in_t value2 = tensor_read<in_t>(input2, shape2, index2);
- out_t result;
- if (in_t == i32_t && shift > 0) {
- int64_t product = sign_extend<int64_t>(value1) * sign_extend<int64_t>(value2);
- int64_t round = static_cast<int64_t>(1) << (shift - 1);
- product = (product + round) >> shift;
- REQUIRE(product >= minimum_s<i32_t> && product <= maximum_s<i32_t>)
- result = product;
- } else {
- result = apply_mul_s(value1, value2); // low 32-bits of result for i32_t
- }
- tensor_write<out_t>(output, shape, index, result);
+REQUIRE(0 <= shift && shift <= 63);
+REQUIRE(in_t == int32_t || shift == 0);
+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);
+ in_t value1 = tensor_read<in_t>(input1, shape1, index1);
+ in_t value2 = tensor_read<in_t>(input2, shape2, index2);
+ out_t result;
+ if (in_t == int32_t && shift > 0) {
+ int64_t product = (int64_t)value1 * (int64_t)value2;
+ int64_t round = (int64_t)1 << (shift-1);
+ product = (product + round) >> shift;
+ REQUIRE(product >= minimum<int32_t> && product <= maximum<int32_t>)
+ result = product;
+ } else {
+ result = value1 * value2; // low 32-bits of result for int32_t
}
+ tensor_write<out_t>(output, shape, index, result);
}
----
@@ -375,22 +348,14 @@ include::{generated}/operators/SUB.adoc[]
[source,c++]
----
-if (in_out_t == shape_t) {
- ERROR_IF(rank(shape) != 0 || rank(shape1) != 0 || rank(shape2) != 0);
- shape_t value1 = tensor_read<shape_t>(input1, [], []);
- shape_t value2 = tensor_read<shape_t>(input2, [], []);
- shape_t result = apply_sub<shape_t>(value1, value2);
- tensor_write<shape_t>(output, [], [], result);
-} else {
- 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);
- in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
- in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
- in_out_t result = apply_sub_s<in_out_t>(value1, value2);
- tensor_write<in_out_t>(output, shape, index, result);
- }
+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);
+ in_out_t value1 = tensor_read<in_out_t>(input1, shape1, index1);
+ in_out_t value2 = tensor_read<in_out_t>(input2, shape2, index2);
+ in_out_t result = apply_sub<in_out_t>(value1, value2);
+ tensor_write<in_out_t>(output, shape, index, result);
}
----
@@ -418,11 +383,11 @@ REQUIRE(length(table) == TABLE_SIZE);
for_each(index in shape) {
in_t value = tensor_read<in_t>(input, shape, index);
out_t result;
- if (in_t == i8_t) {
+ if (in_t == int8_t) {
// value is a signed int, convert to a 0 based index
- result = table[static_cast<int16_t>(value) + 128];
+ result = table[value + 128];
} else {
- result = apply_lookup_s(static_cast<int16_t>(table), static_cast<int16_t>(value));
+ result = apply_lookup(table, value);
}
tensor_write<out_t>(output, shape, index, result);
}
diff --git a/chapters/ewise_unary.adoc b/chapters/ewise_unary.adoc
index d3eacc4..f630a48 100644
--- a/chapters/ewise_unary.adoc
+++ b/chapters/ewise_unary.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2023 ARM Limited
+// (C) COPYRIGHT 2020-2022 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
@@ -26,12 +26,11 @@ include::{generated}/operators/ABS.adoc[]
----
for_each(index in shape) {
in_out_t value1 = tensor_read<in_out_t>(input1, shape, index);
- if (is_floating_point(in_out_t) && value1 == -0.0) {
+ if (in_out_t == float_t && value1 == -0.0) {
value1 = 0.0;
}
- if (static_cast<int32_t>(value1) < 0.0) {
- value1 = apply_sub_s<in_out_t>(0, value1);
- }
+ if (value1 < 0.0)
+ value1 = apply_sub<in_out_t>(0, value1);
tensor_write<in_out_t>(output, shape, index, value1);
}
----
@@ -184,17 +183,13 @@ include::{generated}/operators/NEGATE.adoc[]
[source,c++]
----
-ERROR_IF(in_out_t != i8_t && input1_zp != 0) // Zero point only for int8_t
-ERROR_IF(in_out_t != i8_t && output_zp != 0) // Zero point only for int8_t
+ERROR_IF(in_out_t != int8_t && input1_zp != 0) // Zero point only for int8_t
+ERROR_IF(in_out_t != int8_t && output_zp != 0) // Zero point only for int8_t
for_each(index in shape) {
in_out_t value1 = tensor_read<in_out_t>(input1, shape, index);
- acc_t value = apply_sub_s<acc_t>(sign_extend<acc_t>(value1),
- sign_extend<acc_t>(input1_zp));
- value = apply_sub_s<acc_t>(0, value);
- value = apply_add_s<acc_t>(value, sign_extend<acc_t>(output_zp));
- in_out_t result = truncate<in_out_t>(apply_clip_s<acc_t>(value,
- minimum_s<in_out_t>,
- maximum_s<in_out_t>));
+ acc_t value = (acc_t)value1 - input1_zp;
+ value = apply_sub<acc_t>(0, value);
+ in_out_t result = (in_out_t)apply_clip<acc_t>(value + output_zp, minimum<in_out_t>, maximum<in_out_t>);
tensor_write<in_out_t>(output, shape, index, result);
}
----
diff --git a/chapters/image.adoc b/chapters/image.adoc
index da839f8..8abc878 100644
--- a/chapters/image.adoc
+++ b/chapters/image.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2023 ARM Limited
+// (C) COPYRIGHT 2020-2021 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
@@ -91,23 +91,22 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C) {
int16_t rx = x - ix * scale_x_n; // (x % scale_x_n)
if (is_floating_point(resize_t)) {
- dy = static_cast<resize_t>(ry) / static_cast<resize_t>(scale_y_n);
- dx = static_cast<resize_t>(rx) / static_cast<resize_t>(scale_x_n);
+ dy = (resize_t)ry / (resize_t)scale_y_n;
+ dx = (resize_t)rx / (resize_t)scale_x_n;
} else {
dy = ry;
dx = rx;
}
// Note that -1 <= iy < IH and -1 <= ix < IW
- int16_t iy0 = apply_max_s(iy, 0);
- int16_t iy1 = apply_min_s(iy + 1, IH - 1);
- int16_t ix0 = apply_max_s(ix, 0);
- int16_t ix1 = apply_min_s(ix + 1, IW - 1);
+ int16_t iy0 = apply_max(iy, 0);
+ int16_t iy1 = apply_min(iy + 1, IH - 1);
+ int16_t ix0 = apply_max(ix, 0);
+ int16_t ix1 = apply_min(ix + 1, IW - 1);
if (mode==BILINEAR) {
- using in_s_t = make_signed(in_t); // Use signed calculations for i8/i16
- in_s_t v00 = static_cast<in_s_t>(tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix0,c]));
- in_s_t v01 = static_cast<in_s_t>(tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix1,c]));
- in_s_t v10 = static_cast<in_s_t>(tensor_read<in_t>(input, [N,IH,IW,C], [n,iy1,ix0,c]));
- in_s_t v11 = static_cast<in_s_t>(tensor_read<in_t>(input, [N,IH,IW,C], [n,iy1,ix1,c]));
+ in_t v00 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix0,c]);
+ in_t v01 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy0,ix1,c]);
+ in_t v10 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy1,ix0,c]);
+ in_t v11 = tensor_read<in_t>(input, [N,IH,IW,C], [n,iy1,ix1,c]);
acc = v00 * (unit_y - dy) * (unit_x - dx);
acc += v01 * (unit_y - dy) * dx;
acc += v10 * dy * (unit_x - dx);
diff --git a/chapters/introduction.adoc b/chapters/introduction.adoc
index 26fef0e..b369070 100644
--- a/chapters/introduction.adoc
+++ b/chapters/introduction.adoc
@@ -163,8 +163,7 @@ In terms of psuedo-code, if *graph* is a TOSA graph consisting of Baseline Infer
bool tosa_test_compliance(tosa_graph_t graph, tosa_list_t input_list, tosa_level_t level) {
shape_list_t output_list_spec = tosa_allocate_list(tosa_output_shape(graph));
shape_list_t output_list_test = tosa_allocate_list(tosa_output_shape(graph));
- tosa_graph_result = tosa_valid; // result starts as valid
- tosa_nesting_depth = 0; // if/while nesting level
+ tosa_graph_result = tosa_valid // result starts as valid
tosa_execute_graph(graph, input_list, output_list_spec, level);
if (tosa_graph_result == tosa_unpredictable) {
return true; // No requirement to match an unpredictable result
@@ -261,7 +260,7 @@ Otherwise:the result must be within 1 ulp of the mathematical result.
Otherwise if the input is a zero the output must be an infinity of the same sign. +
Otherwise the result must be within 1 ulp of the mathematical result.
-| <<SIGMOID>>, <<TANH>>, <<POW>>, <<EXP>>, <<LOG>>, <<ERF>>
+| <<SIGMOID>>, <<TANH>>, <<POW>>, <<EXP>>, <<LOG>>
| If the input to LOG is less than zero then the result must be a NaN. +
If the inputs to POW are both zero then the result must be a NaN. +
If the first input to POW is less than zero and the second input is not an integer then the result must be a NaN. +
@@ -287,90 +286,64 @@ 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 tensors named 'input', 'weight' and optionally 'bias'.
-Each output tensor element can be expressed as a dot product of elements between the 'input' and 'weight' tensors with optional bias addition.
+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.
-If the operation does not specify a bias then 'bias' is taken to be zero in this section.
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]`, weight elements `w[k]`, bias `b`:
+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] + b`
+`out = in[0] * w[0] + in[1] * w[1] + ... + in[KS-1] * w[KS-1]`
-The positions of `in[k]`, `w[k]`, `b` in the input, weight and bias tensors depends on the operation being performed.
-This may be, for example, a convolution.
+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.
-In this section:
+The term "fp64 arithmetic" refers to double-precision floating-point arithmetic defined by <<Other publications>>[1].
-* "fp64 arithmetic" refers to double-precision floating-point arithmetic defined by IEEE 754 (<<Other publications>>[1])
-* `operation_fp64()` is an fp64 reference implementation of the operation
-* `operation_imp()` is the implementation under test
-* `local_bound` is defined as follows:
-** For operations with a local_bound attribute it is the value of the optional attribute, with default value of false
-** For operations that do not have a local_bound attribute the value is true
+For an operation with given sizes and attributes to be compliant the following must hold for each data set S defined in <<Appendix A>>:
-The checks described in the following code must pass for the following data sets:
+* 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
-* Data sets defined for the operation in Appendix A <<Main Inference operator test data>>.
-* Data sets that have at least MIN_DOT_PRODUCT different output values. For these data sets we take S=-1.
+The following checks must then pass:
[source,c++]
----
-output_ref = operation_fp64(input, weight, bias);
-output_imp = operation_imp (input, weight, bias);
-input_abs = abs(input); // Element-wise absolute
-weight_abs = abs(weight); // Element-wise absolute
-bias_abs = abs(bias); // Element-wise absolute
-if (!local_bound) {
- input_abs_max = max_value(input_abs); // maximum over all elements
- for_each(index in shape(input_abs) {
- input_abs[index] = input_abs_max; // set all entries to global maximum
- }
-}
-output_bnd = operation_fp64(input_abs, weight_abs, bias_abs);
-
size_t T = tensor_size(output_shape) // number dot product results
-size_t ksb = (max_value(bias_abs) > 0) ? (KS + 1) : KS; // kernel size and bias
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
-fp64_t acc_min_normal; // accumulator minimum normal greater than zero
-fp64_t two_m63 = -1.0/(fp64)((int64_t)-1<<63); // pow(2, -63)
+fp64_t acc_prec; // 1<<(M+1) where M is the number of mantissa bits
switch (acc_t) {
- case fp32_t: acc_prec = static_cast<fp64_t>(1<<24); // pow(2, 24)
- acc_min_normal = two_m63 * two_m63; // pow(2, -126)
- break;
- case fp16_t: acc_prec = static_cast<fp64_t>(1<<11); // pow(2, 11)
- acc_min_normal = 1.0/static_cast<fp64_t>(1<<14); // pow(2, -14)
- break;
- default: ERROR_IF(true);
+ 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 ((acc_t)out_bnd == infinity) {
- // dot product can overflow and there is no accuracy limit
- out_err = 0.0;
- } else if (out_bnd == 0.0) {
+ if (out_bnd == 0.0) {
REQUIRE(out_ref == 0.0 && out_imp == 0.0);
out_err = 0.0;
- } else { // 0.0 < out_bnd < infinity
- out_bnd = max(out_bnd, acc_min_normal);
- out_err = (static_cast<fp64_t>(out_imp) - out_ref) * acc_prec / out_bnd;
- REQUIRE(abs(out_err) <= ksb);
+ } 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 (input and weights are data set S with 3 <= S <= 5) {
+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(ksb*T));
+ REQUIRE(abs(out_err_sum) <= 2*sqrt(KS*T));
}
// check output error variance magnitude
-REQUIRE(out_err_sumsq <= 0.4*ksb*T)
+REQUIRE(out_err_sumsq <= 0.4*KS*T)
----
=== Tensor Definitions
@@ -385,20 +358,14 @@ Tensors have metadata associated with them that describe characteristics of the
The number of dimensions in a shape is called the rank.
A tensor with rank equal to zero is permitted.
-In that case, the tensor has a single entry and is also known as a scalar.
+In that case, the tensor has a single entry.
A tensor shape is an array of integers of size equal to the rank of the tensor.
Each element in the tensor shape describes the number of elements in the dimension.
The tensor shape in each dimension must be greater than or equal to 1.
For tensor access information, see <<Tensor Access Helpers>>.
-
-The shape of a tensor of non-zero rank is itself a tensor of rank 1 with elements of type shape_t.
-The single dimension has size which is the rank of the original tensor.
-In this specification a shape-tensor means a rank 1 tensor with elements of type shape_t.
-The components of a shape tensor are rank 0 tensors of type shape_t.
-
-Some operations can process rank 0 or rank 1 tensors of type shape_t.
-For these operations, shape_t is permitted as an input or output tensor data type.
-In this version of the specification, shape_t values must be resolvable to constants at backend compile time.
+Tensor dimensions are given in the pseudocode as type dim_t.
+dim_t is a vector of index_t values, with the length of the vector defining the rank of the tensor.
+Tensor elements are addressed using dim_t values, where each element of the vector indicates the offset of the requested element within the corresponding dimension.
==== Tensor size limit
@@ -411,8 +378,6 @@ This type must be able to hold integers in the range 0 to (1++<<++MAX_LOG2_SIZE)
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.
Indices used to access tensors must be non-negative.
-The type shape_t, used in shape tensors, must be able to hold integers in the range -(1++<<++MAX_LOG2_SIZE) to (1++<<++MAX_LOG2_SIZE) - 1.
-
==== Data Layouts
The following data layouts are supported in TOSA.
@@ -457,21 +422,11 @@ The number formats supported by a given operator are listed in its table of supp
| -
|Boolean value. Size implementation defined. The TOSA reference model implements this as int8_t with 0 for false and 1 for true. All non-zero values are accepted on input as true.
-|i4_t
-| -
-| -
-|Signless 4-bit integer type. Will be interpreted as int4_t by all operators
-
|int4_t
| -7
| +7
|Signed 4-bit two's-complement value. Excludes -8 to maintain a symmetric about zero range for weights.
-|i8_t
-| -
-| -
-|Signless 8-bit integer value. Will be interpreted as int8_t unless otherwise specified by an operator.
-
|int8_t
| -128
| +127
@@ -480,12 +435,7 @@ The number formats supported by a given operator are listed in its table of supp
|uint8_t
| 0
| 255
-|Unsigned 8-bit integer value.
-
-|i16_t
-| -
-| -
-|Signless 16-bit integer type. Will be interpreted as int16_t unless otherwise specified by an operator.
+|Unsigned 8-bit value.
|int16_t
| -32768
@@ -497,21 +447,11 @@ The number formats supported by a given operator are listed in its table of supp
| 65535
|Unsigned 16-bit value.
-|i32_t
-| -
-| -
-|Signless 32-bit integer value. Will be interpreted as int32_t by all operators.
-
|int32_t
| -(1<<31)
| (1<<31)-1
|Signed 32-bit two's-complement value.
-|i48_t
-| -
-| -
-|Signless 32-bit integer value. Will be interpreted as int48_t by all operators.
-
|int48_t
| -(1<<47)
| (1<<47)-1
@@ -567,9 +507,7 @@ This ensures that a Base Inference profile TOSA implementation can calculate the
=== Integer Behavior
-TOSA integer inputs and outputs are specified by signless values with the given number of bits.
-Unless otherwise specified, these values will be interpreted as signed twos-complement.
-The pseudocode will use int*_t to indicate use as a signed value and uint*_t to indicate use as an unsigned value.
+Integer calculations must be standard two's-complement or unsigned calculations.
If overflow occurs doing integer calculation, the result is unpredictable, as indicated by the REQUIRE checks in the pseudocode for the operators.
Unsigned 8 and 16-bit values are only allowed in the RESCALE operation, to allow for compatibility with networks which expect unsigned 8-bit or 16-bit tensors for input and output.
@@ -619,26 +557,26 @@ The values to achieve a scaling of 1.0 are shift=30, multiplier=1<<30 for apply_
int32_t apply_scale_32(int32_t value, int32_t multiplier, int8_t shift, bool_t double_round=false) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
- REQUIRE(value >= (-1 << (shift - 1)) && value < (1 << (shift - 1)));
+ REQUIRE(value >= (-1 << (shift - 1)) && value < (1 << (shift - 1));
int64_t round = 1 << (shift - 1);
if (double_round) {
if (shift > 31 && value >= 0) round += 1<<30;
if (shift > 31 && value < 0) round -= 1<<30;
}
- int64_t result = static_cast<int64_t>(value) * multiplier + round;
+ int64_t result = (int64_t)value * multiplier + round;
result = result >> shift;
// result will fit a 32-bit range due to the REQUIRE on value
- return static_cast<int32_t>(result);
+ return (int32_t)result;
}
int32_t apply_scale_16(int48_t value, int16_t multipler, int8_t shift) {
REQUIRE(multiplier >= 0);
REQUIRE(2 <= shift && shift <= 62);
int64_t round = (1 << (shift - 1));
- int64_t result = static_cast<int64_t>(value) * multiplier + round;
+ int64_t result = (int64_t)value * multiplier + round;
result = result >> shift;
REQUIRE(result >= minimum<int32_t> && result <= maximum<int32_t>);
- return static_cast<int32_t>(result);
+ return (int32_t)result;
}
----
@@ -692,9 +630,9 @@ All table lookups are based on the following reference lookup function that take
[source,c++]
----
-int32_t apply_lookup_s(int16_t *table, int32_t value)
+int32_t apply_lookup(int16_t *table, int32_t value)
{
- int16_t clipped_value = static_cast<int16_t>(apply_clip_s<int32_t>(value, -32768, +32767));
+ int16_t clipped_value = (int16_t)apply_clip<int32_t>(value, -32768, +32767);
int32_t index = (clipped_value + 32768) >> 7;
int32_t fraction = clipped_value & 0x7f;
int16_t base = table[index];
@@ -715,7 +653,7 @@ void generate_lookup_table(int16_t *table, int32_t (*reference)(int32_t))
{
for (int i = -256; i <= 256; i++) {
int32_t value = (*reference)(i);
- table[i + 256] = static_cast<int16_t>(apply_clip<int32_t>(value, -32768, +32767));
+ table[i + 256] = (int16_t)apply_clip<int32_t>(value, -32768, +32767)
}
}
----
diff --git a/chapters/operators.adoc b/chapters/operators.adoc
index 698738f..3a4c831 100644
--- a/chapters/operators.adoc
+++ b/chapters/operators.adoc
@@ -62,16 +62,6 @@ implementation-defined order that must be a topological ordering of the TOSA gra
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) {
ERROR_IF(tensor_list_shape(input_list) != tosa_input_shape(graph));
ERROR_IF(tensor_list_shape(output_list) != tosa_output_shape(graph));
-
- // Declare the global list for storing persistent variable tensors across multiple graphs
- if (!variable_tensors) {
- variable_tensors = list<tensor_t>();
- } else { // Clear the "seen flag"
- for (tensor_t var_tensor in variable_tensors) {
- var_tensor.seen = false;
- }
- }
-
for_each(operator in graph order) {
ERROR_IF(operator input tensors do not meet requirement of operator Arguments inputs)
ERROR_IF(operator attributes do not meet requirement of operator Arguments attributes)
@@ -110,5 +100,3 @@ include::data_nodes.adoc[]
include::custom.adoc[]
include::control_flow.adoc[]
-
-include::variable.adoc[] \ No newline at end of file
diff --git a/chapters/pseudocode.adoc b/chapters/pseudocode.adoc
index 55c35d4..422188a 100644
--- a/chapters/pseudocode.adoc
+++ b/chapters/pseudocode.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2021-2023 ARM Limited
+// (C) COPYRIGHT 2021-2022 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
@@ -94,12 +94,6 @@ size_t tensor_size(dim_t shape) {
}
return size;
}
-
-// Return the size of the tensor in the given axis
-// For a rank=0 tensor, returns 1 for all axes
-size_t shape_dim(dim_t shape, int axis) {
- return (axis >= rank(shape)) ? 1 : shape[axis];
-}
----
==== Tensor Read
@@ -131,45 +125,6 @@ void tensor_write<type>(<type> *address, dim_t shape, dim_t index, <type> value)
}
----
-==== Variable Tensor Allocate
-
-variable_tensor_allocate allocates the mutable persistent memory block for storing variable tensors.
-The shape argument contains the shape of the allocated memory block for the variable_tensor.
-The uid argument is a globally unique identifier for variable tensors.
-
-[source,c++]
-----
-tensor_t* variable_tensor_allocate<in_t>(dim_t shape, int32_t uid) {
- size_t size = tensor_size(shape);
- tensor_t *allocated_tensor = new tensor_t;
- allocated_tensor->data = new in_t[size];
- allocated_tensor->uid = uid;
- allocated_tensor->is_written = false;
- allocated_tensor->shape = shape;
- allocated_tensor->type = in_t;
- return allocated_tensor;
-}
-----
-
-==== Variable Tensor Lookup
-
-variable_tensor_lookup checks whether a variable tensor has been allocated or not.
-The uid argument is a globally unique identifier for variable tensors.
-
-[source,c++]
-----
-tensor_t variable_tensor_lookup(int32_t uid) {
- // The global all_allocated_variable_tensors was instantiated at the first
- // time of executing the tosa graph
- for_each(tensor_t allocated_tensor in all_allocated_variable_tensors) {
- if (allocated_tensor.uid == uid) {
- return allocated_tensor;
- }
- }
- return NULL;
-}
-----
-
==== Broadcast Helpers
The following function derives the broadcast output shape from the input shapes.
@@ -221,44 +176,21 @@ The following functions provide arithmetic while defining requirements such that
[source,c++]
----
-in_t apply_add_s<in_t>(in_t a, in_t b) {
- if (is_floating_point(in_t)) return a + b;
- int64_t c = sign_extend<int64_t>(a) + sign_extend<int64_t>(b);
- REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>);
- return static_cast<in_t>(c);
-}
-
-in_t apply_add_u<in_t>(in_t a, in_t b) {
+in_t apply_add<in_t>(in_t a, in_t b) {
if (is_floating_point(in_t)) return a + b;
- uint64_t c = zero_extend<uint64_t>(a) + zero_extend<uint64_t>(b);
- REQUIRE(c >= minimum_u<in_u_t> && c <= maximum_u<in_u_t>);
- return truncate<in_t>(c);
-}
-
-in_t apply_arith_rshift<in_t>(in_t a, in_t b) {
- int32_t c = sign_extend<int32_t>(a) >> sign_extend<int32_t>(b);
- return static_cast<in_t>(c);
-}
-
-in_t apply_intdiv_s<in_t>(in_t a, in_t b) {
- int64_t c = sign_extend<int64_t>(a) / sign_extend<int64_t>(b);
- REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>);
- return static_cast<in_t>(c);
+ int64_t c = (int64_t)a + (int64_t)b;
+ REQUIRE(c >= minimum<in_t> && c <= maximum<in_t>);
+ return (in_t)c;
}
in_t apply_ceil<in_t>(in_t input) {
return input value rounded up to nearest integer
}
-in_t apply_clip_s<in_t>(in_t value, in_t min_val, in_t max_val) {
- if (is_floating_point(in_t>) {
- REQUIRE(min_val <= max_val);
- }
- else {
- REQUIRE(sign_extend<int64_t>(min_val) <= sign_extend<int64_t>(max_val));
- }
- value = apply_max_s<in_t>(value, min_val);
- value = apply_min_s<in_t>(value, max_val);
+in_t apply_clip<in_t>(in_t value, in_t min_val, in_t max_val) {
+ REQUIRE(min_val <= max_val);
+ value = apply_max(value, min_val);
+ value = apply_min(value, max_val);
return value;
}
@@ -280,37 +212,22 @@ in_t apply_log<in_t>(in_t input) {
return the natural logarithm of input
}
-in_t apply_logical_rshift<in_t>(in_t a, in_t b) {
- uint64_t c = zero_extend<uint32_t>(a) >> zero_extend<uint32_t>(b);
- return static_cast<in_t>(c);
-}
-
-in_t apply_max_s<in_t>(in_t a, in_t b) {
+in_t apply_max<in_t>(in_t a, in_t b) {
if (is_floating_point(in_t)) {
if (isNaN(a) || isNaN(b)) {
return NaN;
}
- if (a >= b) return a; else return b;
}
- // Integer version
- if (sign_extend<int64_t>(a) >= sign_extend<int64_t>(b)) return a; else return b;
+ if (a >= b) return a; else return b;
}
-in_t apply_min_s<in_t>(in_t a, in_t b) {
+in_t apply_min<in_t>(in_t a, in_t b) {
if (is_floating_point(in_t)) {
if (isNaN(a) || isNaN(b)) {
return NaN;
}
- if (a < b) return a; else return b;
}
- // Integer version
- if (sign_extend<int64_t>(a) < sign_extend<int64_t>(b)) return a; else return b;
-}
-
-in_t apply_mul_s<in_t>(in_t a, in_t b) {
- if (is_floating_point(in_t)) return a * b;
- int64_t c = sign_extend<int64_t>(a) * sign_extend<int64_t>(b);
- return static_cast<in_t>(c);
+ if (a < b) return a; else return b;
}
in_t apply_pow<in_t>(in_t a, in_t b) {
@@ -321,17 +238,11 @@ in_t apply_sqrt<in_t>(in_t input) {
return the square root of input
}
-in_t apply_sub_s<in_t>(in_t a, in_t b) {
+in_t apply_sub<in_t>(in_t a, in_t b) {
if (is_floating_point(in_t)) return a - b;
- int64_t c = sign_extend<int64_t>(a) - sign_extend<int64_t>(b);
- REQUIRE(c >= minimum_s<in_t> && c <= maximum_s<in_t>);
- return static_cast<in_t>(c);
-}
-
-in_t apply_sub_u<in_t>(in_t a, in_t b) {
- uint64_t c = zero_extend<uint64_t>(a) - zero_extend<uint64_t>(b);
- REQUIRE(c >= minimum_u<in_u_t> && c <= maximum_u<in_u_t>);
- return truncate<in_t>(c);
+ int64_t c = (int64_t)a - (int64_t)b;
+ REQUIRE(c >= minimum<in_t> && c <= maximum<in_t>);
+ return (in_t)c;
}
int32_t count_leading_zeros(int32_t a) {
@@ -349,69 +260,6 @@ int32_t count_leading_zeros(int32_t a) {
}
----
-==== Type Conversion Helpers
-
-The following definitions indicate the type to be used when the given parameters are provided.
-
-[source,c++]
-----
-
-// Returns a signed version of the given type
-// A no-op for floating-point types
-Type make_signed(Type in_t)
-{
- switch(in_t) {
- case bool_t:
- return bool_t;
- case i8_t:
- return int8_t;
- case i16_t:
- return int16_t;
- case i32_t:
- return int32_t;
- case i48_t:
- return int48_t;
- case fp16_t:
- return fp16_t;
- case bf16_t:
- return bf16_t;
- case fp32_t:
- return fp32_t;
- }
-}
-
-// Returns the usigned type of the given type
-// Error to call this with anything but i8_t or i16_t
-
-Type make_unsigned(Type in_t)
-{
- ERROR_IF(in_t != i8_t && in_t != i16_t);
- switch(in_t) {
- case i8_t:
- return uint8_t;
- case i16_t:
- return uint16_t;
- }
-}
-
-out_t static_cast<out_t>(in_t value)
-{
- // Operates similar to the c++ standard static_cast
- // Limited to simple numeric conversion for TOSA.
- // Sign extends signed integer input types if needed
- // Zero extends unsigned integer input types if needed
- // Truncates when converting to a smaller width data type
- // Conversion from integer to floating-point is exact if possible
- // If converting between signless integer types, treated as signed integer
-}
-
-out_t bitcast<out_t>(in_t value)
-{
- // Treats the bits of value as if they were of type out_t
- // Only supported for integer types of the same bit width
-}
-----
-
==== Numeric Conversion Helpers
The following definitions are used in pseudocode to do numeric conversions.
@@ -428,17 +276,13 @@ float_t round_to_nearest_float(in_t f)
Converts the input value into floating-point, rounding to the nearest representable value.
For the required precision see the section: Main inference precision requirements.
-out_t sign_extend<out_t>(in_t input)
- Floating point values are unchanged.
- For two's complement integer values where out_t has more bits than in_t, replicate the top bit of input for all bits between the top bit of input and the top bit of output.
-
-out_t zero_extend<out_t>(in_t input)
- Floating point values are unchanged.
- For two's complement integer values where out_t has more bits than in_t, insert zero values for all bits between the top bit of input and the top bit of output.
+out_t sign_extend(in_t input)
+ Only valid for two's complement integer values where out_t has more bits than in_t.
+ Output = input
+ Replicate the top bit of input for all bits between the top bit of input and the top bit of output.
out_t truncate(in_t input)
output is the sizeof(out_t) least significant bits in input.
- Nop for floating-point types
----
The following definition is used to flatten a list of lists into a single list.
@@ -500,16 +344,4 @@ float_t cos(angle)
bool power_of_two(int32_t value)
return true if value is a power of two, false otherwise
-
-in_out_t maximum_s<Type T>
- return the maximum value when interpreting type T as a signed value as returned by the make_signed helper.
-
-in_out_t minimum_s<Type T>
- return the minimum value when interpreting type T as a signed value as returned by the make_signed helper.
-
-in_out_t maximum_u<Type T>
- return the maximum value when interpreting type T as an unsigned value as returned by the make_unsigned helper.
-
-in_out_t minimum_u<Type T>
- return the minimum value when interpreting type T as an unsigned value as returned by the make_unsigned helper.
----
diff --git a/chapters/reduction.adoc b/chapters/reduction.adoc
index 8a3ceac..713404c 100644
--- a/chapters/reduction.adoc
+++ b/chapters/reduction.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2023 ARM Limited
+// (C) COPYRIGHT 2020-2021 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
@@ -77,7 +77,7 @@ for_each(index in shape1) {
out_index[axis] = 0;
in_out_t value = tensor_read<in_out_t>(input, shape1, index);
in_out_t state = tensor_read<in_out_t>(output, shape, out_index);
- state = apply_max_s<in_out_t>(state, value);
+ state = apply_max<in_out_t>(state, value);
tensor_write<in_out_t>(output, shape, out_index, state);
}
----
@@ -100,7 +100,7 @@ for_each(index in shape1) {
out_index[axis] = 0;
in_out_t value = tensor_read<in_out_t>(input, shape1, index);
in_out_t state = tensor_read<in_out_t>(output, shape, out_index);
- state = apply_min_s<in_out_t>(state, value);
+ state = apply_min<in_out_t>(state, value);
tensor_write<in_out_t>(output, shape, out_index, state);
}
----
@@ -123,7 +123,7 @@ for_each(index in shape1) {
out_index[axis] = 0;
in_out_t value = tensor_read<in_out_t>(input, shape1, index);
in_out_t state = tensor_read<in_out_t>(output, shape, out_index);
- state = apply_mul_s<in_out_t>(state, value);
+ state = state * value;
tensor_write<in_out_t>(output, shape, out_index, state);
}
----
@@ -146,7 +146,7 @@ for_each(index in shape1) {
out_index[axis] = 0;
in_out_t value = tensor_read<in_out_t>(input, shape1, index);
in_out_t state = tensor_read<in_out_t>(output, shape, out_index);
- state = apply_add_s<in_out_t>(state, value);
+ state = apply_add<in_out_t>(state, value);
tensor_write<in_out_t>(output, shape, out_index, state);
}
----
diff --git a/chapters/tensor_ops.adoc b/chapters/tensor_ops.adoc
index b9d54c1..656af85 100644
--- a/chapters/tensor_ops.adoc
+++ b/chapters/tensor_ops.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2023 ARM Limited
+// (C) COPYRIGHT 2020-2022 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
@@ -31,15 +31,12 @@ if (axis == rank(shape1)-1) {
ERROR_IF(flatten(left_shape, right_shape) != shape);
for_each(left_index in left_shape) {
for_each(right_index in right_shape) {
- in_t max_value = minimum_s<in_t>;
+ in_t max_value = minimum_value<in_t>;
out_t max_index = 0;
for (i = 0; i < shape[axis]; i++) {
dim_t index = flatten(left_index, [i], right_index);
in_t value = tensor_read<in_t>(input, shape1, index);
- if (apply_max_s<in_t>(value, max_value) != max_value) {
- max_value = value;
- max_index = i;
- }
+ if (value > max_value) { max_value = value; max_index = i; }
}
dim_t index = flatten(left_index, right_index);
tensor_write<out_t>(output, shape, index, max_index);
@@ -57,8 +54,8 @@ include::{generated}/operators/AVG_POOL2D.adoc[]
[source,c++]
----
-ERROR_IF(in_out_t != i8_t && input_zp != 0); // Zero point only for int8_t
-ERROR_IF(in_out_t != i8_t && output_zp != 0); // Zero point only for int8_t
+ERROR_IF(in_out_t != int8_t && input_zp != 0); // Zero point only for int8_t
+ERROR_IF(in_out_t != int8_t && output_zp != 0); // Zero point only for int8_t
ERROR_IF(kernel_y < 1 || kernel_x < 1); // kernel size must be >= 1
ERROR_IF(stride_y < 1 || stride_x < 1);
ERROR_IF(pad_top < 0 || pad_bottom < 0 || pad_left < 0 || pad_right < 0);
@@ -82,19 +79,17 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW, 0 <= c < C ) {
// average, padding does not count
if (0 <= y < IH and 0 <= x < IW) {
count++;
- acc_t value = sign_extend<acc_t>(tensor_read<in_out_t>(input, [N,IH,IW,C], [n,y,x,c]));
- value = apply_sub_s<acc_t>(value, sign_extend<acc_t>(input_zp));
- acc = apply_add_s<acc_t>(acc, value);
+ acc_t value = tensor_read<in_out_t>(input, [N,IH,IW,C], [n,y,x,c]);
+ value = value - input_zp;
+ acc = apply_add<acc_t>(acc, value);
}
}
if (is_float(in_out_t)) {
- output_val = acc / static_cast<in_out_t>(count);
+ output_val = acc / (float)count;
} else {
scale_t scale = reciprocal_scale(count);
acc = apply_scale_32(acc, scale.multiplier, scale.shift, false);
- acc = apply_add_s<acc_t>(acc, sign_extend<acc_t>(output_zp));
- acc = apply_clip_s<acc_t>(acc, minimum_s<in_out_t>, maximum_s<in_out_t>);
- output_val = static_cast<in_out_t>(acc);
+ output_val = (in_out_t)apply_clip<acc_t>(acc + output_zp, minimum<in_out_t>, maximum<in_out_t>)
}
tensor_write<in_out_t>(output, [N,OH,OW,C], [n,oy,ox,c], output_val);
}
@@ -108,14 +103,13 @@ include::{generated}/operators/CONV2D.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && input_zp != 0); // Zero point only for int8_t
+ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only for int8_t
ERROR_IF(weight_t != int8_t && weight_zp != 0);
ERROR_IF(pad_top < 0 || pad_bottom < 0 || pad_left < 0 || pad_right < 0);
ERROR_IF(stride_y < 1 || stride_x < 1);
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);
-ERROR_IF(BC != OC && BC != 1);
for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
out_t acc = 0;
@@ -125,18 +119,14 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
index_t y = iy + ky * dilation_y;
index_t x = ix + kx * dilation_x;
if (0 <= y < IH && 0 <= x < IW) {
- out_t value = static_cast<out_t>(tensor_read<in_t>(input,
- [N,IH,IW,IC],
- [n,y,x,ic]));
- out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight,
- [OC,KH,KW,IC],
- [oc,ky,kx,ic]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>(input_zp));
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>(weight_zp));
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
+ out_t value = tensor_read<in_t>(input, [N,IH,IW,IC], [n,y,x,ic]);
+ out_t weight = tensor_read<weight_t>(weight, [OC,KH,KW,IC], [oc,ky,kx,ic]);
+ value = value - input_zp;
+ weight = weight - weight_zp;
+ acc = apply_add<out_t>(acc, value * weight);
}
}
- acc = apply_add_s<out_t>(acc, bias[(BC == 1) ? 0 : oc]);
+ acc = apply_add<out_t>(acc, bias[oc]);
tensor_write<out_t>(output, [N,OH,OW,OC], [n,oy,ox,oc], acc);
}
----
@@ -149,15 +139,14 @@ include::{generated}/operators/CONV3D.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && input_zp != 0); // Zero point only for int8_t
-ERROR_IF(weight_t != i8_t && weight_zp != 0);
+ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only for int8_t
+ERROR_IF(weight_t != int8_t && weight_zp != 0);
ERROR_IF(pad_d0 < 0 || pad_d1 < 0 || pad_top < 0 || pad_bottom < 0 || pad_left < 0 || pad_right < 0);
ERROR_IF(stride_d < 1 || stride_y < 1 || stride_x < 1);
ERROR_IF(dilation_d < 1 || dilation_y < 1 || dilation_x < 1);
ERROR_IF(OD != idiv_check(ID - 1 + pad_d0 + pad_d1 - (KD - 1) * dilation_d, stride_d) + 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);
-ERROR_IF(BC != OC && BC != 1);
for_each(0 <= n < N, 0 <= od < OD, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
out_t acc = 0;
@@ -169,18 +158,14 @@ for_each(0 <= n < N, 0 <= od < OD, 0 <= oy < OH, 0 <= ox < OW; 0 <= oc < OC) {
index_t y = iy + ky * dilation_y;
index_t x = ix + kx * dilation_x;
if (0 <= x < IW && 0 <= y < IH && 0 <= d < ID) {
- out_t value = static_cast<out_t>(tensor_read<in_t>(input,
- [N,ID,IH,IW,IC],
- [n,d,y,x,ic]));
- out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight,
- [OC,KD,KH,KW,IC],
- [oc,kd,ky,kx,ic]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>(input_zp));
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>(weight_zp));
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
+ out_t value = tensor_read<in_t>(input, [N,ID,IH,IW,IC], [n,d,y,x,ic]);
+ out_t weight = tensor_read<weight_t>(weight,[OC,KD,KH,KW,IC],[oc,kd,ky,kx,ic]);
+ value = value - input_zp;
+ weight = weight - weight_zp;
+ acc = apply_add<out_t>(acc, value * weight);
}
}
- acc = apply_add_s<out_t>(acc, bias[(BC == 1) ? 0 : oc]);
+ acc = apply_add<out_t>(acc, bias[oc]);
tensor_write<out_t>(output, [N,OD,OH,OW,OC], [n,od,oy,ox,oc], acc);
}
----
@@ -193,14 +178,13 @@ include::{generated}/operators/DEPTHWISE_CONV2D.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && input_zp != 0); // Zero point only for int8_t
-ERROR_IF(weight_t != i8_t && weight_zp != 0);
+ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only for int8_t
+ERROR_IF(weight_t != int8_t && weight_zp != 0);
ERROR_IF(pad_top < 0 || pad_bottom < 0 || pad_left < 0 || pad_right < 0);
ERROR_IF(stride_y < 1 || stride_x < 1);
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);
-ERROR_IF(BC != C*M && BC != 1);
for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C, 0 <= m < M) {
out_t acc = 0;
@@ -210,18 +194,14 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C, 0 <= m < M) {
index_t y = iy + ky * dilation_y;
index_t x = ix + kx * dilation_x;
if (0 <= y < IH && 0 <= x < IW) {
- out_t value = static_cast<out_t>(tensor_read<in_t>(input,
- [N,IH,IW,C],
- [n,y,x,c]));
- out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight,
- [KH,KW,C,M],
- [ky,kx,c,m]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>input_zp);
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>weight_zp);
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
+ out_t value = tensor_read<in_t>(input, [N,IH,IW,C], [n,y,x,c]);
+ out_t weight = tensor_read<weight_t>(weight, [KH,KW,C,M], [ky,kx,c,m]);
+ value = value - input_zp;
+ weight = weight - weight_zp;
+ acc = apply_add<out_t>(acc, value * weight);
}
}
- acc = apply_add_s<out_t>(acc, bias[(BC == 1) ? 0 : (c * M) + m]);
+ acc = apply_add<out_t>(acc, bias[(c * M) + m]);
tensor_write<out_t>(output, [N,OH,OW,C * M], [n,oy,ox,c * M + m], acc);
}
----
@@ -279,20 +259,18 @@ include::{generated}/operators/FULLY_CONNECTED.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && input_zp != 0); // Zero point only for int8_t
-ERROR_IF(weight_t != i8_t && weight_zp != 0);
-ERROR_IF(BC != OC && BC != 1);
-
+ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only for int8_t
+ERROR_IF(weight_t != int8_t && weight_zp != 0);
for_each(0 <= n < N, 0 <= oc < OC) {
out_t acc = 0;
for_each(0 <= ic < IC) {
- out_t value = static_cast<out_t>(tensor_read<in_t>(input, [N,IC], [n,ic]));
- out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight, [OC,IC], [oc,ic]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>(input_zp));
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>(weight_zp));
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
+ out_t value = tensor_read<in_t>(input, [N,IC], [n,ic]);
+ out_t weight = tensor_read<weight_t>(weight, [OC,IC], [oc,ic]);
+ value = value - input_zp;
+ weight = weight - weight_zp;
+ acc = apply_add<out_t>(acc, value * weight);
}
- acc = apply_add_s<out_t>(acc, bias[(BC == 1) ? 0 : oc]);
+ acc = apply_add<out_t>(acc, bias[oc]);
tensor_write<out_t>(output, [N,OC], [n,oc], acc);
}
----
@@ -305,15 +283,15 @@ include::{generated}/operators/MATMUL.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && (A_zp != 0 || B_zp != 0)); // Zero point only for int8_t
+ERROR_IF(in_t != int8_t && (A_zp != 0 || B_zp != 0)); // Zero point only for int8_t
for_each(0 <= n < N, 0 <= h < H, 0 <= w < W) {
out_t acc = 0;
for_each(0 <= c < C) {
- out_t value1 = static_cast<out_t>(tensor_read<in_t>(A, [N,H,C], [n,h,c]));
- out_t value2 = static_cast<out_t>(tensor_read<in_t>(B, [N,C,W], [n,c,w]));
- value1 = apply_sub_s<out_t>(value1, static_cast<out_t>(A_zp));
- value2 = apply_sub_s<out_t>(value2, static_cast<out_t>(B_zp));
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value1 * value2));
+ out_t value1 = tensor_read<in_t>(A, [N,H,C], [n,h,c]);
+ out_t value2 = tensor_read<in_t>(B, [N,C,W], [n,c,w]);
+ value1 = value1 - A_zp;
+ value2 = value2 - B_zp;
+ acc = apply_add<out_t>(acc, value1 * value2);
}
tensor_write<out_t>(output, [N,H,W], [n,h,w], acc);
}
@@ -346,7 +324,7 @@ for_each(0 <= n < N, 0 <= oy < H, 0 <= ox < W, 0 <= c < C ) {
index_t x = ix + kx;
if (y >= 0 && y < IH && x >= 0 && x < IW) {
in_out_t value = tensor_read<in_out_t>(input, [N,IH,IW,C], [n,y,x,c]);
- acc = apply_max_s<in_out_t>(acc, value);
+ acc = apply_max(acc, value);
}
}
tensor_write<in_out_t>(output, [N,OH,OW,C], [n,oy,ox,c], acc);
@@ -393,29 +371,28 @@ include::{generated}/operators/TRANSPOSE_CONV2D.adoc[]
[source,c++]
----
-ERROR_IF(in_t != i8_t && input_zp != 0); // Zero point only allowed for int8_t
-ERROR_IF(weight_t != i8_t && weight_zp != 0);
+ERROR_IF(in_t != int8_t && input_zp != 0); // Zero point only allowed for int8_t
+ERROR_IF(weight_t != int8_t && weight_zp != 0);
ERROR_IF(out_pad_top <= -KH || out_pad_bottom <= -KH);
ERROR_IF(out_pad_left <= -KW || out_pad_right <= -KW);
ERROR_IF(stride_y < 1 || stride_x < 1);
ERROR_IF(OH != (IH - 1) * stride_y + out_pad_top + out_pad_bottom + KH);
ERROR_IF(OW != (IW - 1) * stride_x + out_pad_left + out_pad_right + KW);
-ERROR_IF(BC != OC && BC != 1);
for_each(index in out_shape) {
- tensor_write<out_t>(output, [N,OH,OW,OC], index, bias[(BC == 1) ? 0 : index[3]])
+ tensor_write<out_t>(output, [N,OH,OW,OC], index, bias[index[3]])
}
for_each(0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= oc < OC,
0 <= ic < IC, 0 <= ky < KH, 0 <= kx < KW) {
index_t oy = iy * stride_y + out_pad_top + ky;
index_t ox = ix * stride_x + out_pad_left + kx;
if (oy >= 0 && oy < OH && ox >= 0 && ox < OW) {
- out_t acc = static_cast<out_t>(tensor_read<out_t>(output, [N,OH,OW,OC], [n,oy,ox,oc]));
- out_t value = static_cast<out_t>(tensor_read<in_t>(input, [N,IH,IW,IC], [n,iy,ix,ic]));
- out_t weight = static_cast<out_t>(tensor_read<weight_t>(weight, [OC,KH,KW,IC], [oc,ky,kx,ic]));
- value = apply_sub_s<out_t>(value, static_cast<out_t>(input_zp));
- weight = apply_sub_s<out_t>(weight, static_cast<out_t>(weight_zp));
- acc = apply_add_s<out_t>(acc, apply_mul_s<out_t>(value, weight));
+ out_t acc = tensor_read<out_t>(output, [N,OH,OW,OC], [n,oy,ox,oc]);
+ out_t value = tensor_read<in_t>(input, [N,IH,IW,IC], [n,iy,ix,ic]);
+ out_t weight = tensor_read<weight_t>(weight, [OC,KH,KW,IC], [oc,ky,kx,ic]);
+ value = value - input_zp;
+ weight = weight - weight_zp;
+ acc = apply_add<out_t>(acc, value * weight);
tensor_write<out_t>(output, [N,OH,OW,OC], [n,oy,ox,oc], acc);
}
}
diff --git a/chapters/type_conversion.adoc b/chapters/type_conversion.adoc
index 90aca2d..415c5d9 100644
--- a/chapters/type_conversion.adoc
+++ b/chapters/type_conversion.adoc
@@ -1,7 +1,7 @@
//
// This confidential and proprietary software may be used only as
// authorised by a licensing agreement from ARM Limited
-// (C) COPYRIGHT 2020-2023 ARM Limited
+// (C) COPYRIGHT 2020-2022 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
@@ -29,7 +29,7 @@ for_each(index in shape) {
} else if (in_t == fp16_t || in_t == bf16_t || in_t == fp32_t) {
out = apply_clip<out_t>(round_to_nearest_int(in), minimum<out_t>, maximum<out_t>);
} else if (sizeof(out_t) >= sizeof(in_t)) {
- out = sign_extend<out_t>(in);
+ out = sign_extend(in);
} else {
out = truncate(in);
}
@@ -49,49 +49,24 @@ for_each(index in shape) {
// uint16 values can have zero_point 0 or 32768
// int8/uint8 can have zero point within their valid range
// No other types can have zero point != 0
- ERROR_IF(in_t != i8_t &&
- (in_t != i16_t || input_unsigned == False) && input_zp != 0);
- ERROR_IF(out_t != i8_t &&
- (out_t != i16_t || output_unsigned == False) && output_zp != 0);
- ERROR_IF(in_t == i16_t && input_unsigned == True && input_zp != 0 && input_zp != 32768);
- ERROR_IF(out_t == i16_t && output_unsigned == True && output_zp != 0 && output_zp != 32768);
- ERROR_IF(scale32 && in_t == i48_t);
+ ERROR_IF(in_t != int8_t &&
+ in_t != uint8_t &&
+ in_t != uint16_t && input_zp != 0);
+ 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(scale32 && in_t == int48_t);
ERROR_IF(!scale32 && double_round);
- ERROR_IF(in_t == i16_t && out_t == i32_t && input_unsigned);
- ERROR_IF(in_t == i32_t && out_t == i16_t && output_unsigned);
-
- in_t in_value = tensor_read<in_t>(input, shape, index);
-
- int48_t value, extended_in_zp;
- if (input_unsigned) {
- value = zero_extend<int48_t>(in_value);
- extended_in_zp = zero_extend<int48_t>(input_zp);
- }
- else {
- value = sign_extend<int48_t>(value);
- extended_in_zp = sign_extend<int48_t>(input_zp);
- }
-
- value = value - extended_in_zp;
+ int48_t value = tensor_read<in_t>(input, shape, index);
+ value = value - input_zp;
int c = (per_channel) ? index[rank(input) - 1] : 0;
int32_t result = (scale32) ?
apply_scale_32(value, multiplier[c], shift[c], double_round) :
apply_scale_16(value, multiplier[c], shift[c]);
-
- if (output_unsigned) {
- int32_t extended_out_zp = zero_extend<int32_t>(output_zp);
- result = apply_add_s<int32_t>(result, extended_out_zp);
- out_t out = static_cast<out_t>(apply_clip<int32_t>(result,
- minimum_u<out_t>,
- maximum_u<out_t>));
- }
- else {
- int32_t extended_out_zp = sign_extend<int32_t>(output_zp);
- result = apply_add_s<int32_t>(result, extended_out_zp);
- out_t out = static_cast<out_t>(apply_clip<int32_t>(result,
- minimum_s<out_t>,
- maximum_s<out_t>));
- }
+ result = apply_add<int32_t>(result, output_zp);
+ out_t out = (out_t)apply_clip<int32_t>(result, minimum<out_t>, maximum<out_t>);
tensor_write<out_t>(output, shape, index, out);
}
----
diff --git a/chapters/variable.adoc b/chapters/variable.adoc
deleted file mode 100644
index 1f7da51..0000000
--- a/chapters/variable.adoc
+++ /dev/null
@@ -1,106 +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.
-
-=== Variable Operators
-
-TOSA implements three variable operators for expressing persistent mutable values across multiple TOSA graph invocations.
-
-==== VARIABLE
-
-Defines a new TOSA variable.
-This is a persistent mutable value across multiple TOSA graph invocations.
-Modifications are expressed using read/write semantics.
-
-include::{generated}/operators/VARIABLE.adoc[]
-
-[source,c++]
-----
-
-tensor_t var_tensor = variable_tensor_lookup(uid);
-
-// Invocation for the first time
-if (var_tensor == NULL) {
- // Allocate the persistent mutable memory for the variable tensor
- tensor_t var_tensor = variable_tensor_allocate<var_t>(var_shape, uid);
-
- if (initial_value != NULL) {
- REQUIRE(var_t == in_t);
- REQUIRE(var_shape == shape);
- for_each (index in shape) {
- // Copy data from initial_value to var_tensor
- in_t value = tensor_read<in_t>(initial_value, shape, index);
- tensor_write<in_t>(var_tensor.data, var_shape, index, value);
- }
- var_tensor.is_written = true;
- }
-} else { // Variable tensor has already been declared
- // It's invalid to declare the second variable with the same uid in a single graph execution,
- REQUIRE(!var_tensor.seen);
-}
-
-var_tensor.seen = true;
-
-----
-
-==== VARIABLE_WRITE
-
-Assigns a value to the pseudo-buffer resource holding a persistent mutable tensor.
-
-include::{generated}/operators/VARIABLE_WRITE.adoc[]
-
-[source,c++]
-----
-
-tensor_t. variable_tensor = variable_tensor_lookup(uid);
-// Check this variable tensor has been declared
-REQUIRE(variable_tensor);
-// The tensor has to be seen before to be written to
-// The seen variable is cleared before each graph execution and set in declaration
-REQUIRE(variable_tensor.seen);
-// Input tensor's shape and variable_tensor's shape have to match
-REQUIRE(variable_tensor.shape == shape);
-// Input tensor's shape and variable_tensor's type have to match
-REQUIRE(variable_tensor.type == in_t);
-
-for_each (index in shape) {
- // Write data from the input to the pseudo-buffer resource
- in_t value = tensor_read<in_t>(input1, shape, index);
- tensor_write<tensor_t>(variable_tensor.data, variable_tensor.shape, index, value);
-}
-
-variable_tensor.is_written = true;
-
-----
-
-==== VARIABLE_READ
-
-Reads the value from a pseudo-buffer resource holding a persistent mutable tensor.
-
-include::{generated}/operators/VARIABLE_READ.adoc[]
-
-[source,c++]
-----
-
-tensor_t variable_tensor = variable_tensor_lookup(uid);
-// Check this variable tensor has been decalred
-REQUIRE(variable_tensor != NULL);
-// Check this variable tensor has been written
-REQUIRE(variable_tensor.is_written);
-// Output tensor's shape and variable_tensor's shape have to match
-REQUIRE(variable_tensor.shape == shape);
-// Output tensor's shape and variable_tensor's type have to match
-REQUIRE(variable_tensor.type == out_t);
-
-for_each (index in shape) {
- // Read data from pseudo-buffer resource to the output
- out_t value = tensor_read<tensor_t>(variable_tensor.data, variable_tensor.shape, index);
- tensor_write<out_t>(input1, shape, index, value);
-}
-
-----
diff --git a/figures/erf.svg b/figures/erf.svg
deleted file mode 100644
index bb63a46..0000000
--- a/figures/erf.svg
+++ /dev/null
@@ -1,145 +0,0 @@
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="132.246123pt" height="31.600781pt" viewBox="0 0 132.246123 31.600781" 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.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="glyph0-2">
-<path style="stroke:none;" d="M 6.328125 -6.234375 L 6.03125 -4.6875 L 5.40625 -4.6875 C 5.414062 -4.757812 5.421875 -4.832031 5.421875 -4.90625 C 5.421875 -5.101562 5.375 -5.257812 5.28125 -5.375 C 5.15625 -5.53125 4.945312 -5.609375 4.65625 -5.609375 C 4.125 -5.609375 3.679688 -5.421875 3.328125 -5.046875 C 2.972656 -4.679688 2.726562 -4.15625 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.210938 -5.550781 3.546875 -5.867188 3.921875 -6.078125 C 4.296875 -6.296875 4.71875 -6.40625 5.1875 -6.40625 C 5.363281 -6.40625 5.546875 -6.390625 5.734375 -6.359375 C 5.921875 -6.328125 6.117188 -6.285156 6.328125 -6.234375 Z M 6.328125 -6.234375 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-3">
-<path style="stroke:none;" d="M 5.984375 -7.640625 L 5.40625 -7.640625 C 5.425781 -7.722656 5.4375 -7.800781 5.4375 -7.875 C 5.4375 -8.0625 5.390625 -8.207031 5.296875 -8.3125 C 5.160156 -8.46875 4.9375 -8.546875 4.625 -8.546875 C 4.226562 -8.546875 3.925781 -8.429688 3.71875 -8.203125 C 3.507812 -7.984375 3.347656 -7.59375 3.234375 -7.03125 L 3.078125 -6.234375 L 4.828125 -6.234375 L 4.703125 -5.609375 L 2.953125 -5.609375 L 1.796875 0.390625 C 1.660156 1.085938 1.378906 1.613281 0.953125 1.96875 C 0.523438 2.320312 -0.0390625 2.5 -0.75 2.5 L -0.671875 1.921875 C -0.265625 1.921875 0.0351562 1.8125 0.234375 1.59375 C 0.441406 1.363281 0.601562 0.960938 0.71875 0.390625 L 1.875 -5.609375 L 0.84375 -5.609375 L 0.96875 -6.234375 L 2 -6.234375 L 2.15625 -7.015625 C 2.289062 -7.710938 2.570312 -8.234375 3 -8.578125 C 3.4375 -8.941406 4.003906 -9.125 4.703125 -9.125 C 4.960938 -9.125 5.21875 -9.097656 5.46875 -9.046875 C 5.71875 -9.003906 5.96875 -8.929688 6.21875 -8.828125 Z M 5.984375 -7.640625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph0-4">
-<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-5">
-<path style="stroke:none;" d="M -0.109375 0 L 0 -0.625 L 0.984375 -0.625 L 1.953125 -5.609375 L 0.921875 -5.609375 L 1.03125 -6.234375 L 8.0625 -6.234375 L 7.9375 -5.609375 L 6.921875 -5.609375 L 5.953125 -0.625 L 6.90625 -0.625 L 6.796875 0 L 3.8125 0 L 3.9375 -0.625 L 4.859375 -0.625 L 5.84375 -5.609375 L 3.03125 -5.609375 L 2.0625 -0.625 L 3 -0.625 L 2.875 0 Z M -0.109375 0 "/>
-</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 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="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.53125 -6.65625 L 0.875 -6.65625 L 0.875 -8.21875 C 1.289062 -8.445312 1.710938 -8.617188 2.140625 -8.734375 C 2.566406 -8.847656 2.984375 -8.90625 3.390625 -8.90625 C 4.296875 -8.90625 5.007812 -8.679688 5.53125 -8.234375 C 6.0625 -7.796875 6.328125 -7.203125 6.328125 -6.453125 C 6.328125 -5.585938 5.734375 -4.5625 4.546875 -3.375 C 4.453125 -3.28125 4.378906 -3.210938 4.328125 -3.171875 L 2.125 -0.96875 L 5.765625 -0.96875 L 5.765625 -2.046875 L 6.453125 -2.046875 L 6.453125 0 L 0.8125 0 L 0.8125 -0.640625 L 3.46875 -3.28125 C 4.050781 -3.875 4.46875 -4.414062 4.71875 -4.90625 C 4.96875 -5.394531 5.09375 -5.910156 5.09375 -6.453125 C 5.09375 -7.035156 4.9375 -7.492188 4.625 -7.828125 C 4.320312 -8.160156 3.90625 -8.328125 3.375 -8.328125 C 2.8125 -8.328125 2.378906 -8.1875 2.078125 -7.90625 C 1.773438 -7.632812 1.59375 -7.21875 1.53125 -6.65625 Z M 1.53125 -6.65625 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-0">
-<path style="stroke:none;" d="M 1.5 0 L 1.5 -7.03125 L 7.5 -7.03125 L 7.5 0 Z M 7.3125 -0.1875 L 7.3125 -6.84375 L 1.6875 -6.84375 L 1.6875 -0.1875 Z M 7.3125 -0.1875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph3-1">
-<path style="stroke:none;" d="M 5.09375 13.046875 L 2.375 7.140625 L 1.53125 7.75 L 1.3125 7.546875 L 3.03125 6.296875 L 5.5625 11.828125 L 11.796875 -0.34375 C 11.835938 -0.414062 11.90625 -0.453125 12 -0.453125 C 12.0625 -0.453125 12.113281 -0.425781 12.15625 -0.375 C 12.207031 -0.332031 12.234375 -0.28125 12.234375 -0.21875 C 12.234375 -0.1875 12.234375 -0.160156 12.234375 -0.140625 L 5.53125 12.953125 C 5.5 13.015625 5.4375 13.046875 5.34375 13.046875 Z M 5.09375 13.046875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-0">
-<path style="stroke:none;" d="M 1.5 0 L 1.5 -7.5 L 7.5 -7.5 L 7.5 0 Z M 7.3125 -0.1875 L 7.3125 -7.3125 L 1.6875 -7.3125 L 1.6875 -0.1875 Z M 7.3125 -0.1875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph4-1">
-<path style="stroke:none;" d="M 1.265625 26.046875 C 1.472656 26.242188 1.71875 26.34375 2 26.34375 C 2.289062 26.34375 2.554688 26.144531 2.796875 25.75 C 3.035156 25.351562 3.242188 24.859375 3.421875 24.265625 C 3.597656 23.671875 3.726562 23.171875 3.8125 22.765625 C 3.894531 22.367188 4 21.859375 4.125 21.234375 C 4.238281 20.640625 4.347656 20.046875 4.453125 19.453125 C 4.566406 18.859375 4.675781 18.222656 4.78125 17.546875 C 4.894531 16.878906 5.015625 16.203125 5.140625 15.515625 C 5.265625 14.828125 5.40625 14.09375 5.5625 13.3125 C 5.769531 12.289062 5.914062 11.5625 6 11.125 C 6.09375 10.6875 6.234375 10.050781 6.421875 9.21875 C 6.609375 8.382812 6.734375 7.835938 6.796875 7.578125 C 6.859375 7.316406 7.03125 6.597656 7.3125 5.421875 L 7.484375 4.78125 C 7.660156 4.082031 7.796875 3.550781 7.890625 3.1875 C 7.992188 2.832031 8.144531 2.390625 8.34375 1.859375 C 8.550781 1.335938 8.789062 0.894531 9.0625 0.53125 C 9.34375 0.175781 9.648438 0 9.984375 0 C 10.222656 0 10.441406 0.0507812 10.640625 0.15625 C 10.835938 0.257812 11 0.40625 11.125 0.59375 C 11.25 0.78125 11.3125 0.988281 11.3125 1.21875 C 11.3125 1.394531 11.253906 1.539062 11.140625 1.65625 C 11.023438 1.769531 10.882812 1.828125 10.71875 1.828125 C 10.539062 1.828125 10.394531 1.769531 10.28125 1.65625 C 10.164062 1.539062 10.109375 1.394531 10.109375 1.21875 C 10.109375 1.050781 10.164062 0.90625 10.28125 0.78125 C 10.394531 0.664062 10.539062 0.609375 10.71875 0.609375 C 10.507812 0.410156 10.269531 0.3125 10 0.3125 C 9.851562 0.3125 9.6875 0.523438 9.5 0.953125 C 9.320312 1.390625 9.160156 1.898438 9.015625 2.484375 C 8.867188 3.078125 8.753906 3.566406 8.671875 3.953125 C 8.585938 4.347656 8.488281 4.84375 8.375 5.4375 C 8.25 6.101562 8.140625 6.679688 8.046875 7.171875 C 7.960938 7.671875 7.859375 8.285156 7.734375 9.015625 C 7.609375 9.753906 7.484375 10.453125 7.359375 11.109375 C 7.242188 11.765625 7.101562 12.507812 6.9375 13.34375 C 6.832031 13.863281 6.679688 14.597656 6.484375 15.546875 C 6.285156 16.492188 6.148438 17.109375 6.078125 17.390625 C 6.015625 17.679688 5.851562 18.378906 5.59375 19.484375 C 5.332031 20.597656 5.191406 21.1875 5.171875 21.25 L 5.03125 21.796875 C 4.820312 22.648438 4.613281 23.394531 4.40625 24.03125 C 4.195312 24.675781 3.890625 25.273438 3.484375 25.828125 C 3.078125 26.390625 2.582031 26.671875 2 26.671875 C 1.65625 26.671875 1.347656 26.550781 1.078125 26.3125 C 0.804688 26.082031 0.671875 25.796875 0.671875 25.453125 C 0.671875 25.273438 0.726562 25.128906 0.84375 25.015625 C 0.96875 24.898438 1.113281 24.84375 1.28125 24.84375 C 1.394531 24.84375 1.5 24.867188 1.59375 24.921875 C 1.6875 24.972656 1.757812 25.046875 1.8125 25.140625 C 1.863281 25.234375 1.890625 25.335938 1.890625 25.453125 C 1.890625 25.628906 1.828125 25.769531 1.703125 25.875 C 1.585938 25.988281 1.441406 26.046875 1.265625 26.046875 Z M 1.265625 26.046875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph5-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="glyph5-1">
-<path style="stroke:none;" d="M 2.703125 -0.296875 C 3.128906 -0.296875 3.445312 -0.523438 3.65625 -0.984375 C 3.863281 -1.453125 3.96875 -2.15625 3.96875 -3.09375 C 3.96875 -4.039062 3.863281 -4.742188 3.65625 -5.203125 C 3.445312 -5.671875 3.128906 -5.90625 2.703125 -5.90625 C 2.285156 -5.90625 1.96875 -5.671875 1.75 -5.203125 C 1.539062 -4.742188 1.4375 -4.039062 1.4375 -3.09375 C 1.4375 -2.15625 1.539062 -1.453125 1.75 -0.984375 C 1.96875 -0.523438 2.285156 -0.296875 2.703125 -0.296875 Z M 2.703125 0.125 C 2.035156 0.125 1.507812 -0.15625 1.125 -0.71875 C 0.75 -1.289062 0.5625 -2.082031 0.5625 -3.09375 C 0.5625 -4.113281 0.75 -4.90625 1.125 -5.46875 C 1.507812 -6.03125 2.035156 -6.3125 2.703125 -6.3125 C 3.378906 -6.3125 3.90625 -6.03125 4.28125 -5.46875 C 4.664062 -4.90625 4.859375 -4.113281 4.859375 -3.09375 C 4.859375 -2.082031 4.664062 -1.289062 4.28125 -0.71875 C 3.90625 -0.15625 3.378906 0.125 2.703125 0.125 Z M 2.703125 0.125 "/>
-</symbol>
-<symbol overflow="visible" id="glyph5-2">
-<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="glyph6-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="glyph6-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>
-<symbol overflow="visible" id="glyph6-2">
-<path style="stroke:none;" d="M 1.140625 -3.96875 L 0.46875 -3.96875 L 0.546875 -4.421875 L 1.234375 -4.421875 L 1.5 -5.796875 L 2.265625 -5.796875 L 2 -4.421875 L 3.4375 -4.421875 L 3.34375 -3.96875 L 1.90625 -3.96875 L 1.359375 -1.171875 C 1.316406 -0.953125 1.296875 -0.78125 1.296875 -0.65625 C 1.296875 -0.5625 1.304688 -0.492188 1.328125 -0.453125 C 1.378906 -0.347656 1.503906 -0.296875 1.703125 -0.296875 C 1.898438 -0.296875 2.054688 -0.351562 2.171875 -0.46875 C 2.285156 -0.582031 2.367188 -0.773438 2.421875 -1.046875 L 3 -1.046875 C 2.90625 -0.640625 2.738281 -0.34375 2.5 -0.15625 C 2.269531 0.03125 1.957031 0.125 1.5625 0.125 C 1.113281 0.125 0.816406 0.0234375 0.671875 -0.171875 C 0.585938 -0.296875 0.546875 -0.46875 0.546875 -0.6875 C 0.546875 -0.820312 0.5625 -0.984375 0.59375 -1.171875 Z M 1.140625 -3.96875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph7-0">
-<path style="stroke:none;" d="M 0.40625 1.421875 L 0.40625 -5.640625 L 4.40625 -5.640625 L 4.40625 1.421875 Z M 0.84375 0.96875 L 3.953125 0.96875 L 3.953125 -5.1875 L 0.84375 -5.1875 Z M 0.84375 0.96875 "/>
-</symbol>
-<symbol overflow="visible" id="glyph7-1">
-<path style="stroke:none;" d="M 1.03125 -4.4375 L 0.59375 -4.4375 L 0.59375 -5.484375 C 0.863281 -5.628906 1.140625 -5.738281 1.421875 -5.8125 C 1.710938 -5.894531 1.992188 -5.9375 2.265625 -5.9375 C 2.867188 -5.9375 3.34375 -5.789062 3.6875 -5.5 C 4.039062 -5.207031 4.21875 -4.804688 4.21875 -4.296875 C 4.21875 -3.722656 3.820312 -3.039062 3.03125 -2.25 C 2.96875 -2.1875 2.921875 -2.140625 2.890625 -2.109375 L 1.421875 -0.640625 L 3.84375 -0.640625 L 3.84375 -1.359375 L 4.3125 -1.359375 L 4.3125 0 L 0.546875 0 L 0.546875 -0.421875 L 2.3125 -2.1875 C 2.707031 -2.582031 2.988281 -2.941406 3.15625 -3.265625 C 3.320312 -3.597656 3.40625 -3.941406 3.40625 -4.296875 C 3.40625 -4.691406 3.300781 -5 3.09375 -5.21875 C 2.882812 -5.4375 2.601562 -5.546875 2.25 -5.546875 C 1.875 -5.546875 1.582031 -5.453125 1.375 -5.265625 C 1.175781 -5.085938 1.0625 -4.8125 1.03125 -4.4375 Z M 1.03125 -4.4375 "/>
-</symbol>
-</g>
-</defs>
-<g id="surface1">
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-1" x="0.15625" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-2" x="7.207031" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-3" x="15.609375" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-1" x="21.539062" y="9.240381"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-4" x="27.273438" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph1-2" x="34.761719" y="9.240381"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph2-1" x="41.410156" 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 55.53125 -3.760805 L 75.953125 -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="62.105469" y="8.904297"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph3-1" x="54.210938" y="18.555184"/>
-</g>
-<path style="fill:none;stroke-width:0.6;stroke-linecap:round;stroke-linejoin:miter;stroke:rgb(0%,0%,0%);stroke-opacity:1;stroke-miterlimit:10;" d="M 66.152344 -0.194398 L 75.652344 -0.194398 " transform="matrix(1,0,0,1,0,18.600648)"/>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-5" x="67.222656" y="28.267578"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph4-1" x="77.28125" y="1.505859"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph5-1" x="84.664062" y="29.505859"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph6-1" x="89.710938" y="5.513672"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-1" x="95.019531" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph5-2" x="103.152344" y="12.947266"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph6-2" x="109.871094" y="12.947266"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph7-1" x="113.679688" y="10.273438"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-6" x="118.863281" y="18.599609"/>
-</g>
-<g style="fill:rgb(0%,0%,0%);fill-opacity:1;">
- <use xlink:href="#glyph0-7" x="126.738281" y="18.599609"/>
-</g>
-</g>
-</svg>
diff --git a/tools/dictionary.dic b/tools/dictionary.dic
index 6b83c53..da2e28c 100644
--- a/tools/dictionary.dic
+++ b/tools/dictionary.dic
@@ -14,7 +14,6 @@ CLZ
concat
CONCAT
COND
-config
conformant
const
CONST
@@ -23,8 +22,6 @@ CPUs
denormalizing
DEPTHWISE
Elementwise
-ERF
-erf
FFT
fft
fp
@@ -68,7 +65,6 @@ RSQRT
sigmoid
Sigmoid
SIGMOID
-signless
SIMD
subtensor
svg
@@ -81,8 +77,6 @@ tosa
TOSA
TOSASETS
TPUs
-uint
ulp
unary
Unary
-uid
diff --git a/tools/genspec.py b/tools/genspec.py
index b8e961b..11a3e72 100755
--- a/tools/genspec.py
+++ b/tools/genspec.py
@@ -1,11 +1,8 @@
#!/usr/bin/env python3
-# Copyright (c) 2023, ARM Limited.
-# SPDX-License-Identifier: Apache-2.0
import os
import tosa
-
class TOSASpecAsciidocGenerator:
def __init__(self, spec):
self.spec = spec
@@ -39,29 +36,28 @@ class TOSASpecAsciidocGenerator:
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"
+ 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)
+ 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]}"
+ if (arg.rank[0] == arg.rank[1]):
+ rank = f'{arg.rank[0]}'
else:
- rank = f"{arg.rank[0]} to {arg.rank[1]}"
+ rank = f'{arg.rank[0]} to {arg.rank[1]}'
else:
rank = ""
# Format and write line
file.write(
- f"|{cattext}|{argtype}|{arg.name}|{arg.shape}"
- f"|{rank}|{arg.description}\n"
+ f"|{cattext}|{argtype}|{arg.name}|{arg.shape}|{rank}|{arg.description}\n"
)
file.write("|===\n")
@@ -84,10 +80,10 @@ class TOSASpecAsciidocGenerator:
file.write("\n*Operation Function:*\n\n")
leveltext = ""
for arg in op.arguments:
- if len(arg.levellimits) > 0:
+ if (len(arg.levellimits) > 0):
for limit in arg.levellimits:
- leveltext += "LEVEL_CHECK(" + limit[0] + " <= " + limit[1] + ");\n"
- if len(leveltext) > 0:
+ leveltext += "LEVEL_CHECK(" + limit[0] + " <= " + limit[1] + ");\n"
+ if (len(leveltext) > 0):
file.write(f"[source,c++]\n----\n{leveltext}\n----\n")
def generate(self, outdir):
@@ -97,29 +93,29 @@ class TOSASpecAsciidocGenerator:
major = self.spec.version_major
minor = self.spec.version_minor
patch = self.spec.version_patch
- with open(os.path.join(outdir, "version.adoc"), "w") as f:
- f.write(":tosa-version-string: {}.{}.{}".format(major, minor, patch))
+ with open(os.path.join(outdir, "version.adoc"), 'w') as f:
+ f.write(':tosa-version-string: {}.{}.{}'.format(major, minor, patch))
if self.spec.version_is_draft:
- f.write(" draft")
- f.write("\n")
+ 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")
+ 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")
+ 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")
+ f.write('|{}'.format(level.desc))
+ f.write('\n')
for param in self.spec.levels[0].maximums:
- f.write("|{}".format(param))
+ f.write('|{}'.format(param))
for level in self.spec.levels:
- f.write("|{}".format(level.maximums[param]))
- f.write("\n")
- f.write("|===\n")
+ f.write('|{}'.format(level.maximums[param]))
+ f.write('\n')
+ f.write('|===\n')
# Generator operators
opdir = os.path.join(outdir, "operators")
@@ -128,11 +124,10 @@ 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:
+ 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
diff --git a/tools/tosa.py b/tools/tosa.py
index 803e478..d01d9c2 100644
--- a/tools/tosa.py
+++ b/tools/tosa.py
@@ -1,64 +1,42 @@
-#!/usr/bin/env python3
-# Copyright (c) 2023, ARM Limited.
-# SPDX-License-Identifier: Apache-2.0
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:
+ if '[' not in shape or '[]' in shape:
return (False, -1)
# Check for fixed rank requirement [N]
- m = re.match(r"\[(\d+)\]", shape)
+ m = re.match(r'\[(\d+)\]', shape)
if m:
return (True, 1)
# Check for comma separated rank descriptors, return count
- m = re.match(r"\[(.*)\]", shape)
+ m = re.match(r'\[(.*)\]', shape)
if m:
- return (True, len(m.group(1).split(",")))
+ return (True, len(m.group(1).split(',')))
else:
- raise RuntimeError(f"Unable to parse shape {shape}")
-
+ 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,
- optional=False,
- ):
- assert isinstance(optional, bool)
+ def __init__(self, name, description, categories, ty, elty, shape, levellimits, rank):
self.name = name
self.description = description
self.categories = categories
@@ -67,7 +45,6 @@ class TOSAOperatorArgument:
self.shape = shape
self.levellimits = levellimits
self.rank = rank
- self.optional = optional
class TOSAOperatorDataTypeSupport:
@@ -123,12 +100,11 @@ class TOSASpec:
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"),
- "MAX_NESTING": level.get("max_nesting"),
+ '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)
@@ -173,28 +149,18 @@ class TOSASpec:
shape = arg.get("shape")
levellimits = []
rank = []
- optional = arg.get("optional", "false") == "true"
r = arg.find("rank")
- if r is not None:
- rank = [r.get("min"), r.get("max")]
- if shape == "-" and (rank[0] != "0" or rank[1] != "0"):
- raise RuntimeError(
- "rank is not empty or non-zero, but shape is '-'"
- f" for {op_name}: {name}"
- )
+ 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(
- "Description of shape rank doesn't match XML rank"
- f" min/max: {op_name} {name} shape: {shape} shape_rank: "
- f"{shape_rank} min/max: {rank[0]} {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}"
- )
+ 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")
@@ -206,9 +172,7 @@ class TOSASpec:
for cat in cats:
argcats.append(TOSAOperatorArgumentCategory(cat[0], cat[1].split(",")))
- return TOSAOperatorArgument(
- name, desc, argcats, argtype, argtelty, shape, levellimits, rank, optional
- )
+ return TOSAOperatorArgument(name, desc, argcats, argtype, argtelty, shape, levellimits, rank)
def __load_enum(self, arg):
name = arg.get("name")
diff --git a/tosa.xml b/tosa.xml
index 65e900c..16b8219 100644
--- a/tosa.xml
+++ b/tosa.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE tosa SYSTEM "tosa.dtd">
<tosa>
- <version major="0" minor="80" patch="0" draft="false"/>
+ <version major="0" minor="70" 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" max_nesting="256">No level</level>
- <level name="8K" max_rank="6" max_kernel="8192" max_stride="8192" max_scale="256" max_log2_size="31" max_nesting="6">Level 8K</level>
+ <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>
</levels>
<operators>
<operatorgroup name="tensor">
@@ -21,7 +21,7 @@
<levellimit value="rank(shape1)" limit="MAX_RANK"/>
<rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <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>
@@ -34,17 +34,17 @@
<type name='in_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8" in_t="i8_t" out_t="i32_t"/>
- <typesupport mode="signed 16" in_t="i16_t" out_t="i32_t" />
- <typesupport mode="fp16" in_t="fp16_t" out_t="i32_t">
+ <typesupport mode="signed 8" in_t="int8_t" out_t="int32_t"/>
+ <typesupport mode="signed 16" in_t="int16_t" out_t="int32_t" />
+ <typesupport mode="fp16" in_t="fp16_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16" in_t="bf16_t" out_t="i32_t">
+ <typesupport mode="bf16" in_t="bf16_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32" in_t="fp32_t" out_t="i32_t">
+ <typesupport mode="fp32" in_t="fp32_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -56,19 +56,19 @@
<description>Input tensor</description>
<rank min="4" max="4"/>
</argument>
- <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="i32_t">
+ <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
@@ -97,8 +97,8 @@
<type name='in_out_t' />
<type name='acc_t' />
</types>
- <typesupport mode="signed 8 with int32 accumulate" in_out_t="i8_t" acc_t="i32_t" />
- <typesupport mode="signed 16 with int32 accumulate" in_out_t="i16_t" acc_t="i32_t" />
+ <typesupport mode="signed 8 with int32 accumulate" in_out_t="int8_t" acc_t="int32_t" />
+ <typesupport mode="signed 16 with int32 accumulate" in_out_t="int16_t" acc_t="int32_t" />
<typesupport mode="fp16 with fp16 accumulate" in_out_t="fp16_t" acc_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -129,11 +129,11 @@
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
<rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[BC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
<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="i32_t">
+ <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
@@ -141,13 +141,13 @@
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="dilation" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<description>[dilation_y, dilation_x]</description>
<rank min="1" max="1"/>
</argument>
@@ -159,14 +159,6 @@
<description>Weight zero point. Must be zero for non-int8 types.</description>
<rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="local_bound" type="tensor_t" shape="-" tensor-element-type="bool_t" optional="true">
- <description>
- This optional attribute affects the floating-point compliance error bound.
- The default of false allows for direct and transform based, fast convolution algorithms.
- Only set to true if direct dot-product calculation precision is required.
- </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">
<description>Output tensor</description>
<rank min="4" max="4"/>
@@ -177,9 +169,9 @@
<type name='weight_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" weight_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 8x4 with int32 accumulate" in_t="i8_t" weight_t="i4_t" out_t="i32_t" />
- <typesupport mode="signed 16x8 with int48 accumulate" in_t="i16_t" weight_t="i8_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" weight_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 8x4 with int32 accumulate" in_t="int8_t" weight_t="int4_t" out_t="int32_t" />
+ <typesupport mode="signed 16x8 with int48 accumulate" in_t="int16_t" weight_t="int8_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" weight_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -211,11 +203,11 @@
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
<rank min="5" max="5"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[BC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
<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="i32_t">
+ <argument category="attribute" name="pad" type="tensor_t" shape="[6]" tensor-element-type="int32_t">
<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"/>
@@ -225,14 +217,14 @@
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[3]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="dilation" type="tensor_t" shape="[3]" tensor-element-type="int32_t">
<description>[dilation_d, dilation_y, dilation_x]</description>
<rank min="1" max="1"/>
</argument>
@@ -244,14 +236,6 @@
<description>Weight zero point. Must be zero for non-int8 types.</description>
<rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="local_bound" type="tensor_t" shape="-" tensor-element-type="bool_t" optional="true">
- <description>
- This optional attribute affects the floating-point compliance error bound.
- The default of false allows for direct and transform based, fast convolution algorithms.
- Only set to true if direct dot-product calculation precision is required.
- </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">
<description>Output tensor</description>
<rank min="5" max="5"/>
@@ -262,9 +246,9 @@
<type name='weight_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" weight_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 8x4 with int32 accumulate" in_t="i8_t" weight_t="i4_t" out_t="i32_t" />
- <typesupport mode="signed 16x8 with int48 accumulate" in_t="i16_t" weight_t="i8_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" weight_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 8x4 with int32 accumulate" in_t="int8_t" weight_t="int4_t" out_t="int32_t" />
+ <typesupport mode="signed 16x8 with int48 accumulate" in_t="int16_t" weight_t="int8_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" weight_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -295,11 +279,11 @@
<levellimit value="dilation_x * KW" limit="MAX_KERNEL"/>
<rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[BC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="tensor_t" shape="[C*M]" tensor-element-type="out_t">
<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="i32_t">
+ <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
@@ -307,13 +291,13 @@
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="dilation" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<description>[dilation_y, dilation_x]</description>
<rank min="1" max="1"/>
</argument>
@@ -325,14 +309,6 @@
<description>Weight zero point. Must be zero for non-int8 types.</description>
<rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="local_bound" type="tensor_t" shape="-" tensor-element-type="bool_t" optional="true">
- <description>
- This optional attribute affects the floating-point compliance error bound.
- The default of false allows for direct and transform based, fast convolution algorithms.
- Only set to true if direct dot-product calculation precision is required.
- </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">
<description>Output tensor</description>
<rank min="4" max="4"/>
@@ -343,9 +319,9 @@
<type name='weight_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" weight_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 8x4 with int32 accumulate" in_t="i8_t" weight_t="i4_t" out_t="i32_t" />
- <typesupport mode="signed 16x8 with int48 accumulate" in_t="i16_t" weight_t="i8_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" weight_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 8x4 with int32 accumulate" in_t="int8_t" weight_t="int4_t" out_t="int32_t" />
+ <typesupport mode="signed 16x8 with int48 accumulate" in_t="int16_t" weight_t="int8_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" weight_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -384,14 +360,6 @@
<description>Real part of the complex output.</description>
<rank min="3" max="3"/>
</argument>
- <argument category="attribute" name="local_bound" type="tensor_t" shape="-" tensor-element-type="bool_t" optional="true">
- <description>
- This optional attribute affects the floating-point compliance error bound.
- The default of false allows for direct and transform based, fast convolution algorithms.
- Only set to true if direct dot-product calculation precision is required.
- </description>
- <rank min="0" max="0"/>
- </argument>
<argument category="output" name="output_imag" type="tensor_t" shape="[N,H,W]" tensor-element-type="in_out_t">
<description>Imaginary part of the complex output.</description>
<rank min="3" max="3"/>
@@ -412,11 +380,11 @@
<description>Input tensor</description>
<rank min="2" max="2"/>
</argument>
- <argument category="input" name="weight" type="tensor_t" shape="[OC,IC]" tensor-element-type="weight_t">
+ <argument category="attribute" name="weight" type="tensor_t" shape="[OC,IC]" tensor-element-type="weight_t">
<description>Weights</description>
<rank min="2" max="2"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[BC]" tensor-element-type="out_t">
+ <argument category="attribute" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
<description>Per output channel bias data.</description>
<rank min="1" max="1"/>
</argument>
@@ -438,9 +406,9 @@
<type name='weight_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" weight_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 8x4 with int32 accumulate" in_t="i8_t" weight_t="i4_t" out_t="i32_t" />
- <typesupport mode="signed 16x8 with int48 accumulate" in_t="i16_t" weight_t="i8_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" weight_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 8x4 with int32 accumulate" in_t="int8_t" weight_t="int4_t" out_t="int32_t" />
+ <typesupport mode="signed 16x8 with int48 accumulate" in_t="int16_t" weight_t="int8_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" weight_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -486,8 +454,8 @@
<type name='in_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 16x16 with int48 accumulate" in_t="i16_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 16x16 with int48 accumulate" in_t="int16_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -512,19 +480,19 @@
<description>Input tensor 4D</description>
<rank min="4" max="4"/>
</argument>
- <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="i32_t">
+ <argument category="attribute" name="kernel" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<description>[pad_top, pad_bottom, pad_left, pad_right]</description>
<levellimit value="pad_top" limit="MAX_KERNEL"/>
<levellimit value="pad_bottom" limit="MAX_KERNEL"/>
@@ -540,8 +508,8 @@
<types>
<type name='in_out_t' />
</types>
- <typesupport mode="signed 8" in_out_t="i8_t" />
- <typesupport mode="signed 16" in_out_t="i16_t" />
+ <typesupport mode="signed 8" in_out_t="int8_t" />
+ <typesupport mode="16-bit" in_out_t="int16_t" />
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -594,11 +562,11 @@
<levellimit value="KW" limit="MAX_KERNEL"/>
<rank min="4" max="4"/>
</argument>
- <argument category="input" name="bias" type="tensor_t" shape="[BC]" tensor-element-type="out_t">
+ <argument category="input" name="bias" type="tensor_t" shape="[OC]" tensor-element-type="out_t">
<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="i32_t">
+ <argument category="attribute" name="out_pad" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<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"/>
@@ -606,13 +574,13 @@
<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="i32_t">
+ <argument category="attribute" name="stride" type="tensor_t" shape="[2]" tensor-element-type="int32_t">
<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="i32_t">
+ <argument category="attribute" name="out_shape" type="tensor_t" shape="[4]" tensor-element-type="int32_t">
<description>[N,OH,OW,OC]</description>
<rank min="1" max="1"/>
</argument>
@@ -624,14 +592,6 @@
<description>Weight zero point. Must be zero for non-int8 types.</description>
<rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="local_bound" type="tensor_t" shape="-" tensor-element-type="bool_t" optional="true">
- <description>
- This optional attribute affects the floating-point compliance error bound.
- The default of false allows for direct and transform based, fast convolution algorithms.
- Only set to true if direct dot-product calculation precision is required.
- </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">
<description>Output tensor</description>
<rank min="4" max="4"/>
@@ -642,9 +602,9 @@
<type name='weight_t' />
<type name='out_t' />
</types>
- <typesupport mode="signed 8x8 with int32 accumulate" in_t="i8_t" weight_t="i8_t" out_t="i32_t" />
- <typesupport mode="signed 8x4 with int32 accumulate" in_t="i8_t" weight_t="i4_t" out_t="i32_t" />
- <typesupport mode="signed 16x8 with int48 accumulate" in_t="i16_t" weight_t="i8_t" out_t="i48_t" />
+ <typesupport mode="signed 8x8 with int32 accumulate" in_t="int8_t" weight_t="int8_t" out_t="int32_t" />
+ <typesupport mode="signed 8x4 with int32 accumulate" in_t="int8_t" weight_t="int4_t" out_t="int32_t" />
+ <typesupport mode="signed 16x8 with int48 accumulate" in_t="int16_t" weight_t="int8_t" out_t="int48_t" />
<typesupport mode="fp16 with fp16 accumulate" in_t="fp16_t" weight_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -688,37 +648,8 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="fp16" in_out_t="fp16_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- <typesupport mode="bf16" in_out_t="bf16_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- <typesupport mode="fp32" in_out_t="fp32_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- </operator>
- <operator>
- <name>ERF</name>
- <arguments>
- <argument category="input" name="input" type="tensor_t" shape="shape" tensor-element-type="in_out_t">
- <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">
- <description>Output tensor of same type and shape as input</description>
- <rank min="0" max="MAX_RANK"/>
- </argument>
- </arguments>
- <types>
- <type name='in_out_t'/>
- </types>
+ <typesupport mode="signed 8" in_out_t="int8_t"/>
+ <typesupport mode="signed 16" in_out_t="int16_t"/>
<typesupport mode="fp16" in_out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -812,8 +743,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
- <typesupport mode="shape" in_out_t="shape_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -851,9 +781,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>BITWISE_AND</name>
@@ -875,9 +805,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>BITWISE_OR</name>
@@ -899,9 +829,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>BITWISE_XOR</name>
@@ -923,9 +853,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>INTDIV</name>
@@ -947,8 +877,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
- <typesupport mode="shape" in_out_t="shape_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
</operator>
<operator>
<name>LOGICAL_AND</name>
@@ -992,9 +921,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>LOGICAL_RIGHT_SHIFT</name>
@@ -1016,9 +945,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>LOGICAL_OR</name>
@@ -1084,7 +1013,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -1118,7 +1047,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -1143,8 +1072,8 @@
<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="i8_t">
- <description>Result right shift (i32_t data type only)</description>
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="tensor_t" shape="-" tensor-element-type="int8_t">
+ <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">
@@ -1157,10 +1086,9 @@
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="signed 8" in_t="i8_t" out_t="i32_t"/>
- <typesupport mode="signed 16" in_t="i16_t" out_t="i32_t"/>
- <typesupport mode="signed 32" in_t="i32_t" out_t="i32_t"/>
- <typesupport mode="shape" in_t="shape_t" out_t="shape_t"/>
+ <typesupport mode="signed 8" in_t="int8_t" out_t="int32_t"/>
+ <typesupport mode="signed 16" in_t="int16_t" out_t="int32_t"/>
+ <typesupport mode="signed 32" in_t="int32_t" out_t="int32_t"/>
<typesupport mode="fp16" in_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1227,8 +1155,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
- <typesupport mode="shape" in_out_t="shape_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -1265,8 +1192,8 @@
<type name='out_t'/>
<type name='TABLE_SIZE'/>
</types>
- <typesupport mode="signed 8" in_t="i8_t" table_t="i8_t" TABLE_SIZE="256" out_t="i8_t"/>
- <typesupport mode="signed 16" in_t="i16_t" table_t="i16_t" TABLE_SIZE="513" out_t="i32_t"/>
+ <typesupport mode="signed 8" in_t="int8_t" table_t="int8_t" TABLE_SIZE="256" out_t="int8_t"/>
+ <typesupport mode="signed 16" in_t="int16_t" table_t="int16_t" TABLE_SIZE="513" out_t="int32_t"/>
</operator>
</operatorgroup>
<operatorgroup name="elementwise-unary">
@@ -1286,7 +1213,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -1316,9 +1243,9 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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"/>
</operator>
<operator>
<name>CEIL</name>
@@ -1365,7 +1292,7 @@
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
</operator>
<operator>
<name>EXP</name>
@@ -1497,9 +1424,9 @@
<type name='in_out_t'/>
<type name='acc_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t" acc_t="i32_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t" acc_t="i32_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t" acc_t="i32_t"/>
+ <typesupport mode="signed 8" in_out_t="int8_t" acc_t="int32_t"/>
+ <typesupport mode="signed 16" in_out_t="int16_t" acc_t="int32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t" acc_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t" acc_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1598,9 +1525,9 @@
<type name='in_out_t'/>
</types>
<typesupport mode="Boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -1637,7 +1564,7 @@
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="signed 32" in_t="i32_t" out_t="bool_t"/>
+ <typesupport mode="signed 32" in_t="int32_t" out_t="bool_t"/>
<typesupport mode="fp16" in_t="fp16_t" out_t="bool_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1672,7 +1599,7 @@
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="signed 32" in_t="i32_t" out_t="bool_t"/>
+ <typesupport mode="signed 32" in_t="int32_t" out_t="bool_t"/>
<typesupport mode="fp16" in_t="fp16_t" out_t="bool_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1707,7 +1634,7 @@
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="signed 32" in_t="i32_t" out_t="bool_t"/>
+ <typesupport mode="signed 32" in_t="int32_t" out_t="bool_t"/>
<typesupport mode="fp16" in_t="fp16_t" out_t="bool_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1728,15 +1655,15 @@
<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="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1749,15 +1676,15 @@
<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="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1770,23 +1697,23 @@
<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="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -1805,23 +1732,23 @@
<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="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -1840,15 +1767,15 @@
<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="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
@@ -1872,21 +1799,21 @@
<arguments>
<argument category="input" name="input" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
<description>Input tensor with rank from 1 to 4</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<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">
<description>Output tensor. Same rank as the input tensor.</description>
- <rank min="1" max="MAX_RANK"/>
+ <rank min="1" max="4"/>
</argument>
</arguments>
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <typesupport mode="signed 32" in_out_t="int32_t"/>
<typesupport mode="fp16" in_out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -1907,9 +1834,9 @@
<arguments>
<argument category="input" name="input1" type="tensor_list_t" shape="shapes1" tensor-element-type="in_out_t">
<description>List of input tensors. All inputs must have the same rank and data type</description>
- <rank min="0" max="MAX_RANK"/>
+ <rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<description>Axis along which concatenation is to occur, in range from 0 to rank(shape)-1</description>
<rank min="0" max="0"/>
</argument>
@@ -1923,10 +1850,9 @@
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
- <typesupport mode="shape" in_out_t="shape_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -1947,7 +1873,7 @@
<description>Input tensor</description>
<rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="input" name="padding" type="tensor_t" shape="[rank(shape1),2]" tensor-element-type="shape_t">
+ <argument category="attribute" name="padding" type="tensor_t" shape="[rank(shape1),2]" tensor-element-type="int32_t">
<description>Number of pad elements at the start and end of each dimension</description>
<rank min="2" max="2"/>
</argument>
@@ -1965,9 +1891,9 @@
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -1982,43 +1908,6 @@
</typesupport>
</operator>
<operator>
- <name>DIM</name>
- <arguments>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_t">
- <description>Input tensor</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="i32_t">
- <description>Axis in range from 0 to rank(shape) - 1</description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="output" name="output" type="tensor_t" shape="-" tensor-element-type="shape_t" >
- <description>Output rank 0 tensor giving the size of the shape for the given axis</description>
- <rank min="0" max="0"/>
- </argument>
- </arguments>
- <types>
- <type name='in_t'/>
- </types>
- <typesupport mode="boolean" in_t="bool_t"/>
- <typesupport mode="signed 8" in_t="i8_t"/>
- <typesupport mode="signed 16" in_t="i16_t"/>
- <typesupport mode="signed 32" in_t="i32_t"/>
- <typesupport mode="fp16" in_t="fp16_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- <typesupport mode="bf16" in_t="bf16_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- <typesupport mode="fp32" in_t="fp32_t">
- <profile name="MI"/>
- <profile name="MT"/>
- </typesupport>
- </operator>
- <operator>
<name>RESHAPE</name>
<arguments>
<argument category="input" name="input1" type="tensor_t" shape="shape1" tensor-element-type="in_out_t">
@@ -2026,8 +1915,8 @@
<levellimit value="rank(shape1)" limit="MAX_RANK"/>
<rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="input" name="shape" type="tensor_t" shape="[rank(shape)]" tensor-element-type="shape_t">
- <description>1D shape tensor giving the new shape.</description>
+ <argument category="attribute" name="new_shape" type="tensor_t" shape="[rank(shape)]" tensor-element-type="int32_t">
+ <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">
@@ -2040,9 +1929,9 @@
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2064,7 +1953,7 @@
<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="i32_t">
+ <argument category="attribute" name="axis" type="tensor_t" shape="-" tensor-element-type="int32_t">
<description>Axis to reverse, in range from 0 to rank(shape)-1</description>
<rank min="0" max="0"/>
</argument>
@@ -2077,10 +1966,9 @@
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
- <typesupport mode="shape" in_out_t="shape_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2120,9 +2008,9 @@ used.</description>
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2143,7 +2031,7 @@ used.</description>
<description>Input tensor</description>
<rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="input" name="multiples" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="shape_t">
+ <argument category="attribute" name="multiples" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="int32_t">
<description>Number of times to replicate input1 in each dimension</description>
<rank min="1" max="1"/>
</argument>
@@ -2157,9 +2045,9 @@ used.</description>
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2180,7 +2068,7 @@ used.</description>
<description>Input tensor</description>
<rank min="1" max="MAX_RANK"/>
</argument>
- <argument category="attribute" name="perms" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="i32_t">
+ <argument category="attribute" name="perms" type="tensor_t" shape="[rank(shape1)]" tensor-element-type="int32_t">
<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>
@@ -2194,9 +2082,9 @@ used.</description>
<type name='in_out_t'/>
</types>
<typesupport mode="boolean" in_out_t="bool_t"/>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2231,9 +2119,9 @@ used.</description>
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2270,9 +2158,9 @@ used.</description>
<types>
<type name='in_out_t'/>
</types>
- <typesupport mode="signed 8" in_out_t="i8_t"/>
- <typesupport mode="signed 16" in_out_t="i16_t"/>
- <typesupport mode="signed 32" in_out_t="i32_t"/>
+ <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">
<profile name="MI"/>
<profile name="MT"/>
@@ -2295,17 +2183,17 @@ used.</description>
<description>Input tensor</description>
<rank min="4" max="4"/>
</argument>
- <argument category="input" name="scale" type="tensor_t" shape="[4]" tensor-element-type="shape_t">
+ <argument category="attribute" name="scale" type="tensor_t" shape="[4]" tensor-element-type="int16_t">
<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="input" name="offset" type="tensor_t" shape="[2]" tensor-element-type="shape_t">
+ <argument category="attribute" name="offset" type="tensor_t" shape="[2]" tensor-element-type="int16_t">
<description>[offset_y, offset_x]</description>
<rank min="1" max="1"/>
</argument>
- <argument category="input" name="border" type="tensor_t" shape="[2]" tensor-element-type="shape_t">
+ <argument category="attribute" name="border" type="tensor_t" shape="[2]" tensor-element-type="int16_t">
<description>[border_y, border_x]</description>
<rank min="1" max="1"/>
</argument>
@@ -2323,10 +2211,10 @@ used.</description>
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="signed 8, bilinear" resize_t="i16_t" in_t="i8_t" out_t="i32_t"/>
- <typesupport mode="signed 8, nearest" resize_t="i16_t" in_t="i8_t" out_t="i8_t"/>
- <typesupport mode="signed 16, bilinear" resize_t="i16_t" in_t="i16_t" out_t="i48_t"/>
- <typesupport mode="signed 16, nearest" resize_t="i16_t" in_t="i16_t" out_t="i16_t"/>
+ <typesupport mode="signed 8, bilinear" resize_t="int16_t" in_t="int8_t" out_t="int32_t"/>
+ <typesupport mode="signed 8, nearest" resize_t="int16_t" in_t="int8_t" out_t="int8_t"/>
+ <typesupport mode="signed 16, bilinear" resize_t="int16_t" in_t="int16_t" out_t="int48_t"/>
+ <typesupport mode="signed 16, nearest" resize_t="int16_t" in_t="int16_t" out_t="int16_t"/>
<typesupport mode="fp16" resize_t="fp16_t" in_t="fp16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
@@ -2359,63 +2247,63 @@ used.</description>
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="bool to signed 8" in_t="bool_t" out_t="i8_t"/>
- <typesupport mode="bool to signed 16" in_t="bool_t" out_t="i16_t"/>
- <typesupport mode="bool to signed 32" in_t="bool_t" out_t="i32_t"/>
- <typesupport mode="signed 8 to bool" in_t="i8_t" out_t="bool_t"/>
- <typesupport mode="signed 8 to signed 16" in_t="i8_t" out_t="i16_t"/>
- <typesupport mode="signed 8 to signed 32" in_t="i8_t" out_t="i32_t"/>
- <typesupport mode="signed 8 to fp16" in_t="i8_t" out_t="fp16_t">
+ <typesupport mode="bool to signed 8" in_t="bool_t" out_t="int8_t"/>
+ <typesupport mode="bool to signed 16" in_t="bool_t" out_t="int16_t"/>
+ <typesupport mode="bool to signed 32" in_t="bool_t" out_t="int32_t"/>
+ <typesupport mode="signed 8 to bool" in_t="int8_t" out_t="bool_t"/>
+ <typesupport mode="signed 8 to signed 16" in_t="int8_t" out_t="int16_t"/>
+ <typesupport mode="signed 8 to signed 32" in_t="int8_t" out_t="int32_t"/>
+ <typesupport mode="signed 8 to fp16" in_t="int8_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 8 to bf16" in_t="i8_t" out_t="bf16_t">
+ <typesupport mode="signed 8 to bf16" in_t="int8_t" out_t="bf16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 8 to fp32" in_t="i8_t" out_t="fp32_t">
+ <typesupport mode="signed 8 to fp32" in_t="int8_t" out_t="fp32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 16 to bool" in_t="i16_t" out_t="bool_t"/>
- <typesupport mode="signed 16 to signed 8" in_t="i16_t" out_t="i8_t"/>
- <typesupport mode="signed 16 to signed 32" in_t="i16_t" out_t="i32_t"/>
- <typesupport mode="signed 16 to fp16" in_t="i16_t" out_t="fp16_t">
+ <typesupport mode="signed 16 to bool" in_t="int16_t" out_t="bool_t"/>
+ <typesupport mode="signed 16 to signed 8" in_t="int16_t" out_t="int8_t"/>
+ <typesupport mode="signed 16 to signed 32" in_t="int16_t" out_t="int32_t"/>
+ <typesupport mode="signed 16 to fp16" in_t="int16_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 16 to bf16" in_t="i16_t" out_t="bf16_t">
+ <typesupport mode="signed 16 to bf16" in_t="int16_t" out_t="bf16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 16 to fp32" in_t="i16_t" out_t="fp32_t">
+ <typesupport mode="signed 16 to fp32" in_t="int16_t" out_t="fp32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 32 to bool" in_t="i32_t" out_t="bool_t"/>
- <typesupport mode="signed 32 to signed 8" in_t="i32_t" out_t="i8_t"/>
- <typesupport mode="signed 32 to signed 16" in_t="i32_t" out_t="i16_t"/>
- <typesupport mode="signed 32 to fp16" in_t="i32_t" out_t="fp16_t">
+ <typesupport mode="signed 32 to bool" in_t="int32_t" out_t="bool_t"/>
+ <typesupport mode="signed 32 to signed 8" in_t="int32_t" out_t="int8_t"/>
+ <typesupport mode="signed 32 to signed 16" in_t="int32_t" out_t="int16_t"/>
+ <typesupport mode="signed 32 to fp16" in_t="int32_t" out_t="fp16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 32 to bf16" in_t="i32_t" out_t="bf16_t">
+ <typesupport mode="signed 32 to bf16" in_t="int32_t" out_t="bf16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="signed 32 to fp32" in_t="i32_t" out_t="fp32_t">
+ <typesupport mode="signed 32 to fp32" in_t="int32_t" out_t="fp32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16 to signed 8" in_t="bf16_t" out_t="i8_t">
+ <typesupport mode="bf16 to signed 8" in_t="bf16_t" out_t="int8_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16 to signed 16" in_t="bf16_t" out_t="i16_t">
+ <typesupport mode="bf16 to signed 16" in_t="bf16_t" out_t="int16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="bf16 to signed 32" in_t="bf16_t" out_t="i32_t">
+ <typesupport mode="bf16 to signed 32" in_t="bf16_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -2423,15 +2311,15 @@ used.</description>
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp16 to signed 8" in_t="fp16_t" out_t="i8_t">
+ <typesupport mode="fp16 to signed 8" in_t="fp16_t" out_t="int8_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp16 to signed 16" in_t="fp16_t" out_t="i16_t">
+ <typesupport mode="fp16 to signed 16" in_t="fp16_t" out_t="int16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp16 to signed 32" in_t="fp16_t" out_t="i32_t">
+ <typesupport mode="fp16 to signed 32" in_t="fp16_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -2439,15 +2327,15 @@ used.</description>
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32 to signed 8" in_t="fp32_t" out_t="i8_t">
+ <typesupport mode="fp32 to signed 8" in_t="fp32_t" out_t="int8_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32 to signed 16" in_t="fp32_t" out_t="i16_t">
+ <typesupport mode="fp32 to signed 16" in_t="fp32_t" out_t="int16_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
- <typesupport mode="fp32 to signed 32" in_t="fp32_t" out_t="i32_t">
+ <typesupport mode="fp32 to signed 32" in_t="fp32_t" out_t="int32_t">
<profile name="MI"/>
<profile name="MT"/>
</typesupport>
@@ -2473,23 +2361,23 @@ used.</description>
<rank min="0" max="MAX_RANK"/>
</argument>
<argument category="attribute" name="input_zp" type="tensor_t" shape="-" tensor-element-type="in_t">
- <description>Input tensor zero point. int8/uint8 can have zero point within their valid range. uint16 zero point must be either 0 or 32768. All other types must have zero point equal to 0.</description>
+ <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">
- <description>Output tensor zero point.int8/uint8 can have zero point within their valid range. uint16 zero point must be either 0 or 32768. All other types must have zero point equal to 0.</description>
+ <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">
<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="i8_t">
+ <argument category="input(MT)|attribute(BI,MI)" name="shift" type="tensor_t" shape="[NC]" tensor-element-type="int8_t">
<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">
- <description>if (scale32) mul_t=i32_t else mul_t=i16_t</description>
+ <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">
@@ -2500,31 +2388,29 @@ used.</description>
<description>if (per_channel) NC=shape[rank(shape)-1] else NC=1</description>
<rank min="0" max="0"/>
</argument>
- <argument category="attribute" name="input_unsigned" type="tensor_t" shape="-" tensor-element-type="bool_t">
- <description>If True, treat the input values as unsigned.</description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="attribute" name="output_unsigned" type="tensor_t" shape="-" tensor-element-type="bool_t">
- <description>If True, treat the output values as unsigned.</description>
- <rank min="0" max="0"/>
- </argument>
</arguments>
<types>
<type name='in_t'/>
<type name='out_t'/>
</types>
- <typesupport mode="8-bit to 8-bit" in_t="i8_t" out_t="i8_t"/>
- <typesupport mode="8-bit to 16-bit" in_t="i8_t" out_t="i16_t"/>
- <typesupport mode="8-bit to 32-bit" in_t="i8_t" out_t="i32_t"/>
- <typesupport mode="16-bit to 8-bit" in_t="i16_t" out_t="i8_t"/>
- <typesupport mode="16-bit to 16-bit" in_t="i16_t" out_t="i16_t"/>
- <typesupport mode="16-bit to 32-bit" in_t="i16_t" out_t="i32_t"/>
- <typesupport mode="32-bit to 8-bit" in_t="i32_t" out_t="i8_t"/>
- <typesupport mode="32-bit to 16-bit" in_t="i32_t" out_t="i16_t"/>
- <typesupport mode="32-bit to 32-bit" in_t="i32_t" out_t="i32_t"/>
- <typesupport mode="48-bit to 8-bit" in_t="i48_t" out_t="i8_t"/>
- <typesupport mode="48-bit to 16-bit" in_t="i48_t" out_t="i16_t"/>
- <typesupport mode="48-bit to 32-bit" in_t="i48_t" out_t="i32_t"/>
+ <typesupport mode="signed 8 to signed 8" in_t="int8_t" out_t="int8_t"/>
+ <typesupport mode="signed 8 to signed 16" in_t="int8_t" out_t="int16_t"/>
+ <typesupport mode="signed 8 to signed 32" in_t="int8_t" out_t="int32_t"/>
+ <typesupport mode="signed 8 to unsigned 8" in_t="int8_t" out_t="uint8_t"/>
+ <typesupport mode="signed 16 to signed 8" in_t="int16_t" out_t="int8_t"/>
+ <typesupport mode="signed 16 to signed 16" in_t="int16_t" out_t="int16_t"/>
+ <typesupport mode="signed 16 to signed 32" in_t="int16_t" out_t="int32_t"/>
+ <typesupport mode="signed 16 to unsigned 8" in_t="int16_t" out_t="uint8_t"/>
+ <typesupport mode="signed 16 to unsigned 16" in_t="int16_t" out_t="uint16_t"/>
+ <typesupport mode="signed 32 to signed 8" in_t="int32_t" out_t="int8_t"/>
+ <typesupport mode="signed 32 to signed 16" in_t="int32_t" out_t="int16_t"/>
+ <typesupport mode="signed 32 to signed 32" in_t="int32_t" out_t="int32_t"/>
+ <typesupport mode="signed 48 to signed 8" in_t="int48_t" out_t="int8_t"/>
+ <typesupport mode="signed 48 to signed 16" in_t="int48_t" out_t="int16_t"/>
+ <typesupport mode="signed 48 to signed 32" in_t="int48_t" out_t="int32_t"/>
+ <typesupport mode="unsigned 8 to signed 8" in_t="uint8_t" out_t="int8_t"/>
+ <typesupport mode="unsigned 8 to signed 16" in_t="uint8_t" out_t="int16_t"/>
+ <typesupport mode="unsigned 16 to signed 16" in_t="uint16_t" out_t="int16_t"/>
</operator>
</operatorgroup>
<operatorgroup name="data-node">
@@ -2544,12 +2430,10 @@ used.</description>
<type name='out_t' />
</types>
<typesupport mode="Boolean" out_t="bool_t" />
- <typesupport mode="4-bit" out_t="i4_t" />
- <typesupport mode="8-bit" out_t="i8_t" />
- <typesupport mode="16-bit" out_t="i16_t" />
- <typesupport mode="32-bit" out_t="i32_t" />
- <typesupport mode="48-bit" out_t="i48_t" />
- <typesupport mode="shape" out_t="shape_t" />
+ <typesupport mode="signed 8" out_t="int8_t" />
+ <typesupport mode="signed 16" out_t="int16_t" />
+ <typesupport mode="signed 32" out_t="int32_t" />
+ <typesupport mode="signed 48" out_t="int48_t" />
<typesupport mode="fp16" out_t="fp16_t" >
<profile name="MI"/>
<profile name="MT"/>
@@ -2579,9 +2463,9 @@ used.</description>
<type name='in_out_t' />
</types>
<typesupport mode="Boolean" in_out_t="bool_t" />
- <typesupport mode="8-bit" in_out_t="i8_t" />
- <typesupport mode="16-bit" in_out_t="i16_t" />
- <typesupport mode="32-bit" in_out_t="i32_t" />
+ <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" >
<profile name="MI"/>
<profile name="MT"/>
@@ -2596,30 +2480,6 @@ used.</description>
</typesupport>
</operator>
</operatorgroup>
- <operatorgroup name="custom">
- <operator>
- <name>CUSTOM</name>
- <arguments>
- <argument category="input" name="input_list" type="tensor_list_t" shape="-" tensor-element-type="-">
- <description>List of input tensors</description>
- </argument>
- <argument category="attribute" name="operator" type="String" shape="-" tensor-element-type="-">
- <description>String which tells the backend which custom operator is being called</description>
- </argument>
- <argument category="attribute" name="domain" type="String" shape="-" tensor-element-type="-">
- <description>String idenifier which can help avoid name collisions on the operator field.
- Different implementations of a given operator would be in different domains.
- Implementations can choose which domains they want to support.</description>
- </argument>
- <argument category="attribute" name="implementation_attrs" type="String" shape="-" tensor-element-type="-">
- <description>String value containing implementation specific attributes which apply to the operation</description>
- </argument>
- <argument category="output" name="output_list" type="tensor_list_t" shape="-" tensor-element-type="-">
- <description>List of output tensors</description>
- </argument>
- </arguments>
- </operator>
- </operatorgroup>
<operatorgroup name="control-flow">
<operator>
<name>COND_IF</name>
@@ -2660,58 +2520,6 @@ used.</description>
</arguments>
</operator>
</operatorgroup>
- <operatorgroup name="variable">
- <operator>
- <name>VARIABLE</name>
- <arguments>
- <argument category="attribute" name="uid" type="tensor_t" shape="-" tensor-element-type="i32_t">
- <description>Globally unique identifier for the declared variable tensor.</description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="attribute" name="var_shape" type="tensor_t" shape="var_shape" tensor-element-type="index_t">
- <description>The variable tensor shape</description>
- <rank min="1" max="1"/>
- </argument>
- <argument category="attribute" name="type" type="tensor_t" shape="-" tensor-element-type="var_t">
- <description>Type of the tensor variable elements.</description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="attribute" name="initial_value" type="tensor_t" shape="shape" tensor-element-type="in_t" optional="true">
- <description>Initial value of the variable tensor. This argument is optional with default value NULL.</description>
- <levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
- </argument>
- </arguments>
- </operator>
- <operator>
- <name>VARIABLE_WRITE</name>
- <arguments>
- <argument category="attribute" name="uid" type="tensor_t" shape="-" tensor-element-type="i32_t">
- <description>Globally unique identifier of the variable tensor that is writing to</description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="input" name="input1" type="tensor_t" shape="shape" tensor-element-type="in_t">
- <description>Input tensor</description>
- <levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
- </argument>
- </arguments>
- </operator>
- <operator>
- <name>VARIABLE_READ</name>
- <arguments>
- <argument category="attribute" name="uid" type="tensor_t" shape="-" tensor-element-type="i32_t">
- <description>Globally unique identifier of the variable tensor that is reading from </description>
- <rank min="0" max="0"/>
- </argument>
- <argument category="output" name="output1" type="tensor_t" shape="shape" tensor-element-type="out_t">
- <description>Output tensor</description>
- <levellimit value="rank(shape)" limit="MAX_RANK"/>
- <rank min="0" max="MAX_RANK"/>
- </argument>
- </arguments>
- </operator>
- </operatorgroup>
</operators>
<enum name="resize_mode_t" description="Valid resize types">
@@ -2725,15 +2533,4 @@ used.</description>
<enumval value="2" name="FP32" description="32-bit floating-point"/>
</enum>
- <enum name="var_t" description="Variable tensor data type">
- <enumval value="0" name="BOOLEAN" description="Boolean"/>
- <enumval value="1" name="INT8" description="8-bit integer"/>
- <enumval value="2" name="INT16" description="16-bit integer"/>
- <enumval value="3" name="INT32" description="32-bit integer"/>
- <enumval value="4" name="FP16" description="16-bit floating-point"/>
- <enumval value="5" name="BF16" description="16-bit brain floating-point"/>
- <enumval value="6" name="FP32" description="32-bit floating-point"/>
- </enum>
-
</tosa>
-
diff --git a/tosa.xsd b/tosa.xsd
index c4af523..40fd613 100644
--- a/tosa.xsd
+++ b/tosa.xsd
@@ -25,7 +25,6 @@
<xs:enumeration value="MAX_SCALE"/>
<xs:enumeration value="MAX_RANK"/>
<xs:enumeration value="MAX_LOG2_SIZE"/>
- <xs:enumeration value="MAX_NESTING"/>
</xs:restriction>
</xs:simpleType>
@@ -33,15 +32,16 @@
<xs:restriction base="xs:string">
<xs:enumeration value="-"/>
<xs:enumeration value="bool_t"/>
- <xs:enumeration value="i4_t"/>
- <xs:enumeration value="i8_t"/>
- <xs:enumeration value="i16_t"/>
- <xs:enumeration value="i32_t"/>
- <xs:enumeration value="i48_t"/>
+ <xs:enumeration value="int4_t"/>
+ <xs:enumeration value="int8_t"/>
+ <xs:enumeration value="uint8_t"/>
+ <xs:enumeration value="int16_t"/>
+ <xs:enumeration value="uint16_t"/>
+ <xs:enumeration value="int32_t"/>
+ <xs:enumeration value="int48_t"/>
<xs:enumeration value="fp16_t"/>
<xs:enumeration value="bf16_t"/>
<xs:enumeration value="fp32_t"/>
- <xs:enumeration value="shape_t"/>
</xs:restriction>
</xs:simpleType>
@@ -64,7 +64,6 @@
<xs:enumeration value="index_t"/>
<xs:enumeration value="mul_t"/>
<xs:enumeration value="TABLE_SIZE"/>
- <xs:enumeration value="var_t"/>
</xs:restriction>
</xs:simpleType>
@@ -82,7 +81,6 @@
<xs:enumeration value="tensor_t"/>
<xs:enumeration value="tensor_list_t"/>
<xs:enumeration value="tosa_graph_t"/>
- <xs:enumeration value="String"/>
</xs:restriction>
</xs:simpleType>
@@ -121,7 +119,6 @@
<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:attribute name="max_nesting" type="xs:int" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
@@ -207,7 +204,6 @@
<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="shape" type="xs:string" use="required"/>
- <xs:attribute name="optional" type="xs:boolean"/>
</xs:complexType>
</xs:element>