aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorgios Pinitas <georgios.pinitas@arm.com>2020-01-30 12:00:23 +0000
committerGeorgios Pinitas <georgios.pinitas@arm.com>2020-02-05 15:09:46 +0000
commit55a687d5e2cf3434e4c2564ac73959dcc7163304 (patch)
treec82972b28e512794ce6c48507cbb61be2b800b0d
parent07fbe3707608bf0c08efb42e15d9b1afaf16ef1e (diff)
downloadComputeLibrary-55a687d5e2cf3434e4c2564ac73959dcc7163304.tar.gz
COMPMID-2927: Add support for mixed precision in
CLInstanceNormalizationLayer Signed-off-by: Georgios Pinitas <georgios.pinitas@arm.com> Change-Id: I91482e2e4b723606aef76afef09a8277813e5d1b Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/2668 Comments-Addressed: Arm Jenkins <bsgcomp@arm.com> Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
-rw-r--r--arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernel.h30
-rw-r--r--arm_compute/core/KernelDescriptors.h25
-rw-r--r--arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h30
-rw-r--r--src/core/CL/cl_kernels/instance_normalization.cl48
-rw-r--r--src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp33
-rw-r--r--src/runtime/CL/functions/CLInstanceNormalizationLayer.cpp10
6 files changed, 96 insertions, 80 deletions
diff --git a/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernel.h b/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernel.h
index cf726d8cdd..9982cc2f1c 100644
--- a/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernel.h
+++ b/arm_compute/core/CL/kernels/CLInstanceNormalizationLayerKernel.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -26,8 +26,11 @@
#include "arm_compute/core/CL/ICLKernel.h"
+#include "arm_compute/core/KernelDescriptors.h"
+
namespace arm_compute
{
+// Forward declarations
class ICLTensor;
/** Interface for performing an instance normalization */
@@ -49,26 +52,22 @@ public:
/** Set the input and output tensors.
*
- * @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] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
- * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
- * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @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] info Kernel meta-data descriptor
*/
- void configure(ICLTensor *input, ICLTensor *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f);
+ void configure(ICLTensor *input, ICLTensor *output, const InstanceNormalizationLayerKernelInfo &info);
/** Static function to check if given info will lead to a valid configuration of @ref CLInstanceNormalizationLayer.
*
- * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
- * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input.
- * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
- * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
- * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
+ * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input.
+ * @param[in] info Kernel meta-data descriptor
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info);
// Inherited methods overridden:
void run(const Window &window, cl::CommandQueue &queue) override;
@@ -76,9 +75,6 @@ public:
private:
ICLTensor *_input;
ICLTensor *_output;
- float _gamma;
- float _beta;
- float _epsilon;
bool _run_in_place;
};
} // namespace arm_compute
diff --git a/arm_compute/core/KernelDescriptors.h b/arm_compute/core/KernelDescriptors.h
index d009ccc73d..4b04bebdef 100644
--- a/arm_compute/core/KernelDescriptors.h
+++ b/arm_compute/core/KernelDescriptors.h
@@ -92,5 +92,30 @@ struct DirectConvolutionLayerOutputStageKernelInfo
int32_t result_offset_after_shift{ 0 }; /**< Result offset used for quantizing */
DataType output_data_type{ DataType::UNKNOWN }; /**< Output tensor data type to use if the output is not initialized */
};
+
+struct InstanceNormalizationLayerKernelInfo
+{
+ /** Default constructor */
+ InstanceNormalizationLayerKernelInfo()
+ : InstanceNormalizationLayerKernelInfo(1.f, 0.f, 1e-12, true)
+ {
+ }
+ /** Constructor
+ *
+ * @param[in] gamma The scale scalar value applied to the normalized tensor.
+ * @param[in] beta The offset scalar value applied to the normalized tensor
+ * @param[in] epsilon Lower bound value for the normalization.
+ * @param[in] use_mixed_precision Use mixed precision in case of FP16 execution.
+ */
+ InstanceNormalizationLayerKernelInfo(float gamma, float beta, float epsilon, bool use_mixed_precision)
+ : gamma(gamma), beta(beta), epsilon(epsilon), use_mixed_precision(use_mixed_precision)
+ {
+ }
+
+ float gamma; /**< The scale scalar value applied to the normalized tensor. Defaults to 1.0 */
+ float beta; /**< The offset scalar value applied to the normalized tensor. Defaults to 0.0 */
+ float epsilon; /**< Lower bound value for the normalization. Defaults to 1e-12 */
+ bool use_mixed_precision; /**< Use mixed precision in case of FP16 execution. Defaults to true */
+};
} // namespace arm_compute
#endif /* ARM_COMPUTE_CORE_KERNEL_DESCRIPTORS_H */
diff --git a/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h b/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h
index ca0da513ad..ddd4b12eca 100644
--- a/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h
+++ b/arm_compute/runtime/CL/functions/CLInstanceNormalizationLayer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -42,26 +42,28 @@ public:
CLInstanceNormalizationLayer();
/** Set the input and output tensors.
*
- * @param[in, out] input Source tensor. In case of @p output tensor = nullptr this tensor will store the result of the normalization.
- * Data types supported: F16/F32. Data layout supported: NHWC, NCHW
- * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input.
- * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
- * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
- * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @param[in, out] input Source tensor. In case of @p output tensor = nullptr this tensor will store the result of the normalization.
+ * Data types supported: F16/F32. Data layout supported: NHWC, NCHW
+ * @param[out] output Destination tensor. Data types and data layouts supported: same as @p input.
+ * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
+ * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
+ * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @param[in] use_mixed_precision (Optional) Use mixed precision in case of FP16 execution
*/
- void configure(ICLTensor *input, ICLTensor *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f);
+ void configure(ICLTensor *input, ICLTensor *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f, bool use_mixed_precision = true);
/** Static function to check if given info will lead to a valid configuration of @ref CLInstanceNormalizationLayer.
*
- * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
- * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input.
- * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
- * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
- * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @param[in] input Source tensor info. Data types supported: F16/F32. Data layout supported: NHWC, NCHW
+ * @param[in] output Destination tensor info. Data types and data layouts supported: same as @p input.
+ * @param[in] gamma (Optional) The scale scalar value applied to the normalized tensor. Defaults to 1.0
+ * @param[in] beta (Optional) The offset scalar value applied to the normalized tensor. Defaults to 0.0
+ * @param[in] epsilon (Optional) Lower bound value for the normalization. Defaults to 1e-12
+ * @param[in] use_mixed_precision (Optional) Use mixed precision in case of FP16 execution
*
* @return a status
*/
- static Status validate(const ITensorInfo *input, const ITensorInfo *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f);
+ static Status validate(const ITensorInfo *input, const ITensorInfo *output, float gamma = 1.0f, float beta = 0.0f, float epsilon = 1e-12f, bool use_mixed_precision = true);
};
} // namespace arm_compute
#endif /* ARM_COMPUTE_CLINSTANCENORMALIZATIONLAYER_H */
diff --git a/src/core/CL/cl_kernels/instance_normalization.cl b/src/core/CL/cl_kernels/instance_normalization.cl
index de7d57c69e..043012bc51 100644
--- a/src/core/CL/cl_kernels/instance_normalization.cl
+++ b/src/core/CL/cl_kernels/instance_normalization.cl
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -23,7 +23,7 @@
*/
#include "helpers.h"
-#if defined(VEC_SIZE) && defined(DATA_TYPE) && defined(GAMMA) && defined(BETA) && defined(EPSILON) && defined(DIM_X) && defined(DIM_Y) && defined(DIM_Z)
+#if defined(VEC_SIZE) && defined(DATA_TYPE) && defined(INTERNAL_DATA_TYPE) && defined(GAMMA) && defined(BETA) && defined(EPSILON) && defined(DIM_X) && defined(DIM_Y) && defined(DIM_Z)
/** This function normalizes the input 2D tensor across the first dimension with respect to mean and standard deviation of the same dimension.
*
* @attention Vector size should be given as a preprocessor argument using -DVEC_SIZE=size. e.g. -DVEC_SIZE=16
@@ -63,8 +63,8 @@ __kernel void instance_normalization(
Tensor4D out = CONVERT_TO_TENSOR4D_STRUCT_NO_STEP(output, 0);
#endif /* IN_PLACE */
- float sum = 0.f;
- float sum_sq = 0.f;
+ INTERNAL_DATA_TYPE sum = 0.f;
+ INTERNAL_DATA_TYPE sum_sq = 0.f;
#if defined(NHWC)
@@ -76,7 +76,7 @@ __kernel void instance_normalization(
{
for(int i_h = 0; i_h < DIM_Z; ++i_h)
{
- float data = (float) * ((__global DATA_TYPE *)tensor4D_offset(&in, ch, i_w, i_h, batch));
+ INTERNAL_DATA_TYPE data = (INTERNAL_DATA_TYPE) * ((__global DATA_TYPE *)tensor4D_offset(&in, ch, i_w, i_h, batch));
sum += data;
sum_sq += data * data;
}
@@ -87,9 +87,9 @@ __kernel void instance_normalization(
const int batch = get_global_id(2) / DIM_Z; // Current batch
const int elements_plane = DIM_X * DIM_Y;
- VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
+ VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE)
part_sum = 0.f;
- VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
+ VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE)
part_sum_sq = 0.f;
// Calculate partial sum
for(int y = 0; y < DIM_Y; ++y)
@@ -98,15 +98,15 @@ __kernel void instance_normalization(
for(; x <= (DIM_X - VEC_SIZE); x += VEC_SIZE)
{
// Load data
- VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
- data = VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)tensor4D_offset(&in, x, y, ch, batch));
+ VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE)
+ data = CONVERT(VLOAD(VEC_SIZE)(0, (__global DATA_TYPE *)tensor4D_offset(&in, x, y, ch, batch)), VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE));
part_sum += data;
part_sum_sq += data * data;
}
// Left-overs loop
for(; x < DIM_X; ++x)
{
- DATA_TYPE data = *((__global DATA_TYPE *)tensor4D_offset(&in, x, y, ch, batch));
+ INTERNAL_DATA_TYPE data = (INTERNAL_DATA_TYPE)(*((__global DATA_TYPE *)tensor4D_offset(&in, x, y, ch, batch)));
part_sum.s0 += data;
part_sum_sq.s0 += data * data;
}
@@ -127,16 +127,14 @@ __kernel void instance_normalization(
part_sum.s0 += part_sum.s1;
part_sum_sq.s0 += part_sum_sq.s1;
- sum = (float)part_sum.s0;
- sum_sq = (float)part_sum_sq.s0;
+ sum = (INTERNAL_DATA_TYPE)part_sum.s0;
+ sum_sq = (INTERNAL_DATA_TYPE)part_sum_sq.s0;
#endif // defined(NHWC)
- const float mean_float = (sum / elements_plane);
- const DATA_TYPE mean = (DATA_TYPE)mean_float;
- const float var_float = (sum_sq / elements_plane) - (mean_float * mean_float);
- const float multip_float = GAMMA / sqrt(var_float + EPSILON);
- const DATA_TYPE multip = (DATA_TYPE)multip_float;
+ const INTERNAL_DATA_TYPE mean = (sum / elements_plane);
+ const INTERNAL_DATA_TYPE var = (sum_sq / elements_plane) - (mean * mean);
+ const INTERNAL_DATA_TYPE multip = GAMMA / sqrt(var + EPSILON);
#if defined(NHWC)
@@ -150,7 +148,7 @@ __kernel void instance_normalization(
#else /* !IN_PLACE */
__global DATA_TYPE *output_address = (__global DATA_TYPE *)tensor4D_offset(&out, ch, i_w, i_h, batch);
#endif /* IN_PLACE */
- *(output_address) = (*(input_address) - mean) * multip + (DATA_TYPE)BETA;
+ *(output_address) = (*(input_address) - mean) * multip + (INTERNAL_DATA_TYPE)BETA;
}
}
@@ -167,13 +165,13 @@ __kernel void instance_normalization(
__global DATA_TYPE *output_address = (__global DATA_TYPE *)tensor4D_offset(&out, x, y, ch, batch);
#endif /* IN_PLACE */
- VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
- data = VLOAD(VEC_SIZE)(0, input_address);
+ VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE)
+ data = CONVERT(VLOAD(VEC_SIZE)(0, input_address), VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE));
- VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)
- res = (data - mean) * multip + (DATA_TYPE)BETA;
+ VEC_DATA_TYPE(INTERNAL_DATA_TYPE, VEC_SIZE)
+ res = (data - mean) * multip + (INTERNAL_DATA_TYPE)BETA;
VSTORE(VEC_SIZE)
- (res, 0, output_address);
+ (CONVERT(res, VEC_DATA_TYPE(DATA_TYPE, VEC_SIZE)), 0, output_address);
}
// Left-overs loop
for(; x < DIM_X; ++x)
@@ -184,9 +182,9 @@ __kernel void instance_normalization(
#else /* !IN_PLACE */
__global DATA_TYPE *output_address = (__global DATA_TYPE *)tensor4D_offset(&out, x, y, ch, batch);
#endif /* IN_PLACE */
- *(output_address) = (*(input_address) - mean) * multip + (DATA_TYPE)BETA;
+ *(output_address) = (*(input_address) - mean) * multip + (INTERNAL_DATA_TYPE)BETA;
}
}
#endif // defined(NHWC)
}
-#endif /* defined(VEC_SIZE) && defined(DATA_TYPE) && defined(GAMMA) && defined(BETA) && defined(EPSILON) && defined(DIM_X) && defined(DIM_Y) && defined(DIM_Z) */
+#endif /* defined(VEC_SIZE) && defined(DATA_TYPE) && defined(INTERNAL_DATA_TYPE) && defined(GAMMA) && defined(BETA) && defined(EPSILON) && defined(DIM_X) && defined(DIM_Y) && defined(DIM_Z) */
diff --git a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp
index 0f208573a1..5c2a3d993c 100644
--- a/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp
+++ b/src/core/CL/kernels/CLInstanceNormalizationLayerKernel.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -38,12 +38,9 @@ namespace arm_compute
{
namespace
{
-Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, float gamma, float beta, float epsilon)
+Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info)
{
- ARM_COMPUTE_UNUSED(gamma);
- ARM_COMPUTE_UNUSED(beta);
- ARM_COMPUTE_RETURN_ERROR_ON_MSG(epsilon == 0.f, "Epsilon must be different than 0");
-
+ ARM_COMPUTE_RETURN_ERROR_ON_MSG(info.epsilon == 0.f, "Epsilon must be different than 0");
ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_NOT_IN(input, DataType::F16, DataType::F32);
if(output != nullptr && output->total_size() != 0)
@@ -74,33 +71,31 @@ std::tuple<Status, Window> validate_and_configure_window(ITensorInfo *input, ITe
} // namespace
CLInstanceNormalizationLayerKernel::CLInstanceNormalizationLayerKernel()
- : _input(nullptr), _output(nullptr), _gamma(1), _beta(0), _epsilon(1e-12), _run_in_place(false)
+ : _input(nullptr), _output(nullptr), _run_in_place(false)
{
}
-void CLInstanceNormalizationLayerKernel::configure(ICLTensor *input, ICLTensor *output, float gamma, float beta, float epsilon)
+void CLInstanceNormalizationLayerKernel::configure(ICLTensor *input, ICLTensor *output, const InstanceNormalizationLayerKernelInfo &info)
{
ARM_COMPUTE_ERROR_ON_NULLPTR(input);
- _input = input;
- _output = output == nullptr ? input : output;
- _gamma = gamma;
- _beta = beta;
- _epsilon = epsilon;
+ _input = input;
+ _output = output == nullptr ? input : output;
_run_in_place = (output == nullptr) || (output == input);
- ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(_input->info(), _output->info(), gamma, beta, epsilon));
+ ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(_input->info(), _output->info(), info));
const unsigned int num_elems_processed_per_iteration = 16 / input->info()->element_size();
CLBuildOptions build_opts;
build_opts.add_option("-DDATA_TYPE=" + get_cl_type_from_data_type(input->info()->data_type()));
+ build_opts.add_option("-DINTERNAL_DATA_TYPE=" + (info.use_mixed_precision ? "float" : 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)));
build_opts.add_option("-DDIM_Y=" + support::cpp11::to_string(input->info()->dimension(1)));
build_opts.add_option("-DDIM_Z=" + support::cpp11::to_string(input->info()->dimension(2)));
- build_opts.add_option("-DGAMMA=" + float_to_string_with_full_precision(gamma));
- build_opts.add_option("-DBETA=" + float_to_string_with_full_precision(beta));
- build_opts.add_option("-DEPSILON=" + float_to_string_with_full_precision(epsilon));
+ build_opts.add_option("-DGAMMA=" + float_to_string_with_full_precision(info.gamma));
+ build_opts.add_option("-DBETA=" + float_to_string_with_full_precision(info.beta));
+ build_opts.add_option("-DEPSILON=" + float_to_string_with_full_precision(info.epsilon));
build_opts.add_option_if(_run_in_place, "-DIN_PLACE");
build_opts.add_option_if(_input->info()->data_layout() == DataLayout::NHWC, "-DNHWC");
@@ -113,9 +108,9 @@ void CLInstanceNormalizationLayerKernel::configure(ICLTensor *input, ICLTensor *
ICLKernel::configure_internal(std::get<1>(win_config));
}
-Status CLInstanceNormalizationLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, float gamma, float beta, float epsilon)
+Status CLInstanceNormalizationLayerKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const InstanceNormalizationLayerKernelInfo &info)
{
- ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, gamma, beta, epsilon));
+ ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, info));
ARM_COMPUTE_RETURN_ON_ERROR(std::get<0>(validate_and_configure_window(input->clone().get(), (output == nullptr ? input->clone().get() : output->clone().get()))));
return Status{};
}
diff --git a/src/runtime/CL/functions/CLInstanceNormalizationLayer.cpp b/src/runtime/CL/functions/CLInstanceNormalizationLayer.cpp
index 2b0987fa2f..e639e74394 100644
--- a/src/runtime/CL/functions/CLInstanceNormalizationLayer.cpp
+++ b/src/runtime/CL/functions/CLInstanceNormalizationLayer.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2020 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -32,15 +32,15 @@ CLInstanceNormalizationLayer::CLInstanceNormalizationLayer()
{
}
-void CLInstanceNormalizationLayer::configure(ICLTensor *input, ICLTensor *output, float gamma, float beta, float epsilon)
+void CLInstanceNormalizationLayer::configure(ICLTensor *input, ICLTensor *output, float gamma, float beta, float epsilon, bool use_mixed_precision)
{
auto k = arm_compute::support::cpp14::make_unique<CLInstanceNormalizationLayerKernel>();
- k->configure(input, output, gamma, beta, epsilon);
+ k->configure(input, output, InstanceNormalizationLayerKernelInfo(gamma, beta, epsilon, use_mixed_precision));
_kernel = std::move(k);
}
-Status CLInstanceNormalizationLayer::validate(const ITensorInfo *input, const ITensorInfo *output, float gamma, float beta, float epsilon)
+Status CLInstanceNormalizationLayer::validate(const ITensorInfo *input, const ITensorInfo *output, float gamma, float beta, float epsilon, bool use_mixed_precision)
{
- return CLInstanceNormalizationLayerKernel::validate(input, output, gamma, beta, epsilon);
+ return CLInstanceNormalizationLayerKernel::validate(input, output, InstanceNormalizationLayerKernelInfo(gamma, beta, epsilon, use_mixed_precision));
}
} // namespace arm_compute \ No newline at end of file