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 --- src/core/SubTensorInfo.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/core/SubTensorInfo.cpp') diff --git a/src/core/SubTensorInfo.cpp b/src/core/SubTensorInfo.cpp index bb8ecf60ea..6279992e89 100644 --- a/src/core/SubTensorInfo.cpp +++ b/src/core/SubTensorInfo.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2020 Arm Limited. + * Copyright (c) 2017-2021 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(), _coords(), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(false) + : _parent(nullptr), _tensor_shape(), _dims_state(), _coords(), _valid_region{ Coordinates(), _tensor_shape }, _extend_parent(false) { } SubTensorInfo::SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent) - : _parent(parent), _tensor_shape(tensor_shape), _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) { ARM_COMPUTE_ERROR_ON(parent == nullptr); @@ -107,6 +107,13 @@ ITensorInfo &SubTensorInfo::set_tensor_shape(const TensorShape &shape) return *this; } +ITensorInfo &SubTensorInfo::set_tensor_dims_state(const TensorDimsState &state) +{ + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _dims_state = state; + return *this; +} + bool SubTensorInfo::extend_padding(const PaddingSize &padding) { ARM_COMPUTE_ERROR_ON(_parent == nullptr); -- cgit v1.2.1