From 563494c2f447e201e88e6d7133a41e12971777eb Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Mon, 30 Apr 2018 17:29:41 +0100 Subject: COMPMID-1084 Rework the way validation is performed for NHWC data layout Change-Id: I00b95f560548da76718298b642c8166f92421097 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/129520 Tested-by: Jenkins Reviewed-by: Michele DiGiorgio Reviewed-by: Anthony Barbier --- .../fixtures/DepthwiseConvolutionLayerFixture.h | 27 +++++++++++----------- 1 file changed, 13 insertions(+), 14 deletions(-) (limited to 'tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h') diff --git a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h index b7bca8dbf3..2f01f43d8b 100644 --- a/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h +++ b/tests/validation/fixtures/DepthwiseConvolutionLayerFixture.h @@ -70,15 +70,8 @@ public: weights_shape.set(2, out_shape.z()); const TensorShape biases_shape(weights_shape[2]); - if(data_layout == DataLayout::NHWC) - { - permute(in_shape, PermutationVector(2U, 0U, 1U)); - permute(weights_shape, PermutationVector(2U, 0U, 1U)); - permute(out_shape, PermutationVector(2U, 0U, 1U)); - } - _target = compute_target(in_shape, weights_shape, biases_shape, out_shape, pad_stride_info, depth_multiplier, data_type, bias_data_type, quantization_info, data_layout); - _reference = compute_reference(in_shape, weights_shape, biases_shape, out_shape, pad_stride_info, depth_multiplier, data_type, bias_data_type, quantization_info, data_layout); + _reference = compute_reference(in_shape, weights_shape, biases_shape, out_shape, pad_stride_info, depth_multiplier, data_type, bias_data_type, quantization_info); } protected: @@ -111,10 +104,16 @@ protected: } } - TensorType compute_target(const TensorShape &input_shape, const TensorShape &weights_shape, const TensorShape &biases_shape, const TensorShape &output_shape, PadStrideInfo &pad_stride_info, - unsigned int depth_multiplier, + TensorType compute_target(TensorShape input_shape, TensorShape weights_shape, TensorShape biases_shape, TensorShape output_shape, PadStrideInfo &pad_stride_info, unsigned int depth_multiplier, const DataType data_type, const DataType bias_data_type, const QuantizationInfo quantization_info, const DataLayout data_layout) { + if(data_layout == DataLayout::NHWC) + { + permute(input_shape, PermutationVector(2U, 0U, 1U)); + permute(weights_shape, PermutationVector(2U, 0U, 1U)); + permute(output_shape, PermutationVector(2U, 0U, 1U)); + } + // Create tensors TensorType src = create_tensor(input_shape, data_type, 1, 0, quantization_info, data_layout); TensorType weights = create_tensor(weights_shape, data_type, 1, 0, quantization_info, data_layout); @@ -154,11 +153,11 @@ protected: SimpleTensor compute_reference(const TensorShape &in_shape, const TensorShape &weights_shape, const TensorShape &biases_shape, const TensorShape &out_shape, const PadStrideInfo &pad_stride_info, unsigned int depth_multiplier, - const DataType data_type, const DataType bias_data_type, const QuantizationInfo quantization_info, const DataLayout data_layout) + const DataType data_type, const DataType bias_data_type, const QuantizationInfo quantization_info) { - SimpleTensor src{ in_shape, data_type, 1, 0, quantization_info, data_layout }; - SimpleTensor weights{ weights_shape, data_type, 1, 0, quantization_info, data_layout }; - SimpleTensor biases{ biases_shape, bias_data_type, 1, 0, quantization_info, data_layout }; + SimpleTensor src{ in_shape, data_type, 1, 0, quantization_info }; + SimpleTensor weights{ weights_shape, data_type, 1, 0, quantization_info }; + SimpleTensor biases{ biases_shape, bias_data_type, 1, 0, quantization_info }; fill(src, 0); fill(weights, 1); -- cgit v1.2.1