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/ITensorInfo.h | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) (limited to 'arm_compute/core/ITensorInfo.h') diff --git a/arm_compute/core/ITensorInfo.h b/arm_compute/core/ITensorInfo.h index 09351522dd..5e8d4e8136 100644 --- a/arm_compute/core/ITensorInfo.h +++ b/arm_compute/core/ITensorInfo.h @@ -29,13 +29,14 @@ #include "arm_compute/core/TensorShape.h" #include "arm_compute/core/Types.h" #include "arm_compute/core/Utils.h" +#include "arm_compute/core/utils/misc/ICloneable.h" #include namespace arm_compute { /** Store the tensor's metadata */ -class ITensorInfo +class ITensorInfo : public misc::ICloneable { public: /** Default virtual destructor */ @@ -45,15 +46,19 @@ public: * @warning This resets the format to UNKNOWN. * * @param[in] data_type The new data type. + * + * @return Reference to this ITensorInfo object */ - virtual void set_data_type(DataType data_type) = 0; + virtual ITensorInfo &set_data_type(DataType data_type) = 0; /** Set the number of channels to the specified value. * * @warning This resets the format to UNKNOWN. * * @param[in] num_channels New number of channels. + * + * @return Reference to this ITensorInfo object */ - virtual void set_num_channels(int num_channels) = 0; + virtual ITensorInfo &set_num_channels(int num_channels) = 0; /** Set the format of an already initialized tensor. * * @note If the data type has already been configured (i.e. not UNKNOWN) it @@ -61,23 +66,36 @@ public: * be based on the format. * * @param[in] format Single-plane format of the tensor. + * + * @return Reference to this ITensorInfo object */ - virtual void set_format(Format format) = 0; + virtual ITensorInfo &set_format(Format format) = 0; /** Set the shape of an already initialized tensor. * * @warning Changing the shape requires to recompute the strides and is * therefore only possible if the tensor hasn't been allocated yet. * * @param[in] shape New tensor shape. + * + * @return Reference to this ITensorInfo object */ - virtual void set_tensor_shape(TensorShape shape) = 0; + virtual ITensorInfo &set_tensor_shape(TensorShape shape) = 0; /** Set the fixed point position to the specified value * * @warning The fixed point position must be set once the data type has been configured * * @param[in] fixed_point_position The new fixed point position + * + * @return Reference to this ITensorInfo object */ - virtual void set_fixed_point_position(int fixed_point_position) = 0; + virtual ITensorInfo &set_fixed_point_position(int fixed_point_position) = 0; + /** Set the quantization settings (scale and offset) of the tensor. + * + * @param[in] quantization_info QuantizationInfo containing the scale and offset + * + * @return Reference to this ITensorInfo object + */ + virtual ITensorInfo &set_quantization_info(QuantizationInfo quantization_info) = 0; /** Update the offset to the first element and the strides to automatically computed values. * * @note The padding used by this method is really conservative so that the tensor can be used for most functions. @@ -196,12 +214,6 @@ public: * @return A QuantizationInfo containing the scale and offset. */ virtual QuantizationInfo quantization_info() const = 0; - - /** Set the quantization settings (scale and offset) of the tensor. - * - * @param[in] quantization_info QuantizationInfo containing the scale and offset. - */ - virtual void set_quantization_info(QuantizationInfo quantization_info) = 0; }; } #endif /*__ARM_COMPUTE_TENSORINFO_H__ */ -- cgit v1.2.1