aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2017-11-08 11:13:23 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:35:24 +0000
commit43ce898014faabbe8ab1cdf714b7aad3d3c9b2a9 (patch)
tree43a2f75b86c39628878b5697a388fefeac77c7ed
parentc1294faa1d60274aa14567338fc2a449c70c1801 (diff)
downloadComputeLibrary-43ce898014faabbe8ab1cdf714b7aad3d3c9b2a9.tar.gz
COMPMID-670 - Extend Sobel tests
Change-Id: Ibf15544e8624977815ee355071a038c07e1f01c2 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/94874 Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com>
-rw-r--r--src/core/NEON/kernels/NESobel7x7Kernel.cpp2
-rw-r--r--tests/validation/CL/Sobel.cpp151
-rw-r--r--tests/validation/CPP/HarrisCornerDetector.cpp2
-rw-r--r--tests/validation/CPP/Sobel.cpp32
-rw-r--r--tests/validation/CPP/Sobel.h3
-rw-r--r--tests/validation/NEON/Sobel.cpp148
-rw-r--r--tests/validation/fixtures/SobelFixture.h29
7 files changed, 325 insertions, 42 deletions
diff --git a/src/core/NEON/kernels/NESobel7x7Kernel.cpp b/src/core/NEON/kernels/NESobel7x7Kernel.cpp
index 4cc80f8e2e..40a3e31a39 100644
--- a/src/core/NEON/kernels/NESobel7x7Kernel.cpp
+++ b/src/core/NEON/kernels/NESobel7x7Kernel.cpp
@@ -286,7 +286,7 @@ void NESobel7x7HorKernel::run(const Window &window, const ThreadInfo &info)
}
};
- const int32x4x2_t out = compute_hor_sobel_x(data_s32);
+ const int32x4x2_t out = compute_hor_sobel_y(data_s32);
vst1q_s32(reinterpret_cast<int32_t *>(output_y.ptr()), out.val[0]);
vst1q_s32(reinterpret_cast<int32_t *>(output_y.ptr()) + 4, out.val[1]);
},
diff --git a/tests/validation/CL/Sobel.cpp b/tests/validation/CL/Sobel.cpp
index cde93e77a9..16f411db3c 100644
--- a/tests/validation/CL/Sobel.cpp
+++ b/tests/validation/CL/Sobel.cpp
@@ -100,8 +100,50 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_y.info()->padding(), dst_padding);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+TEST_SUITE_END()
+
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
@@ -111,8 +153,9 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel3x3Fixture, framework::DatasetMode::PREC
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
@@ -122,6 +165,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel3x3Fixture, framework::DatasetMode::NIGH
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(W5x5)
using CLSobel5x5Fixture = SobelValidationFixture<CLTensor, CLAccessor, CLSobel5x5, uint8_t, int16_t>;
@@ -176,8 +220,48 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_y.info()->padding(), dst_padding);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+TEST_SUITE_END()
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
@@ -187,8 +271,9 @@ FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel5x5Fixture, framework::DatasetMode::PREC
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
@@ -198,6 +283,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel5x5Fixture, framework::DatasetMode::NIGH
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(W7x7)
using CLSobel7x7Fixture = SobelValidationFixture<CLTensor, CLAccessor, CLSobel7x7, uint8_t, int32_t>;
@@ -252,20 +338,60 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_x.info()->padding(), dst_padding);
validate(dst_y.info()->padding(), dst_padding);
}
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
-FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
validate(CLAccessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
+TEST_SUITE_END()
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, CLSobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(CLAccessor(_target.first), _reference.first, valid_region_x);
-FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(CLAccessor(_target.second), _reference.second, valid_region_y);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
@@ -275,6 +401,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, CLSobel7x7Fixture, framework::DatasetMode::NIGH
validate(CLAccessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/CPP/HarrisCornerDetector.cpp b/tests/validation/CPP/HarrisCornerDetector.cpp
index 3babfeed42..6cfcd8ecc5 100644
--- a/tests/validation/CPP/HarrisCornerDetector.cpp
+++ b/tests/validation/CPP/HarrisCornerDetector.cpp
@@ -45,7 +45,7 @@ std::tuple<SimpleTensor<T>, SimpleTensor<T>, float> compute_sobel(const SimpleTe
SimpleTensor<T> grad_y;
float norm_factor = 0.f;
- std::tie(grad_x, grad_y) = sobel<T>(src, gradient_size, border_mode, constant_border_value);
+ std::tie(grad_x, grad_y) = sobel<T>(src, gradient_size, border_mode, constant_border_value, GradientDimension::GRAD_XY);
switch(gradient_size)
{
diff --git a/tests/validation/CPP/Sobel.cpp b/tests/validation/CPP/Sobel.cpp
index 314fbd4f8a..ff0e11d3a8 100644
--- a/tests/validation/CPP/Sobel.cpp
+++ b/tests/validation/CPP/Sobel.cpp
@@ -103,7 +103,7 @@ struct data_type<int>
} // namespace
template <typename T, typename U>
-std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value)
+std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value, GradientDimension gradient_dimension)
{
SimpleTensor<T> dst_x(src.shape(), data_type<T>::value, src.num_channels());
SimpleTensor<T> dst_y(src.shape(), data_type<T>::value, src.num_channels());
@@ -118,18 +118,34 @@ std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, in
{
continue;
}
-
- apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode,
- constant_border_value);
- apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode,
- constant_border_value);
+ switch(gradient_dimension)
+ {
+ case GradientDimension::GRAD_X:
+ apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode,
+ constant_border_value);
+ break;
+ case GradientDimension::GRAD_Y:
+ apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode,
+ constant_border_value);
+ break;
+ case GradientDimension::GRAD_XY:
+ apply_2d_spatial_filter(coord, src, dst_x, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).first, 1.f, border_mode,
+ constant_border_value);
+ apply_2d_spatial_filter(coord, src, dst_y, TensorShape{ static_cast<unsigned int>(filter_size), static_cast<unsigned int>(filter_size) }, masks.at(filter_size).second, 1.f, border_mode,
+ constant_border_value);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Gradient dimension not supported");
+ }
}
return std::make_pair(dst_x, dst_y);
}
-template std::pair<SimpleTensor<int16_t>, SimpleTensor<int16_t>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value);
-template std::pair<SimpleTensor<int>, SimpleTensor<int>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value);
+template std::pair<SimpleTensor<int16_t>, SimpleTensor<int16_t>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value,
+ GradientDimension gradient_dimension);
+template std::pair<SimpleTensor<int>, SimpleTensor<int>> sobel(const SimpleTensor<uint8_t> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value,
+ GradientDimension gradient_dimension);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/CPP/Sobel.h b/tests/validation/CPP/Sobel.h
index ab046639dc..9099f1a932 100644
--- a/tests/validation/CPP/Sobel.h
+++ b/tests/validation/CPP/Sobel.h
@@ -26,6 +26,7 @@
#include "arm_compute/core/Types.h"
#include "tests/SimpleTensor.h"
+#include "tests/Types.h"
namespace arm_compute
{
@@ -36,7 +37,7 @@ namespace validation
namespace reference
{
template <typename T, typename U>
-std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value = 0);
+std::pair<SimpleTensor<T>, SimpleTensor<T>> sobel(const SimpleTensor<U> &src, int filter_size, BorderMode border_mode, uint8_t constant_border_value, GradientDimension gradient_dimension);
} // namespace reference
} // namespace validation
} // namespace test
diff --git a/tests/validation/NEON/Sobel.cpp b/tests/validation/NEON/Sobel.cpp
index 99f9e1ff5d..e757d1db3c 100644
--- a/tests/validation/NEON/Sobel.cpp
+++ b/tests/validation/NEON/Sobel.cpp
@@ -100,19 +100,60 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_y.info()->padding(), dst_padding);
}
-FIXTURE_DATA_TEST_CASE(RunSmall, NESobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
+TEST_SUITE_END()
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel3x3Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(1));
@@ -122,6 +163,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NESobel3x3Fixture, framework::DatasetMode::NIGH
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(W5x5)
using NESobel5x5Fixture = SobelValidationFixture<Tensor, Accessor, NESobel5x5, uint8_t, int16_t>;
@@ -176,9 +218,48 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_x.info()->padding(), dst_padding);
validate(dst_y.info()->padding(), dst_padding);
}
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
-FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
+TEST_SUITE_END()
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
@@ -188,8 +269,9 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NESobel5x5Fixture, framework::DatasetMode::PREC
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(2));
@@ -199,6 +281,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NESobel5x5Fixture, framework::DatasetMode::NIGH
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE(W7x7)
using NESobel7x7Fixture = SobelValidationFixture<Tensor, Accessor, NESobel7x7, uint8_t, int32_t>;
@@ -253,9 +336,48 @@ DATA_TEST_CASE(Configuration, framework::DatasetMode::ALL, combine(combine(conca
validate(dst_x.info()->padding(), dst_padding);
validate(dst_y.info()->padding(), dst_padding);
}
+TEST_SUITE(X)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
+
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_X)))
+{
+ // Validate output
+ ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(Accessor(_target.first), _reference.first, valid_region_x);
+}
+TEST_SUITE_END()
+TEST_SUITE(Y)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
-FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_Y)))
+{
+ // Validate output
+ ValidRegion valid_region_y = shape_to_valid_region(_reference.second.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
+ validate(Accessor(_target.second), _reference.second, valid_region_y);
+}
+TEST_SUITE_END()
+TEST_SUITE(XY)
+FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PRECOMMIT, combine(combine(combine(datasets::Small2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
@@ -265,8 +387,9 @@ FIXTURE_DATA_TEST_CASE(RunSmall, NESobel7x7Fixture, framework::DatasetMode::PREC
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
-FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
- Format::U8)))
+FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGHTLY, combine(combine(combine(datasets::Large2DShapes(), datasets::BorderModes()), framework::dataset::make("Format",
+ Format::U8)),
+ framework::dataset::make("GradientDimension", GradientDimension::GRAD_XY)))
{
// Validate output
ValidRegion valid_region_x = shape_to_valid_region(_reference.first.shape(), (_border_mode == BorderMode::UNDEFINED), BorderSize(3));
@@ -276,6 +399,7 @@ FIXTURE_DATA_TEST_CASE(RunLarge, NESobel7x7Fixture, framework::DatasetMode::NIGH
validate(Accessor(_target.second), _reference.second, valid_region_y);
}
TEST_SUITE_END()
+TEST_SUITE_END()
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/fixtures/SobelFixture.h b/tests/validation/fixtures/SobelFixture.h
index 2a592b87f7..f8041b9829 100644
--- a/tests/validation/fixtures/SobelFixture.h
+++ b/tests/validation/fixtures/SobelFixture.h
@@ -102,7 +102,7 @@ class SobelValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape, BorderMode border_mode, Format format)
+ void setup(TensorShape shape, BorderMode border_mode, Format format, GradientDimension gradient_dimension)
{
// Generate a random constant value
std::mt19937 gen(library->seed());
@@ -110,8 +110,8 @@ public:
const uint8_t constant_border_value = int_dist(gen);
_border_mode = border_mode;
- _target = compute_target(shape, border_mode, format, constant_border_value);
- _reference = compute_reference(shape, info<FunctionType>::filter_size, border_mode, format, constant_border_value);
+ _target = compute_target(shape, border_mode, format, constant_border_value, gradient_dimension);
+ _reference = compute_reference(shape, info<FunctionType>::filter_size, border_mode, format, constant_border_value, gradient_dimension);
}
protected:
@@ -121,7 +121,7 @@ protected:
library->fill_tensor_uniform(tensor, 0);
}
- std::pair<TensorType, TensorType> compute_target(const TensorShape &shape, BorderMode border_mode, Format format, uint8_t constant_border_value)
+ std::pair<TensorType, TensorType> compute_target(const TensorShape &shape, BorderMode border_mode, Format format, uint8_t constant_border_value, GradientDimension gradient_dimension)
{
// Create tensors
TensorType src = create_tensor<TensorType>(shape, data_type_from_format(format));
@@ -133,7 +133,21 @@ protected:
dst_y.info()->set_format(info<FunctionType>::dst_format);
FunctionType sobel;
- sobel.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value);
+
+ switch(gradient_dimension)
+ {
+ case GradientDimension::GRAD_X:
+ sobel.configure(&src, &dst_x, nullptr, border_mode, constant_border_value);
+ break;
+ case GradientDimension::GRAD_Y:
+ sobel.configure(&src, nullptr, &dst_y, border_mode, constant_border_value);
+ break;
+ case GradientDimension::GRAD_XY:
+ sobel.configure(&src, &dst_x, &dst_y, border_mode, constant_border_value);
+ break;
+ default:
+ ARM_COMPUTE_ERROR("Gradient dimension not supported");
+ }
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst_x.info()->is_resizable(), framework::LogLevel::ERRORS);
@@ -157,7 +171,8 @@ protected:
return std::make_pair(std::move(dst_x), std::move(dst_y));
}
- std::pair<SimpleTensor<U>, SimpleTensor<U>> compute_reference(const TensorShape &shape, int filter_size, BorderMode border_mode, Format format, uint8_t constant_border_value)
+ std::pair<SimpleTensor<U>, SimpleTensor<U>> compute_reference(const TensorShape &shape, int filter_size, BorderMode border_mode, Format format, uint8_t constant_border_value,
+ GradientDimension gradient_dimension)
{
// Create reference
SimpleTensor<T> src{ shape, format };
@@ -165,7 +180,7 @@ protected:
// Fill reference
fill(src);
- return reference::sobel<U>(src, filter_size, border_mode, constant_border_value);
+ return reference::sobel<U>(src, filter_size, border_mode, constant_border_value, gradient_dimension);
}
BorderMode _border_mode{ BorderMode::UNDEFINED };