aboutsummaryrefslogtreecommitdiff
path: root/src/core/Utils.cpp
diff options
context:
space:
mode:
authorGiuseppe Rossini <giuseppe.rossini@arm.com>2018-07-17 18:13:13 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commitd7647d4ebd0f0b5253b7f31ffcd48a851ba62947 (patch)
tree9bdd2c54130937bd1a858323c84640392f3e3b05 /src/core/Utils.cpp
parentc30b668bf7b3e7f841ea8ef9295f43fc69519e15 (diff)
downloadComputeLibrary-d7647d4ebd0f0b5253b7f31ffcd48a851ba62947.tar.gz
[COMPMID-1229] Implementing Pad on OpenCL -FP32/FP16
Change-Id: Ideead99410e5e0bda1035030af1bbcd0a65ea15e Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/144792 Tested-by: bsgcomp <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/core/Utils.cpp')
-rw-r--r--src/core/Utils.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/core/Utils.cpp b/src/core/Utils.cpp
index 11bdbdafe0..229579d8d9 100644
--- a/src/core/Utils.cpp
+++ b/src/core/Utils.cpp
@@ -252,6 +252,55 @@ const std::string &arm_compute::string_from_pooling_type(PoolingType type)
return pool_type_map[type];
}
+std::string arm_compute::string_from_pixel_value(const PixelValue &value, const DataType data_type)
+{
+ std::stringstream ss;
+ std::string converted_string;
+
+ switch(data_type)
+ {
+ case DataType::U8:
+ case DataType::QASYMM8:
+ // Needs conversion to 32 bit, otherwise interpreted as ASCII values
+ ss << uint32_t(value.get<uint8_t>());
+ converted_string = ss.str();
+ break;
+ case DataType::S8:
+ // Needs conversion to 32 bit, otherwise interpreted as ASCII values
+ ss << int32_t(value.get<int8_t>());
+ converted_string = ss.str();
+ break;
+ case DataType::U16:
+ ss << value.get<uint16_t>();
+ converted_string = ss.str();
+ break;
+ case DataType::S16:
+ ss << value.get<int16_t>();
+ converted_string = ss.str();
+ break;
+ case DataType::U32:
+ ss << value.get<uint32_t>();
+ converted_string = ss.str();
+ break;
+ case DataType::S32:
+ ss << value.get<int32_t>();
+ converted_string = ss.str();
+ break;
+ case DataType::F32:
+ converted_string = float_to_string_with_full_precision(value.get<float>());
+ break;
+ case DataType::F16:
+ static_assert(sizeof(half) == 2, "Half must be 16 bit");
+ ss << value.get<half>();
+ converted_string = ss.str();
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Not handled");
+ }
+
+ return converted_string;
+}
+
std::string arm_compute::lower_string(const std::string &val)
{
std::string res = val;