aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/Utils.h
diff options
context:
space:
mode:
authorChunosov <N.Chunosov@yandex.ru>2017-11-03 17:33:15 +0700
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commitd621bca4e963555a99be4328c8d49d1813789649 (patch)
tree59503f9d4cdbaafefdba5a2569bf3d88082ad09d /arm_compute/core/Utils.h
parent5a99ddf2dcf3a5eb49ea85cb8bcc6a43f1496e5e (diff)
downloadComputeLibrary-d621bca4e963555a99be4328c8d49d1813789649.tar.gz
COMPMID-661: directconv-uint8 (#20)
Change-Id: I84f7a1ce3658be0d3c91e65096467258af48f0b6 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94341 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'arm_compute/core/Utils.h')
-rw-r--r--arm_compute/core/Utils.h37
1 files changed, 37 insertions, 0 deletions
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