From d621bca4e963555a99be4328c8d49d1813789649 Mon Sep 17 00:00:00 2001 From: Chunosov Date: Fri, 3 Nov 2017 17:33:15 +0700 Subject: COMPMID-661: directconv-uint8 (#20) Change-Id: I84f7a1ce3658be0d3c91e65096467258af48f0b6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94341 Tested-by: Kaizen Reviewed-by: Anthony Barbier --- arm_compute/core/Utils.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'arm_compute/core/Utils.h') diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h index a77df030e6..b2bd7bd4ab 100644 --- a/arm_compute/core/Utils.h +++ b/arm_compute/core/Utils.h @@ -346,6 +346,43 @@ inline size_t num_channels_from_format(Format format) } } +/** Return the promoted data type of a given data type. + * + * @note If promoted data type is not supported an error will be thrown + * + * @param[in] dt Data type to get the promoted type of. + * + * @return Promoted data type + */ +inline DataType get_promoted_data_type(DataType dt) +{ + switch(dt) + { + case DataType::U8: + return DataType::U16; + case DataType::S8: + return DataType::S16; + case DataType::QS8: + return DataType::QS16; + case DataType::U16: + return DataType::U32; + case DataType::S16: + return DataType::S32; + case DataType::QS16: + return DataType::QS32; + case DataType::QASYMM8: + case DataType::F16: + case DataType::U32: + case DataType::S32: + case DataType::F32: + case DataType::QS32: + ARM_COMPUTE_ERROR("Unsupported data type promotions!"); + default: + ARM_COMPUTE_ERROR("Undefined data type!"); + } + return DataType::UNKNOWN; +} + /** Separate a 2D convolution into two 1D convolutions * * @param[in] conv 2D convolution -- cgit v1.2.1