diff options
author | Ramy Elgammal <ramy.elgammal@arm.com> | 2022-12-22 15:21:03 +0000 |
---|---|---|
committer | Ramy Elgammal <ramy.elgammal@arm.com> | 2023-01-09 15:41:02 +0000 |
commit | d2d9361a0a338bce478f7d85b4af70d1ed20f26c (patch) | |
tree | d7f8491bb1175a0a0fb28bc916e2078e2947e4e2 /src/core/SubTensorInfo.cpp | |
parent | f800adf185e966b16385f65b9c7250766949dbe4 (diff) | |
download | ComputeLibrary-d2d9361a0a338bce478f7d85b4af70d1ed20f26c.tar.gz |
Add extend padding lock flag
- ITensorInfo's padding cannot be extended if its lock_paddings flag is set to True.
Resolves: COMPMID-5714
Signed-off-by: Ramy Elgammal <ramy.elgammal@arm.com>
Change-Id: I6bca9bbf7172822af60562310578c438b9e15f46
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/8875
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: SiCong Li <sicong.li@arm.com>
Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com>
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Benchmark: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/SubTensorInfo.cpp')
-rw-r--r-- | src/core/SubTensorInfo.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/core/SubTensorInfo.cpp b/src/core/SubTensorInfo.cpp index 3d68331181..723b6bc016 100644 --- a/src/core/SubTensorInfo.cpp +++ b/src/core/SubTensorInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2021 Arm Limited. + * Copyright (c) 2017-2023 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -56,12 +56,12 @@ TensorShape extend_parent_shape(TensorShape parent_shape, TensorShape shape, Coo } // namespace SubTensorInfo::SubTensorInfo() - : _parent(nullptr), _tensor_shape(), _dims_state(), _coords(), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(false) + : _parent(nullptr), _tensor_shape(), _dims_state(), _coords(), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(false), _lock_paddings(false) { } SubTensorInfo::SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent) - : _parent(parent), _tensor_shape(tensor_shape), _dims_state(), _coords(coords), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(extend_parent) + : _parent(parent), _tensor_shape(tensor_shape), _dims_state(), _coords(coords), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(extend_parent), _lock_paddings(false) { ARM_COMPUTE_ERROR_ON(parent == nullptr); @@ -114,8 +114,20 @@ ITensorInfo &SubTensorInfo::set_tensor_dims_state(const TensorDimsState &state) return *this; } +ITensorInfo &SubTensorInfo::set_lock_paddings(bool flag) +{ + _lock_paddings = flag; + return *this; +} + +bool SubTensorInfo::lock_paddings() const +{ + return _lock_paddings; +} + bool SubTensorInfo::extend_padding(const PaddingSize &padding) { + ARM_COMPUTE_ERROR_ON(_lock_paddings); ARM_COMPUTE_ERROR_ON(_parent == nullptr); ARM_COMPUTE_ERROR_ON(!_parent->is_resizable()); ARM_COMPUTE_ERROR_ON(_parent->total_size() == 0); |