diff options
Diffstat (limited to 'arm_compute')
-rw-r--r-- | arm_compute/core/SubTensorInfo.h | 14 | ||||
-rw-r--r-- | arm_compute/graph/SubTensor.h | 33 | ||||
-rw-r--r-- | arm_compute/runtime/CL/CLSubTensor.h | 11 | ||||
-rw-r--r-- | arm_compute/runtime/SubTensor.h | 11 |
4 files changed, 38 insertions, 31 deletions
diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h index 7c464c0b17..67574f1326 100644 --- a/arm_compute/core/SubTensorInfo.h +++ b/arm_compute/core/SubTensorInfo.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -46,12 +46,13 @@ public: SubTensorInfo(); /** Default constructor * - * @param[in] parent Metadata of parent tensor. - * @param[in] tensor_shape Tensor shape. Shape must fit inside parent's shape. - * X and Y dimensions must match the parent's ones. - * @param[in] coords Coordinates of starting element inside parent tensor. + * @param[in] parent Metadata of parent tensor. + * @param[in] tensor_shape Tensor shape. Shape must fit inside parent's shape. + * X and Y dimensions must match the parent's ones. + * @param[in] coords Coordinates of starting element inside parent tensor. + * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds */ - SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coordinates coords); + SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent = false); /** Default destructor */ ~SubTensorInfo() = default; /** Allow instances of this class to be copy constructed */ @@ -216,6 +217,7 @@ private: TensorShape _tensor_shape; Coordinates _coords; ValidRegion _valid_region; + bool _extend_parent; }; } #endif /*__ARM_COMPUTE_SUBTENSORINFO_H__ */ diff --git a/arm_compute/graph/SubTensor.h b/arm_compute/graph/SubTensor.h index 72aa789274..43b835d49c 100644 --- a/arm_compute/graph/SubTensor.h +++ b/arm_compute/graph/SubTensor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -44,19 +44,21 @@ public: SubTensor(); /** Constructor * - * @param[in] parent Parent to create sub-tensor from - * @param[in] tensor_shape Sub-tensor shape - * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor + * @param[in] parent Parent to create sub-tensor from + * @param[in] tensor_shape Sub-tensor shape + * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor + * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds */ - SubTensor(Tensor &parent, TensorShape tensor_shape, Coordinates coords); + SubTensor(Tensor &parent, TensorShape tensor_shape, Coordinates coords, bool extend_parent = false); /** Constructor * - * @param[in] parent Parent to create sub-tensor from - * @param[in] tensor_shape Sub-tensor shape - * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor - * @param[in] target Execution target + * @param[in] parent Parent to create sub-tensor from + * @param[in] tensor_shape Sub-tensor shape + * @param[in] coords Starting coordinates of the sub-tensor in the parent tensor + * @param[in] target Execution target + * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds */ - SubTensor(arm_compute::ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target); + SubTensor(arm_compute::ITensor *parent, TensorShape tensor_shape, Coordinates coords, TargetHint target, bool extend_parent = false); /** Prevent instances of this class from being copied (As this class contains pointers) */ SubTensor(const SubTensor &) = delete; /** Prevent instances of this class from being copied (As this class contains pointers) */ @@ -82,11 +84,12 @@ private: void instantiate_subtensor(); private: - TargetHint _target; /**< Target that this tensor is pinned on */ - TensorShape _tensor_shape; /**< SubTensor shape */ - Coordinates _coords; /**< SubTensor Coordinates */ - arm_compute::ITensor *_parent; /**< Parent tensor */ - std::unique_ptr<arm_compute::ITensor> _subtensor; /**< SubTensor */ + TargetHint _target; /**< Target that this tensor is pinned on */ + TensorShape _tensor_shape; /**< SubTensor shape */ + Coordinates _coords; /**< SubTensor Coordinates */ + arm_compute::ITensor *_parent; /**< Parent tensor */ + std::unique_ptr<arm_compute::ITensor> _subtensor; /**< SubTensor */ + bool _extend_parent; /**< Parent extension flag */ }; } // namespace graph } // namespace arm_compute diff --git a/arm_compute/runtime/CL/CLSubTensor.h b/arm_compute/runtime/CL/CLSubTensor.h index 4bab164779..b6e9a29df4 100644 --- a/arm_compute/runtime/CL/CLSubTensor.h +++ b/arm_compute/runtime/CL/CLSubTensor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -39,11 +39,12 @@ class CLSubTensor : public ICLTensor public: /** Constructor * - * @param[in] parent Parent tensor - * @param[in] tensor_shape Shape of the subtensor - * @param[in] coords Coordinates of the first subtensor element inside the parent tensor. + * @param[in] parent Parent tensor + * @param[in] tensor_shape Shape of the subtensor + * @param[in] coords Coordinates of the first subtensor element inside the parent tensor. + * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds */ - CLSubTensor(ICLTensor *parent, const TensorShape &tensor_shape, const Coordinates &coords); + CLSubTensor(ICLTensor *parent, const TensorShape &tensor_shape, const Coordinates &coords, bool extend_parent = false); /** Destructor: free the tensor's memory */ ~CLSubTensor() = default; /** Restrict instances of this class to be copy constructed */ diff --git a/arm_compute/runtime/SubTensor.h b/arm_compute/runtime/SubTensor.h index bdb229de49..ba2f8682af 100644 --- a/arm_compute/runtime/SubTensor.h +++ b/arm_compute/runtime/SubTensor.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 ARM Limited. + * Copyright (c) 2017-2018 ARM Limited. * * SPDX-License-Identifier: MIT * @@ -39,11 +39,12 @@ class SubTensor : public ITensor public: /** Constructor * - * @param[in] parent Parent tensor - * @param[in] tensor_shape Shape of the subtensor - * @param[in] coords Coordinates of the first subtensor element inside the parent tensor. + * @param[in] parent Parent tensor + * @param[in] tensor_shape Shape of the subtensor + * @param[in] coords Coordinates of the first subtensor element inside the parent tensor. + * @param[in] extend_parent (Optional) Extend parent with subtensor shape if subtensor indexes out of bounds */ - SubTensor(ITensor *parent, const TensorShape &tensor_shape, const Coordinates &coords); + SubTensor(ITensor *parent, const TensorShape &tensor_shape, const Coordinates &coords, bool extend_parent = false); /** Destructor: free the tensor's memory */ ~SubTensor() = default; /** Restrict instances of this class to be copy constructed */ |