From b14a0f0c1c72a2365c42f7bd1ff698f8fb94c070 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 8 Jan 2021 03:14:31 +0000 Subject: Add meta-data to express dynamic shapes in ITensorInfo Add `get_tensor_shape_state` and `set_tensor_shape_state` to inject shape dynamism. The state is represented by an array of integers which index maps to the respective shape dimension index. If -1 is passed as a dimension state then the corresponding dimension is dynamic. Signed-off-by: Georgios Pinitas Change-Id: I3a8a5ad109b90d4df8545b460a9f8dfcc13dfa0f Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4784 Tested-by: Arm Jenkins Reviewed-by: Michele Di Giorgio Comments-Addressed: Arm Jenkins --- arm_compute/core/SubTensorInfo.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'arm_compute/core/SubTensorInfo.h') diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h index 6654ccf00a..1b2278d99b 100644 --- a/arm_compute/core/SubTensorInfo.h +++ b/arm_compute/core/SubTensorInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 Arm Limited. * * SPDX-License-Identifier: MIT * @@ -98,6 +98,7 @@ public: return *this; }; ITensorInfo &set_tensor_shape(const TensorShape &shape) override; + ITensorInfo &set_tensor_dims_state(const TensorDimsState &state) override; ITensorInfo &set_quantization_info(const QuantizationInfo &quantization_info) override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); @@ -155,6 +156,11 @@ public: ARM_COMPUTE_ERROR_ON(_parent == nullptr); return _tensor_shape; } + const TensorDimsState &tensor_dims_state() const override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + return _dims_state; + } DataType data_type() const override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); @@ -196,12 +202,6 @@ public: _parent->set_is_resizable(is_resizable); return *this; } - ITensorInfo &set_is_dynamic(bool is_dynamic) override - { - ARM_COMPUTE_ERROR_ON(_parent == nullptr); - _parent->set_is_dynamic(is_dynamic); - return *this; - } ValidRegion valid_region() const override { return _valid_region; @@ -228,11 +228,12 @@ public: } private: - ITensorInfo *_parent; - TensorShape _tensor_shape; - Coordinates _coords; - ValidRegion _valid_region; - bool _extend_parent; + ITensorInfo *_parent; + TensorShape _tensor_shape; + TensorDimsState _dims_state; + Coordinates _coords; + ValidRegion _valid_region; + bool _extend_parent; }; } // namespace arm_compute #endif /*ARM_COMPUTE_SUBTENSORINFO_H */ -- cgit v1.2.1