diff options
author | Giorgio Arena <giorgio.arena@arm.com> | 2018-04-23 16:16:21 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:51:17 +0000 |
commit | ad0c7388f6261989a268ffb2d042f2bd80736e3f (patch) | |
tree | 84a0f1accc9a7c4b820f150e4265525c08a67ccf /src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp | |
parent | 1ed442a9b4024741860106cd96f5f7535a38fd04 (diff) | |
download | ComputeLibrary-ad0c7388f6261989a268ffb2d042f2bd80736e3f.tar.gz |
COMPMID-1068 Create validate method to CLDepthWiseConvolution
Change-Id: I3301b66a8a072c6ecd0d7f2dabef350017b55ac4
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/128677
Tested-by: Jenkins <bsgcomp@arm.com>
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp')
-rw-r--r-- | src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp b/src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp index 26da96f9ba..b5a607d92e 100644 --- a/src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp +++ b/src/core/CL/kernels/CLDepthwiseWeightsReshapeKernel.cpp @@ -34,6 +34,29 @@ using namespace arm_compute; +namespace +{ +Status validate_arguments(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *biases) +{ + ARM_COMPUTE_RETURN_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::F16, DataType::F32); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_FIXED_POINT(input, output); + ARM_COMPUTE_RETURN_ERROR_ON(is_data_type_quantized_asymmetric(input->data_type()) && (biases != nullptr)); + ARM_COMPUTE_RETURN_ERROR_ON(input->dimension(2) != output->dimension(1)); + ARM_COMPUTE_RETURN_ERROR_ON(output->dimension(0) != (input->dimension(0) * input->dimension(1) + ((biases != nullptr) ? 1 : 0))); + + if(biases != nullptr) + { + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(input, biases); + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_FIXED_POINT(input, biases); + ARM_COMPUTE_RETURN_ERROR_ON(biases->dimension(0) != input->dimension(2)); + ARM_COMPUTE_RETURN_ERROR_ON(biases->num_dimensions() > 1); + } + + return Status{}; +} +} // namespace + CLDepthwiseWeightsReshapeKernel::CLDepthwiseWeightsReshapeKernel() : _input(nullptr), _biases(nullptr), _output(nullptr) { @@ -41,20 +64,8 @@ CLDepthwiseWeightsReshapeKernel::CLDepthwiseWeightsReshapeKernel() void CLDepthwiseWeightsReshapeKernel::configure(const ICLTensor *input, ICLTensor *output, const ICLTensor *biases) { - ARM_COMPUTE_ERROR_ON_DATA_TYPE_CHANNEL_NOT_IN(input, 1, DataType::QASYMM8, DataType::F16, DataType::F32); - ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, output); - ARM_COMPUTE_ERROR_ON_MISMATCHING_FIXED_POINT(input, output); - ARM_COMPUTE_ERROR_ON(is_data_type_quantized_asymmetric(input->info()->data_type()) && (biases != nullptr)); - ARM_COMPUTE_ERROR_ON(input->info()->dimension(2) != output->info()->dimension(1)); - ARM_COMPUTE_ERROR_ON(output->info()->dimension(0) != (input->info()->dimension(0) * input->info()->dimension(1) + ((biases != nullptr) ? 1 : 0))); - - if(biases != nullptr) - { - ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(input, biases); - ARM_COMPUTE_ERROR_ON_MISMATCHING_FIXED_POINT(input, biases); - ARM_COMPUTE_ERROR_ON(biases->info()->dimension(0) != input->info()->dimension(2)); - ARM_COMPUTE_ERROR_ON(biases->info()->num_dimensions() > 1); - } + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_ERROR_THROW_ON(validate_arguments(input->info(), output->info(), (biases != nullptr) ? biases->info() : nullptr)); _input = input; _biases = biases; @@ -80,6 +91,12 @@ void CLDepthwiseWeightsReshapeKernel::configure(const ICLTensor *input, ICLTenso ICLKernel::configure(win); } +Status CLDepthwiseWeightsReshapeKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *biases) +{ + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, biases)); + return Status{}; +} + void CLDepthwiseWeightsReshapeKernel::run(const Window &window, cl::CommandQueue &queue) { ARM_COMPUTE_ERROR_ON_UNCONFIGURED_KERNEL(this); |