aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2021-10-19 15:56:42 +0100
committerEric Kunze <eric.kunze@arm.com>2021-10-21 18:32:52 +0000
commit58026d6839617f648ef8f7c6e106cf5acf2a4cc2 (patch)
tree400b1903da5840729acb16ce35655c9e9895ab78
parent5d00c69051bef9f27b60ba136c0efc49a45bf8e6 (diff)
downloadreference_model-58026d6839617f648ef8f7c6e106cf5acf2a4cc2.tar.gz
Fix pool2d generation and check to match specification
Change output size error_if check in ref model to match specification. Remove size check from test generation as output shape is always correctly calculated. Change-Id: I5be64f31e6448b47e80fc0a4af11bb312f366a26 Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com>
-rw-r--r--reference_model/src/ops/tensor_ops.cc9
-rw-r--r--verif/tosa_test_gen.py7
2 files changed, 2 insertions, 14 deletions
diff --git a/reference_model/src/ops/tensor_ops.cc b/reference_model/src/ops/tensor_ops.cc
index be4e4aa..059638a 100644
--- a/reference_model/src/ops/tensor_ops.cc
+++ b/reference_model/src/ops/tensor_ops.cc
@@ -92,13 +92,8 @@ int check_pool2d_attribute_common(tosa::TosaPoolAttribute* attribute,
return 1;
}
- int32_t allowed_min_input_height = (OH * stride_y) - pad_top - pad_bottom - stride_y + kernel_y;
- int32_t allowed_min_input_width = (OW * stride_x) - pad_left - pad_right - stride_x + kernel_x;
-
- int32_t d_height = IH - allowed_min_input_height;
- int32_t d_width = IW - allowed_min_input_width;
-
- if (d_height < 0 || d_height > stride_y || d_width < 0 || d_width > stride_x)
+ if ( OH != (IH + pad_top + pad_bottom + stride_y - kernel_y) / stride_y ||
+ OW != (IW + pad_left + pad_right + stride_x - kernel_x) / stride_x )
{
msg = "Mismatch between output shape provided and expected output shape";
return 1;
diff --git a/verif/tosa_test_gen.py b/verif/tosa_test_gen.py
index 1f35b8b..04fce90 100644
--- a/verif/tosa_test_gen.py
+++ b/verif/tosa_test_gen.py
@@ -717,12 +717,6 @@ class TosaArgGen:
for s in sorted(list(strides)):
for p in sorted(list(paddings)):
for k in sorted(list(kernels)):
- # Calculate output height to test for error_if conditions
- oh = (shape[1] + p[0] + p[1] + s[0] - k[0]) // s[0]
- ow = (shape[2] + p[2] + p[3] + s[1] - k[1]) // s[1]
- y = (oh * s[0]) - p[0] - p[1] - s[0] + k[0]
- x = (ow * s[1]) - p[2] - p[3] - s[1] + k[1]
-
if error_name in [ErrorIf.StrideSmallerOne, ErrorIf.KernelSmallerOne, ErrorIf.PadSmallerZero, ErrorIf.PadLargerEqualKernel]:
sNew, pNew, kNew = TosaErrorIfArgGen.eiPoolingErrorIf(testGen, error_name, s, p, k)
if None not in [sNew, pNew, kNew] and n % sparsity == 0:
@@ -741,7 +735,6 @@ class TosaArgGen:
and p[0] < k[0] and p[1] < k[0] and p[2] < k[1] and p[3] < k[1]
# the padded shape must exceed the kernel size
and (shape[1] + p[0] + p[1]) > k[0] and (shape[2] + p[2] + p[3]) > k[1]
- and y < shape[1] and x < shape[2]
):
arg_list.append(
(