From 8d94269d7985b9cee67e52581e2f58b6c99d7f0d Mon Sep 17 00:00:00 2001 From: John Kesapides Date: Tue, 26 Feb 2019 14:52:12 +0000 Subject: COMPMID-1492 Create tests/validate_examples/graph_depthwise_convolution Add new validate graph example and unify common example code Change-Id: Ibfd7ae2067ad805d6c82d953fe3febfbea961149 Signed-off-by: John Kesapides Reviewed-on: https://review.mlplatform.org/c/825 Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins Reviewed-by: Georgios Pinitas --- .../validation/reference/DepthwiseConvolutionLayer.cpp | 17 ++++++++++++----- tests/validation/reference/DepthwiseConvolutionLayer.h | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) (limited to 'tests/validation') diff --git a/tests/validation/reference/DepthwiseConvolutionLayer.cpp b/tests/validation/reference/DepthwiseConvolutionLayer.cpp index f27610afb8..122dbd4d98 100644 --- a/tests/validation/reference/DepthwiseConvolutionLayer.cpp +++ b/tests/validation/reference/DepthwiseConvolutionLayer.cpp @@ -50,8 +50,10 @@ namespace reference */ template SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &biases, const TensorShape &dst_shape, const PadStrideInfo &conv_info, - unsigned int depth_multiplier, const Size2D &dilation) + unsigned int depth_multiplier, const Size2D &dilation, QuantizationInfo out_quant_info) { + ARM_COMPUTE_UNUSED(out_quant_info); + SimpleTensor dst{ dst_shape, src.data_type(), 1 }; // Compute reference @@ -119,9 +121,14 @@ SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTe template <> SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &biases, const TensorShape &dst_shape, - const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation) + const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation, QuantizationInfo out_quant_info) { - SimpleTensor dst{ dst_shape, src.data_type(), 1, src.quantization_info() }; + // if no explicit quantization has been set you the same as src + if(out_quant_info == QuantizationInfo(0.0f, 0)) + { + out_quant_info = src.quantization_info(); + } + SimpleTensor dst{ dst_shape, src.data_type(), 1, out_quant_info }; // Create reference const int input_offset = -src.quantization_info().offset; @@ -206,10 +213,10 @@ SimpleTensor depthwise_convolution(const SimpleTensor &src, co } template SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &biases, const TensorShape &dst_shape, - const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation); + const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation, QuantizationInfo out_quant_info); template SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &biases, const TensorShape &dst_shape, - const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation); + const PadStrideInfo &conv_info, unsigned int depth_multiplier, const Size2D &dilation, QuantizationInfo out_quant_info); } // namespace reference } // namespace validation } // namespace test diff --git a/tests/validation/reference/DepthwiseConvolutionLayer.h b/tests/validation/reference/DepthwiseConvolutionLayer.h index 2146611d13..ac70de02ca 100644 --- a/tests/validation/reference/DepthwiseConvolutionLayer.h +++ b/tests/validation/reference/DepthwiseConvolutionLayer.h @@ -37,7 +37,7 @@ namespace reference { template SimpleTensor depthwise_convolution(const SimpleTensor &src, const SimpleTensor &weights, const SimpleTensor &biases, const TensorShape &dst_shape, const PadStrideInfo &conv_info, - unsigned int depth_multiplier, const Size2D &dilation = Size2D(1U, 1U)); + unsigned int depth_multiplier, const Size2D &dilation = Size2D(1U, 1U), QuantizationInfo out_quant_info = QuantizationInfo(0.0f, 0)); } // namespace reference } // namespace validation } // namespace test -- cgit v1.2.1