aboutsummaryrefslogtreecommitdiff
path: root/arm_compute/core/PixelValue.h
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-02-26 09:58:13 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-03-05 15:15:15 +0000
commite8291acc1d9e89c9274d31f0d5bb4779eb95588c (patch)
tree5a0fef36d6daabe387174e55b60de54557c75291 /arm_compute/core/PixelValue.h
parentaa85cdf22802cb892d7fa422ca505a43d84adb38 (diff)
downloadComputeLibrary-e8291acc1d9e89c9274d31f0d5bb4779eb95588c.tar.gz
COMPMID-3152: Initial Bfloat16 support
Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: Ie6959e37e13731c86b2ee29392a99a293450a1b4 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2824 Tested-by: Arm Jenkins <bsgcomp@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com>
Diffstat (limited to 'arm_compute/core/PixelValue.h')
-rw-r--r--arm_compute/core/PixelValue.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/arm_compute/core/PixelValue.h b/arm_compute/core/PixelValue.h
index 31bc55098a..337ccbc3f7 100644
--- a/arm_compute/core/PixelValue.h
+++ b/arm_compute/core/PixelValue.h
@@ -89,6 +89,9 @@ public:
case DataType::S64:
value.s64 = static_cast<int64_t>(v);
break;
+ case DataType::BFLOAT16:
+ value.bf16 = static_cast<bfloat16>(v);
+ break;
case DataType::F16:
value.f16 = static_cast<half>(v);
break;
@@ -174,6 +177,15 @@ public:
{
value.s64 = v;
}
+ /** Initialize the union with a BFLOAT16 pixel value
+ *
+ * @param[in] v F16 value.
+ */
+ PixelValue(bfloat16 v)
+ : PixelValue()
+ {
+ value.bf16 = v;
+ }
/** Initialize the union with a F16 pixel value
*
* @param[in] v F16 value.
@@ -214,6 +226,7 @@ public:
double f64; /**< Single channel double */
float f32; /**< Single channel float 32 */
half f16; /**< Single channel F16 */
+ bfloat16 bf16; /**< Single channel brain floating-point number */
uint8_t u8; /**< Single channel U8 */
int8_t s8; /**< Single channel S8 */
uint16_t u16; /**< Single channel U16 */
@@ -285,6 +298,14 @@ public:
{
v = value.s64;
}
+ /** Interpret the pixel value as a BFLOAT16
+ *
+ * @param[out] v Returned value
+ */
+ void get(bfloat16 &v) const
+ {
+ v = value.bf16;
+ }
/** Interpret the pixel value as a F16
*
* @param[out] v Returned value