From 283c1790da45ab562ecfb2aa7741297191886d85 Mon Sep 17 00:00:00 2001 From: Georgios Pinitas Date: Fri, 10 Nov 2017 18:14:06 +0000 Subject: COMPMID-676: Rework TensorInfo building Change-Id: Ic98f64ffe30739437a1fe31ef98d83ee900741e3 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/95512 Reviewed-by: Michalis Spyrou Tested-by: Kaizen Reviewed-by: Anthony Barbier --- arm_compute/core/SubTensorInfo.h | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'arm_compute/core/SubTensorInfo.h') diff --git a/arm_compute/core/SubTensorInfo.h b/arm_compute/core/SubTensorInfo.h index 3a88ebae5a..5fec11a2e8 100644 --- a/arm_compute/core/SubTensorInfo.h +++ b/arm_compute/core/SubTensorInfo.h @@ -34,6 +34,7 @@ #include "arm_compute/core/Validate.h" #include +#include namespace arm_compute { @@ -50,7 +51,7 @@ public: * X and Y dimensions must match the parent's ones. * @param[in] coords Coordinates of starting element inside parent tensor. */ - SubTensorInfo(ITensorInfo *parent, const TensorShape &tensor_shape, const Coordinates &coords); + SubTensorInfo(ITensorInfo *parent, TensorShape tensor_shape, Coordinates coords); /** Default destructor */ ~SubTensorInfo() = default; /** Allow instances of this class to be copy constructed */ @@ -71,27 +72,38 @@ public: } // Inherited methods overridden: - void set_data_type(DataType data_type) override + std::unique_ptr clone() const override; + ITensorInfo &set_data_type(DataType data_type) override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); _parent->set_data_type(data_type); + return *this; }; - void set_num_channels(int num_channels) override + ITensorInfo &set_num_channels(int num_channels) override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); _parent->set_num_channels(num_channels); + return *this; }; - void set_format(Format format) override + ITensorInfo &set_format(Format format) override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); _parent->set_format(format); + return *this; }; - void set_fixed_point_position(int fixed_point_position) override + ITensorInfo &set_fixed_point_position(int fixed_point_position) override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); _parent->set_fixed_point_position(fixed_point_position); + return *this; }; - void set_tensor_shape(TensorShape shape) override; + ITensorInfo &set_tensor_shape(TensorShape shape) override; + ITensorInfo &set_quantization_info(QuantizationInfo quantization_info) override + { + ARM_COMPUTE_ERROR_ON(_parent == nullptr); + _parent->set_quantization_info(quantization_info); + return *this; + } bool auto_padding() override { ARM_COMPUTE_ERROR_ON(_parent == nullptr); @@ -191,11 +203,6 @@ public: ARM_COMPUTE_ERROR_ON(_parent == nullptr); return _parent->quantization_info(); } - void set_quantization_info(QuantizationInfo quantization_info) override - { - ARM_COMPUTE_ERROR_ON(_parent == nullptr); - _parent->set_quantization_info(quantization_info); - } private: ITensorInfo *_parent; -- cgit v1.2.1