aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/validation/Helpers.cpp4
-rw-r--r--tests/validation/Helpers.h7
-rw-r--r--tests/validation/fixtures/DirectConvolutionLayerFixture.h5
3 files changed, 9 insertions, 7 deletions
diff --git a/tests/validation/Helpers.cpp b/tests/validation/Helpers.cpp
index b53d46fc76..0f5d5c5101 100644
--- a/tests/validation/Helpers.cpp
+++ b/tests/validation/Helpers.cpp
@@ -325,7 +325,7 @@ std::pair<int, int> get_symm_quantized_per_channel_bounds(const QuantizationInfo
return std::pair<int, int> { min_bound, max_bound };
}
-void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &data_layout)
+void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &data_layout, bool only_right_pad)
{
if(data_layout == DataLayout::NHWC)
{
@@ -342,7 +342,7 @@ void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &d
std::mt19937 gen(library->seed() + seed_offset++);
const unsigned int right = distribution(gen);
- const unsigned int left = distribution(gen);
+ const unsigned int left = only_right_pad ? 0 : distribution(gen);
tensor->info()->extend_padding(PaddingSize(0U, right, 0U, left));
}
diff --git a/tests/validation/Helpers.h b/tests/validation/Helpers.h
index e06d239307..00e588e7b7 100644
--- a/tests/validation/Helpers.h
+++ b/tests/validation/Helpers.h
@@ -233,12 +233,13 @@ std::pair<int, int> get_symm_quantized_per_channel_bounds(const QuantizationInfo
/** Add random padding along the X axis (between 1 and 16 columns per side) to all the input tensors.
* This is used in our validation suite in order to simulate implicit padding addition after configuring, but before allocating.
*
- * @param[in] tensors List of tensors to add padding to
- * @param[in] data_layout (Optional) Data layout of the operator
+ * @param[in] tensors List of tensors to add padding to
+ * @param[in] data_layout (Optional) Data layout of the operator
+ * @param[in] only_right_pad (Optional) Only right padding testing, in case of cl image padding
*
* @note This function adds padding to the input tensors only if data_layout == DataLayout::NHWC
*/
-void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &data_layout = DataLayout::NHWC);
+void add_padding_x(std::initializer_list<ITensor *> tensors, const DataLayout &data_layout = DataLayout::NHWC, bool only_right_pad = false);
} // namespace validation
} // namespace test
} // namespace arm_compute
diff --git a/tests/validation/fixtures/DirectConvolutionLayerFixture.h b/tests/validation/fixtures/DirectConvolutionLayerFixture.h
index d21a2e7ec3..614aa20753 100644
--- a/tests/validation/fixtures/DirectConvolutionLayerFixture.h
+++ b/tests/validation/fixtures/DirectConvolutionLayerFixture.h
@@ -162,6 +162,9 @@ protected:
TensorType bias = create_tensor<TensorType>(bias_shape, bias_data_type, 1, quantization_info);
TensorType dst = create_tensor<TensorType>(output_shape, data_type, 1, quantization_info, data_layout);
+ add_padding_x({ &src, &bias, &dst }, data_layout);
+ add_padding_x({ &weights }, data_layout, input_shape[0] % 4 == 0); // Don't add left padding if cl image will be used
+
// Create and configure function
FunctionType conv;
conv.configure(&src, &weights, &bias, &dst, info, act_info);
@@ -171,8 +174,6 @@ protected:
ARM_COMPUTE_ASSERT(bias.info()->is_resizable());
ARM_COMPUTE_ASSERT(dst.info()->is_resizable());
- add_padding_x({ &src, &bias, &dst }, data_layout);
-
// Allocate tensors
src.allocator()->allocate();
weights.allocator()->allocate();