aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Johnson <jeremy.johnson@arm.com>2022-05-30 16:51:21 +0100
committerEric Kunze <eric.kunze@arm.com>2022-05-31 17:39:12 +0000
commitc23fc3b03ce7173ba5616234ed7b84fad61941e8 (patch)
treed096f62a2656c55849a191df1f3e62ea37ec01aa
parentf7f78ae236e623a57919f9450e8b2043e681ddb3 (diff)
downloadreference_model-c23fc3b03ce7173ba5616234ed7b84fad61941e8.tar.gz
Remove RESHAPE -1 dimensions support
Signed-off-by: Jeremy Johnson <jeremy.johnson@arm.com> Change-Id: I098daf49c92da12c07143cdd23ac9bb58acebbb9
-rw-r--r--reference_model/src/ops/data_layout.cc36
-rw-r--r--verif/generator/tosa_arg_gen.py5
-rw-r--r--verif/generator/tosa_test_gen.py15
3 files changed, 2 insertions, 54 deletions
diff --git a/reference_model/src/ops/data_layout.cc b/reference_model/src/ops/data_layout.cc
index 387152f..24c86ed 100644
--- a/reference_model/src/ops/data_layout.cc
+++ b/reference_model/src/ops/data_layout.cc
@@ -236,8 +236,6 @@ OpReshape<InRank, OutRank, Dtype>::~OpReshape()
template <int InRank, int OutRank, DType Dtype>
int OpReshape<InRank, OutRank, Dtype>::checkTensorAttributes()
{
- uint32_t minusOneCount = 0;
-
if (validateRequiredOperands())
return 1;
@@ -258,21 +256,8 @@ int OpReshape<InRank, OutRank, Dtype>::checkTensorAttributes()
for (uint32_t d = 0; d < OutRank; d++)
{
- if (attribute->shape()[d] == -1)
- {
- minusOneCount++;
- }
- else
- {
- ERROR_IF(attribute->shape()[d] != outputs[0]->getShape()[d],
- "OpReshape: new_shape doesn't match output shape");
- }
- }
-
- if (minusOneCount > 1)
- {
- printNodeValidationError("OpReshape: new shape has more than one -1 dimension");
- return 1;
+ ERROR_IF(attribute->shape()[d] != outputs[0]->getShape()[d],
+ "OpReshape: new_shape doesn't match output shape");
}
in = dynamic_cast<TosaReference::TensorTemplate<TIn>*>(inputs[0]);
@@ -284,27 +269,10 @@ int OpReshape<InRank, OutRank, Dtype>::checkTensorAttributes()
template <int InRank, int OutRank, DType Dtype>
int OpReshape<InRank, OutRank, Dtype>::eval()
{
- uint32_t remainingSize = in->getElementCount();
-
- // If there is a -1 dimension, find the remainder in one pass over the output shape
- for (int32_t d = 0; d < OutRank; d++)
- {
- if (attribute->shape()[d] != -1)
- {
- remainingSize = remainingSize / attribute->shape()[d];
- }
- }
-
for (int32_t d = 0; d < OutRank; d++)
{
array_shape[d] = attribute->shape()[OutRank - 1 - d];
out_reverser[d] = OutRank - 1 - d;
-
- // Jam in the remainder here
- if (array_shape[d] == -1)
- {
- array_shape[d] = remainingSize;
- }
}
for (int32_t d = 0; d < InRank; d++)
diff --git a/verif/generator/tosa_arg_gen.py b/verif/generator/tosa_arg_gen.py
index a741efb..b5e68dd 100644
--- a/verif/generator/tosa_arg_gen.py
+++ b/verif/generator/tosa_arg_gen.py
@@ -1513,11 +1513,6 @@ class TosaArgGen:
)
newShape.append(remainingElements)
- # Toss in a -1 sometimes
- minusOne = testGen.randInt(0, newRank * 4)
- if minusOne < newRank:
- newShape[minusOne] = -1
-
# Check for duplicates
found = False
for name, other_shape in arg_list:
diff --git a/verif/generator/tosa_test_gen.py b/verif/generator/tosa_test_gen.py
index c9c6d7e..fc2e476 100644
--- a/verif/generator/tosa_test_gen.py
+++ b/verif/generator/tosa_test_gen.py
@@ -4288,21 +4288,6 @@ class OutputShaper:
def reshapeOp(ser, rng, a, shape, error_name=None):
output_shape = shape.copy()
- totalElements = 1
- for i in a.shape:
- totalElements *= i
-
- # If there are any -1 elements, figure out what that dimension must be
- totalOutputElements = 1
- for i in output_shape:
- if i != -1:
- totalOutputElements *= i
-
- # And fill it in
- for i in range(len(output_shape)):
- if output_shape[i] == -1:
- output_shape[i] = totalElements // totalOutputElements
-
if error_name == ErrorIf.TensorSizeInputOutputMismatch:
for i in range(len(output_shape)):
output_shape[i] = output_shape[i] + rng.integers(1, 10)