diff options
author | Pablo Tello <pablo.tello@arm.com> | 2021-04-26 15:39:05 +0100 |
---|---|---|
committer | Pablo Marquez Tello <pablo.tello@arm.com> | 2021-04-27 11:29:07 +0000 |
commit | 5c3eeec645883dc8f57a1e10995b4e8298343ecb (patch) | |
tree | 8c936233e98c2d0032b60cdd1c399bf4643527df /src/core/CL/kernels | |
parent | 0ff73c70003bad895e1d0bd5c53aa117eb798900 (diff) | |
download | ComputeLibrary-5c3eeec645883dc8f57a1e10995b4e8298343ecb.tar.gz |
Fixed CTS failures CLInstanceNorm
* Resolves COMPMID-4400
Change-Id: I54c33a017c735194fbf4437d1c7df465208bc0ca
Signed-off-by: Pablo Tello <pablo.tello@arm.com>
Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/5505
Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Tested-by: Arm Jenkins <bsgcomp@arm.com>
Reviewed-by: Sheri Zhang <sheri.zhang@arm.com>
Diffstat (limited to 'src/core/CL/kernels')
-rw-r--r-- | src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp | 13 | ||||
-rw-r--r-- | src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h | 11 |
2 files changed, 16 insertions, 8 deletions
diff --git a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp index 80a42cc3f5..dcde0850a7 100644 --- a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp +++ b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp @@ -74,7 +74,7 @@ CLComputeMeanVariance::CLComputeMeanVariance() { } -void CLComputeMeanVariance::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output) +void CLComputeMeanVariance::configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, bool use_mixed_precision) { ARM_COMPUTE_ERROR_ON_NULLPTR(input); auto padding_info = get_padding_info({ input, output }); @@ -86,6 +86,7 @@ void CLComputeMeanVariance::configure(const CLCompileContext &compile_context, I const unsigned int num_elems_processed_per_iteration = 16 / input->info()->element_size(); CLBuildOptions build_opts; + build_opts.add_option("-DINTERNAL_DATA_TYPE=" + (use_mixed_precision ? "float" : get_cl_type_from_data_type(input->info()->data_type()))); build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type())); build_opts.add_option("-DVEC_SIZE=" + support::cpp11::to_string(num_elems_processed_per_iteration)); build_opts.add_option("-DDIM_X=" + support::cpp11::to_string(input->info()->dimension(0))); @@ -105,8 +106,14 @@ void CLComputeMeanVariance::configure(const CLCompileContext &compile_context, I const TensorShape out_shape(input_channel, 2u, input_batches); // Output auto initialization if not yet initialized - auto_init_if_empty(*output->info(), out_shape, 1, input->info()->data_type()); - + if(use_mixed_precision) + { + auto_init_if_empty(*output->info(), out_shape, 1, DataType::F32); + } + else + { + auto_init_if_empty(*output->info(), out_shape, 1, input->info()->data_type()); + } ICLKernel::configure_internal(win); ARM_COMPUTE_ERROR_ON(has_padding_changed(padding_info)); } diff --git a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h index 33a3ff97c3..2f9014a651 100644 --- a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h +++ b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.h @@ -100,12 +100,13 @@ public: /** Set the input and output tensors. * - * @param[in] compile_context The compile context to be used. - * @param[in, out] input Source tensor. Data types supported: F16/F32. Data layout supported: NCHW, NHWC - * In case of @p output tensor = nullptr this tensor will store the result of the normalization. - * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. + * @param[in] compile_context The compile context to be used. + * @param[in, out] input Source tensor. Data types supported: F16/F32. Data layout supported: NCHW, NHWC + * In case of @p output tensor = nullptr this tensor will store the result of the normalization. + * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input. + * @param[in] use_mixed_precision Use mixed precision in case of FP16 execution */ - void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output); + void configure(const CLCompileContext &compile_context, ICLTensor *input, ICLTensor *output, bool use_mixed_precision); /** Static function to check if given info will lead to a valid configuration of @ref CLInstanceNormalizationLayer. * |