From 5c002ec70aa20569d44a3e4c5bbcf53135364e7b Mon Sep 17 00:00:00 2001 From: Giorgio Arena Date: Tue, 12 Oct 2021 16:00:40 +0100 Subject: Add missing common functionalities for DirectConv3D Partially resolves COMPMID-4660 Signed-off-by: Giorgio Arena Change-Id: Iaa659fd9c0ce364e491b04e5ccd1620d69aeca61 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/6417 Reviewed-by: Sheri Zhang Comments-Addressed: Arm Jenkins Tested-by: Arm Jenkins --- tests/validation/Validation.h | 2 +- tests/validation/fixtures/DirectConvolution3DFixture.h | 9 +-------- tests/validation/reference/Conv3D.cpp | 4 ++-- 3 files changed, 4 insertions(+), 11 deletions(-) diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h index f1ce0fecc7..638a1c20ee 100644 --- a/tests/validation/Validation.h +++ b/tests/validation/Validation.h @@ -140,7 +140,7 @@ bool compare_dimensions(const Dimensions &dimensions1, const Dimensions &d { ARM_COMPUTE_ERROR_ON(data_layout == DataLayout::UNKNOWN); - if(data_layout == DataLayout::NCHW) + if(data_layout != DataLayout::NHWC) { if(dimensions1.num_dimensions() != dimensions2.num_dimensions()) { diff --git a/tests/validation/fixtures/DirectConvolution3DFixture.h b/tests/validation/fixtures/DirectConvolution3DFixture.h index 2db6abc9d6..717f6f281e 100644 --- a/tests/validation/fixtures/DirectConvolution3DFixture.h +++ b/tests/validation/fixtures/DirectConvolution3DFixture.h @@ -48,7 +48,7 @@ public: TensorShape weights_shape(num_kernels, input_shape[0], kernel_width, kernel_height, kernel_depth); const TensorShape bias_shape(num_kernels); - const Conv3dInfo conv3d_info(Size3D(stride_x, stride_y, stride_z), Padding3D(pad_x, pad_y, pad_z), act_info, Size3D(), DimensionRoundingType::FLOOR, false); + const Conv3dInfo conv3d_info(Size3D(stride_x, stride_y, stride_z), Padding3D(pad_x, pad_y, pad_z), act_info, Size3D(1U, 1U, 1U), DimensionRoundingType::FLOOR, false); const TensorShape output_shape = compute_conv3d_shape(input_shape, weights_shape, conv3d_info); _target = compute_target(input_shape, weights_shape, bias_shape, output_shape, conv3d_info, has_bias, data_type, data_layout); @@ -87,13 +87,6 @@ protected: TensorType bias = has_bias ? create_tensor(bias_shape, data_type, 1, QuantizationInfo()) : TensorType(); TensorType dst = create_tensor(output_shape, data_type, 1, QuantizationInfo(), data_layout); - add_padding_x({ &src, &dst, &weights }, data_layout); - - if(has_bias) - { - add_padding_x({ &bias }, data_layout); - } - // Create and configure function FunctionType conv{}; conv.configure(&src, &weights, has_bias ? &bias : nullptr, &dst, conv3d_info); diff --git a/tests/validation/reference/Conv3D.cpp b/tests/validation/reference/Conv3D.cpp index 4b0f2b0930..ad61105b36 100644 --- a/tests/validation/reference/Conv3D.cpp +++ b/tests/validation/reference/Conv3D.cpp @@ -141,13 +141,13 @@ SimpleTensor conv3d(const SimpleTensor &src, const SimpleTensor &weight { for(unsigned int z_out = 0; z_out < dst_depth; ++z_out) { - const int z_start = (z_out * stride_z) - pad_left; + const int z_start = (z_out * stride_z) - pad_front; for(unsigned int y_out = 0; y_out < dst_height; ++y_out) { const int y_start = (y_out * stride_y) - pad_top; for(unsigned int x_out = 0; x_out < dst_width; ++x_out) { - const int x_start = (x_out * stride_x) - pad_front; + const int x_start = (x_out * stride_x) - pad_left; for(unsigned int ch_out = 0; ch_out < dst_channels; ++ch_out) { T weighted_value = calculate_conv3d(src, weights, conv3d_info.dilation, batch, z_start, -- cgit v1.2.1