aboutsummaryrefslogtreecommitdiff
path: root/chapters/appendix_a.adoc
diff options
context:
space:
mode:
Diffstat (limited to 'chapters/appendix_a.adoc')
-rw-r--r--chapters/appendix_a.adoc52
1 files changed, 13 insertions, 39 deletions
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;
}
----