aboutsummaryrefslogtreecommitdiff
path: root/src/core/TensorInfo.cpp
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2021-01-08 03:14:31 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2021-01-12 03:50:44 +0000
commitb14a0f0c1c72a2365c42f7bd1ff698f8fb94c070 (patch)
treef35a184fc9775ff4a74cd0a0354c31bda459f6fb /src/core/TensorInfo.cpp
parentf8f0442e9a6105be0e32f4defec5fbc10248ea6e (diff)
downloadComputeLibrary-b14a0f0c1c72a2365c42f7bd1ff698f8fb94c070.tar.gz
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 <georgios.pinitas@arm.com> Change-Id: I3a8a5ad109b90d4df8545b460a9f8dfcc13dfa0f Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/4784 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/TensorInfo.cpp')
-rw-r--r--src/core/TensorInfo.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/core/TensorInfo.cpp b/src/core/TensorInfo.cpp
index 7b1f9c542a..bedfe147b0 100644
--- a/src/core/TensorInfo.cpp
+++ b/src/core/TensorInfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2020 Arm Limited.
+ * Copyright (c) 2016-2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -35,7 +35,7 @@
using namespace arm_compute;
TensorInfo::TensorInfo()
- : _total_size(0), _offset_first_element_in_bytes(0), _strides_in_bytes(), _num_channels(0), _tensor_shape(), _data_type(DataType::UNKNOWN), _format(Format::UNKNOWN), _is_resizable{ true }, _is_dynamic{ false },
+ : _total_size(0), _offset_first_element_in_bytes(0), _strides_in_bytes(), _num_channels(0), _tensor_shape(), _dims_state(), _data_type(DataType::UNKNOWN), _format(Format::UNKNOWN), _is_resizable{ true },
_valid_region{ Coordinates(), _tensor_shape }, _padding{ 0 }, _quantization_info(), _data_layout(DataLayout::NCHW)
{
}
@@ -48,10 +48,10 @@ TensorInfo::TensorInfo(const ITensorInfo &info)
_strides_in_bytes = info.strides_in_bytes();
_num_channels = info.num_channels();
_tensor_shape = info.tensor_shape();
+ _dims_state = info.tensor_dims_state();
_data_type = info.data_type();
_format = info.format();
_is_resizable = info.is_resizable();
- _is_dynamic = info.is_dynamic();
_valid_region = info.valid_region();
_padding = info.padding();
_quantization_info = info.quantization_info();
@@ -371,6 +371,12 @@ ITensorInfo &TensorInfo::set_tensor_shape(const TensorShape &shape)
return *this;
}
+ITensorInfo &TensorInfo::set_tensor_dims_state(const TensorDimsState &state)
+{
+ _dims_state = state;
+ return *this;
+}
+
ITensorInfo &TensorInfo::set_quantization_info(const QuantizationInfo &quantization_info)
{
_quantization_info = quantization_info;