From c23fc3b03ce7173ba5616234ed7b84fad61941e8 Mon Sep 17 00:00:00 2001 From: Jeremy Johnson Date: Mon, 30 May 2022 16:51:21 +0100 Subject: Remove RESHAPE -1 dimensions support Signed-off-by: Jeremy Johnson Change-Id: I098daf49c92da12c07143cdd23ac9bb58acebbb9 --- reference_model/src/ops/data_layout.cc | 36 ++-------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'reference_model/src/ops/data_layout.cc') 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::~OpReshape() template int OpReshape::checkTensorAttributes() { - uint32_t minusOneCount = 0; - if (validateRequiredOperands()) return 1; @@ -258,21 +256,8 @@ int OpReshape::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*>(inputs[0]); @@ -284,27 +269,10 @@ int OpReshape::checkTensorAttributes() template int OpReshape::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++) -- cgit v1.2.1