diff options
author | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-06-19 23:22:08 +0100 |
---|---|---|
committer | Georgios Pinitas <georgios.pinitas@arm.com> | 2020-06-25 10:40:32 +0000 |
commit | 0b5af9f2751ad6cb7ce76c577a6e67abe6dc8aa1 (patch) | |
tree | 1ab7fc1480fd3480b1e50873634a77278514d01e /src/core/Validate.cpp | |
parent | 36b8f0503218ecae5aafc4c5d825a7a60bdd9c39 (diff) | |
download | ComputeLibrary-0b5af9f2751ad6cb7ce76c577a6e67abe6dc8aa1.tar.gz |
COMPMID-3478: Allow SubTensors with XY indexing
Remove limitations on sub-tensor creation and allow any possible
indexing as long as it honors the parent tensor shape.
In case of padding expansion on a subtensor, an error is raised if
the sub-tensor is indexed on the XY dimensions.
Change-Id: Ibb5183a6cb7421f55068b47c06b43ebde0f6e9a5
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/3427
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Michele Di Giorgio <michele.digiorgio@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/Validate.cpp')
-rw-r--r-- | src/core/Validate.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/core/Validate.cpp b/src/core/Validate.cpp index f9bd6d6a45..cc80611107 100644 --- a/src/core/Validate.cpp +++ b/src/core/Validate.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2019 ARM Limited. + * Copyright (c) 2016-2020 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -176,16 +176,12 @@ arm_compute::Status arm_compute::error_on_unconfigured_kernel(const char *functi arm_compute::Status arm_compute::error_on_invalid_subtensor(const char *function, const char *file, const int line, const TensorShape &parent_shape, const Coordinates &coords, const TensorShape &shape) { - // Subtensor should not index in x, y dimensions. - ARM_COMPUTE_RETURN_ERROR_ON_LOC(((coords.x() != 0) || (coords.y() != 0)), function, file, line); - // Subtensor shape should match parent tensor in x, y dimensions. - ARM_COMPUTE_RETURN_ERROR_ON_LOC(((parent_shape.x() != shape.x()) || (parent_shape.y() != shape.y())), function, file, line); - // Check dimensions for(unsigned int i = 0; i < TensorShape::num_max_dimensions; ++i) { - ARM_COMPUTE_RETURN_ERROR_ON_LOC(((coords[i] >= static_cast<int>(parent_shape[i])) || (coords[i] + static_cast<int>(shape[i]) > static_cast<int>(parent_shape[i]))), - function, file, line); + const bool invalid_idx = coords[i] >= static_cast<int>(parent_shape[i]); + const bool out_of_bounds_size = coords[i] + static_cast<int>(shape[i]) > static_cast<int>(parent_shape[i]); + ARM_COMPUTE_RETURN_ERROR_ON_LOC(invalid_idx || out_of_bounds_size, function, file, line); } return arm_compute::Status{}; } |