aboutsummaryrefslogtreecommitdiff
path: root/chapters/appendix_a.adoc
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2023-07-27 11:50:57 +0100
committerDominic Symes <dominic.symes@arm.com>2023-08-16 16:33:20 +0000
commitb5b067819e5de11153b41cf3d26da4f3f9dd23e8 (patch)
treea347a7b4d7f89d5706ced611c3d60e49c1ddc5da /chapters/appendix_a.adoc
parent830b43b1d1bd82edd57dee1f5cac12e2b5cf0e04 (diff)
downloadspecification-b5b067819e5de11153b41cf3d26da4f3f9dd23e8.tar.gz
Main conformance: Add local bound flag for convolutions
Adds a local_bound flag to convolution operations. If the local_bound flag is true then the output accuracy for floating-point is measured relative to the input tensor data local to the particular convolution output. If the local_bound flag is false then the output accuracy for floating-point is measured relative to the whole input tensor. This accuracy measure is the default and more approapriate for implementations with non local optimizations (such as transform based fast convolutions). Signed-off-by: Dominic Symes <dominic.symes@arm.com> Change-Id: I64e3e4981a63e26e6391149e28d5d71e7ef5560a
Diffstat (limited to 'chapters/appendix_a.adoc')
-rw-r--r--chapters/appendix_a.adoc34
1 files changed, 29 insertions, 5 deletions
diff --git a/chapters/appendix_a.adoc b/chapters/appendix_a.adoc
index d4235e8..ba3b6bb 100644
--- a/chapters/appendix_a.adoc
+++ b/chapters/appendix_a.adoc
@@ -37,7 +37,10 @@ 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) and 1 for the second input (usually weights)
+* 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)
* k is the index within the kernel in the range 0 \<= k < KS
* i is the index within the tensor to write
@@ -61,6 +64,7 @@ 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
@@ -70,8 +74,9 @@ 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))*(0.75 + 0.25*set_data(2*S+0, i))
-| 1 | (B/sqrt(KS))*(0.75 + 0.25*set_data(2*S+1, 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))
|===
==== Test set S=2
@@ -85,6 +90,7 @@ 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
@@ -98,6 +104,7 @@ 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
@@ -109,6 +116,7 @@ The aim of this test set is to check a mixture of zero and non-zero products.
| 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
|===
==== Test set S=5
@@ -118,8 +126,9 @@ The aim of this test set is to check signed inputs of large range.
[cols="1,9"]
|===
| p | tosa_mi_data(S, KS, p, k, i) =
-| 0 | (B/sqrt(KS))*set_data(2*S+0, i)
-| 1 | (B/sqrt(KS))*set_data(2*S+1, i)
+| 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)
|===
=== Main Inference operator test data
@@ -145,6 +154,9 @@ 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
@@ -162,6 +174,9 @@ 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
@@ -179,6 +194,9 @@ for (0 <= n < N, 0 <= iy < IH, 0 <= ix < IW, 0 <= 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)
+}
----
==== FULLY_CONNECTED
@@ -196,6 +214,9 @@ 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
@@ -230,6 +251,9 @@ 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