diff options
-rw-r--r-- | arm_compute/core/Utils.h | 14 | ||||
-rw-r--r-- | src/core/CL/kernels/CLNormalizationLayerKernel.cpp | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/arm_compute/core/Utils.h b/arm_compute/core/Utils.h index af788beeb7..39ec6587de 100644 --- a/arm_compute/core/Utils.h +++ b/arm_compute/core/Utils.h @@ -654,6 +654,20 @@ inline bool is_data_type_fixed_point(DataType dt) } } +/** Create a string with the float in full precision. + * + * @param val Floating point value + * + * @return String with the floating point value. + */ +inline std::string float_to_string_with_full_precision(float val) +{ + std::stringstream ss; + ss.precision(std::numeric_limits<float>::digits10 + 1); + ss << val; + return ss.str(); +} + /** Print consecutive elements to an output stream. * * @param[out] s Output stream to print the elements to. diff --git a/src/core/CL/kernels/CLNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLNormalizationLayerKernel.cpp index a0607c2ba0..b382e9d510 100644 --- a/src/core/CL/kernels/CLNormalizationLayerKernel.cpp +++ b/src/core/CL/kernels/CLNormalizationLayerKernel.cpp @@ -83,9 +83,9 @@ void CLNormalizationLayerKernel::configure(const ICLTensor *input, const ICLTens { build_opts.emplace(("-DFIXED_POINT_POSITION=" + support::cpp11::to_string(input->info()->fixed_point_position()))); } - build_opts.emplace(("-DCOEFF=" + support::cpp11::to_string(norm_info.scale_coeff()))); - build_opts.emplace(("-DBETA=" + support::cpp11::to_string(norm_info.beta()))); - build_opts.emplace(("-DKAPPA=" + support::cpp11::to_string(norm_info.kappa()))); + build_opts.emplace(("-DCOEFF=" + float_to_string_with_full_precision(norm_info.scale_coeff()))); + build_opts.emplace(("-DBETA=" + float_to_string_with_full_precision(norm_info.beta()))); + build_opts.emplace(("-DKAPPA=" + float_to_string_with_full_precision(norm_info.kappa()))); build_opts.emplace(("-DVEC_SIZE=" + support::cpp11::to_string(num_elems_processed_per_iteration))); // Create kernel |