diff options
author | Michalis Spyrou <michalis.spyrou@arm.com> | 2017-11-30 14:25:57 +0000 |
---|---|---|
committer | Anthony Barbier <anthony.barbier@arm.com> | 2018-11-02 16:42:17 +0000 |
commit | afa5d817b1d083837cd7ea30d32f845d82620c12 (patch) | |
tree | 1ca2a27ab7108b7137b96fc1547a8b5ac5d9c8f7 /src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp | |
parent | 631c41a4e3645a948b0f597caa77e8fa91ca0efc (diff) | |
download | ComputeLibrary-afa5d817b1d083837cd7ea30d32f845d82620c12.tar.gz |
COMPMID-617 Add validation methods to Kernels
- NEActivationLayer
- NESoftmax
- NEDirectConvolutionLayer
- NENormalizationLayer
- NEPoolingLayer
Change-Id: Ib279f1c1b7f9247679b0d6593aed7393da8fe87b
Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/111335
Tested-by: BSG Visual Compute Jenkins server to access repositories on http://mpd-gerrit.cambridge.arm.com <bsgcomp@arm.com>
Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
Diffstat (limited to 'src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp')
-rw-r--r-- | src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp index 52a4cc158f..2eabe459a5 100644 --- a/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp +++ b/src/runtime/NEON/functions/NEDirectConvolutionLayer.cpp @@ -85,6 +85,30 @@ void NEDirectConvolutionLayer::configure(ITensor *input, const ITensor *weights, _input_border_handler.configure(input, _conv_kernel.border_size(), BorderMode::CONSTANT, PixelValue(static_cast<float>(0.f))); } +Status NEDirectConvolutionLayer::validate(const ITensorInfo *input, const ITensorInfo *weights, const ITensorInfo *bias, const ITensorInfo *output, const PadStrideInfo &conv_info) +{ + ARM_COMPUTE_RETURN_ERROR_ON_NULLPTR(input, weights, bias, output); + + DataType data_type = output->data_type(); + if(is_data_type_fixed_point(data_type)) + { + // Promote data type in case of fixed point + data_type = ((data_type == DataType::QS8) ? DataType::QS16 : DataType::QS32); + } + TensorInfo accumulator(output->clone()->set_is_resizable(true).reset_padding().set_data_type(data_type)); + + ARM_COMPUTE_RETURN_ERROR_ON_MISMATCHING_DATA_TYPES(weights, bias); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(bias->dimension(0) != weights->dimension(3), + "Biases size and number of input feature maps should match"); + ARM_COMPUTE_RETURN_ERROR_ON_MSG(bias->num_dimensions() > 1, + "Biases should be one dimensional"); + + ARM_COMPUTE_RETURN_ON_ERROR(NEDirectConvolutionLayerKernel::validate(input, weights, &accumulator, conv_info)); + ARM_COMPUTE_RETURN_ON_ERROR(NEDirectConvolutionLayerBiasAccumulateKernel::validate(&accumulator, bias, output)); + + return Status{}; +} + void NEDirectConvolutionLayer::run() { NEScheduler::get().schedule(&_input_border_handler, Window::DimZ); |