diff options
author | Abe Mbise <abe.mbise@arm.com> | 2018-05-31 16:48:41 +0100 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:54:54 +0000 |
commit | 7784c837afd5844fb6dc4d166ff253d983abfd2d (patch) | |
tree | 3bc770240de148d565aa828e8f3471c354ac3837 /src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp | |
parent | b03f7c5c780fe2df23eb8c5c1b4b1d65bd7f0339 (diff) | |
download | ComputeLibrary-7784c837afd5844fb6dc4d166ff253d983abfd2d.tar.gz |
COMPMID-1167: Validation for NEDepthwiseConvolutionLayer
Change-Id: I9689e1a0627dc015dd2ce98417e4c97bb55581bb
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/131327
Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Tested-by: Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp')
-rw-r--r-- | src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp b/src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp index 47fcf12874..2c7a379c25 100644 --- a/src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp +++ b/src/core/NEON/kernels/NEDepthwiseWeightsReshapeKernel.cpp @@ -77,6 +77,24 @@ void weights_reshape(const ITensor *input, const ITensor *bias, ITensor *output, }, in, out); } + +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(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(biases->dimension(0) != input->dimension(2)); + ARM_COMPUTE_RETURN_ERROR_ON(biases->num_dimensions() > 1); + } + + return Status{}; +} } // namespace NEDepthwiseWeightsReshapeKernel::NEDepthwiseWeightsReshapeKernel() @@ -86,18 +104,9 @@ NEDepthwiseWeightsReshapeKernel::NEDepthwiseWeightsReshapeKernel() void NEDepthwiseWeightsReshapeKernel::configure(const ITensor *input, ITensor *output, const ITensor *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(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))); + ARM_COMPUTE_ERROR_ON_NULLPTR(input, output); - if(biases != nullptr) - { - ARM_COMPUTE_ERROR_ON_MISMATCHING_DATA_TYPES(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_THROW_ON(validate_arguments(input->info(), output->info(), (biases != nullptr) ? biases->info() : nullptr)); _input = input; _output = output; @@ -135,6 +144,13 @@ void NEDepthwiseWeightsReshapeKernel::configure(const ITensor *input, ITensor *o INEKernel::configure(win); } +Status NEDepthwiseWeightsReshapeKernel::validate(const ITensorInfo *input, const ITensorInfo *output, const ITensorInfo *biases) +{ + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, output); + ARM_COMPUTE_RETURN_ON_ERROR(validate_arguments(input, output, biases)); + return Status{}; +} + void NEDepthwiseWeightsReshapeKernel::run(const Window &window, const ThreadInfo &info) { ARM_COMPUTE_UNUSED(info); |