aboutsummaryrefslogtreecommitdiff
path: root/utils/ImageLoader.h
diff options
context:
space:
mode:
authorgiuros01 <giuseppe.rossini@arm.com>2019-08-23 14:27:30 +0100
committerGiuseppe Rossini <giuseppe.rossini@arm.com>2019-08-30 13:37:28 +0000
commit351bd137e48c5276963274ac741b172483e98d21 (patch)
tree3ede92537c406d24f948acc51c1e6c0fac011036 /utils/ImageLoader.h
parentebe2e8ccc6f9504fdad95884a794be1e9f58803e (diff)
downloadComputeLibrary-351bd137e48c5276963274ac741b172483e98d21.tar.gz
compmid-2573: Investigate FP16 Winograd reference implementations
Change-Id: I5a3e692c046a5ad28a676c03e3e51950c64cf503 Signed-off-by: giuros01 <giuseppe.rossini@arm.com> Reviewed-on: https://review.mlplatform.org/c/1845 Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'utils/ImageLoader.h')
-rw-r--r--utils/ImageLoader.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/utils/ImageLoader.h b/utils/ImageLoader.h
index 24fcbe179a..5d3a84c59a 100644
--- a/utils/ImageLoader.h
+++ b/utils/ImageLoader.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -249,14 +249,14 @@ public:
*
* @note If the image is a CLImage, the function maps and unmaps the image
*
- * @param[in,out] tensor Tensor with 3 planes to fill (Must be allocated, and of matching dimensions with the opened image). Data types supported: U8/F32
+ * @param[in,out] tensor Tensor with 3 planes to fill (Must be allocated, and of matching dimensions with the opened image). Data types supported: U8/F16/F32
* @param[in] bgr (Optional) Fill the first plane with blue channel (default = false)
*/
template <typename T>
void fill_planar_tensor(T &tensor, bool bgr = false)
{
ARM_COMPUTE_ERROR_ON(!is_open());
- ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&tensor, 1, DataType::U8, DataType::F32);
+ ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(&tensor, 1, DataType::U8, DataType::F32, DataType::F16);
const DataLayout data_layout = tensor.info()->data_layout();
const TensorShape tensor_shape = tensor.info()->tensor_shape();
@@ -324,6 +324,13 @@ public:
*reinterpret_cast<float *>(out.ptr() + 2 * stride_z) = static_cast<float>(bgr ? red : blue);
break;
}
+ case DataType::F16:
+ {
+ *reinterpret_cast<half *>(out.ptr() + 0 * stride_z) = static_cast<half>(bgr ? blue : red);
+ *reinterpret_cast<half *>(out.ptr() + 1 * stride_z) = static_cast<half>(green);
+ *reinterpret_cast<half *>(out.ptr() + 2 * stride_z) = static_cast<half>(bgr ? red : blue);
+ break;
+ }
default:
{
ARM_COMPUTE_ERROR("Unsupported data type");