aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/NEON/MinMaxLocation.cpp
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2017-07-04 17:19:43 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-09-17 14:16:42 +0100
commitef4b4ae784f7533ed6d9e7b51827a894c32ed48e (patch)
tree6f4268044be18c003f5136b8ef7c7c07e219f2bd /tests/validation/NEON/MinMaxLocation.cpp
parentf87cc7f6fef95f9b022725304118796a6a764a7c (diff)
downloadComputeLibrary-ef4b4ae784f7533ed6d9e7b51827a894c32ed48e.tar.gz
COMPMID-438: Add support for floating point Min-Max Location layer.
Change-Id: I84ae564a40fc7320a6f94a84d53906ba51404f51 Reviewed-on: http://mpd-gerrit.cambridge.arm.com/79797 Reviewed-by: Anthony Barbier <anthony.barbier@arm.com> Tested-by: Kaizen <jeremy.johnson+kaizengerrit@arm.com>
Diffstat (limited to 'tests/validation/NEON/MinMaxLocation.cpp')
-rw-r--r--tests/validation/NEON/MinMaxLocation.cpp75
1 files changed, 54 insertions, 21 deletions
diff --git a/tests/validation/NEON/MinMaxLocation.cpp b/tests/validation/NEON/MinMaxLocation.cpp
index b1fa8cd7a9..a467172550 100644
--- a/tests/validation/NEON/MinMaxLocation.cpp
+++ b/tests/validation/NEON/MinMaxLocation.cpp
@@ -51,29 +51,28 @@ using namespace arm_compute::test::validation;
namespace
{
/** Compute Neon MinMaxLocation function.
- *
- * @param[in] shape Shape of the input and output tensors.
- * @param[in] dt_in Data type of first input tensor.
- * @param[out] min Minimum value of tensor
- * @param[out] max Maximum value of tensor
- * @param[out] min_loc Array with locations of minimum values
- * @param[out] max_loc Array with locations of maximum values
- * @param[out] min_count Number of minimum values found
- * @param[out] max_count Number of maximum values found
- *
- * @return Computed output tensor.
- */
-
-void compute_min_max_location(const TensorShape &shape, DataType dt_in, int32_t &min, int32_t &max,
+ *
+ * @param[in] shape Shape of the input and output tensors.
+ * @param[in] dt_in Data type of first input tensor.
+ * @param[out] min Minimum value of tensor
+ * @param[out] max Maximum value of tensor
+ * @param[out] min_loc Array with locations of minimum values
+ * @param[out] max_loc Array with locations of maximum values
+ * @param[out] min_count Number of minimum values found
+ * @param[out] max_count Number of maximum values found
+ *
+ * @return Computed output tensor.
+ */
+
+void compute_min_max_location(const TensorShape &shape, DataType dt_in, void *min, void *max,
Coordinates2DArray &min_loc, Coordinates2DArray &max_loc, uint32_t &min_count, uint32_t &max_count)
{
// Create tensor
Tensor src = create_tensor<Tensor>(shape, dt_in);
- src.info()->set_format((dt_in == DataType::U8) ? Format::U8 : Format::S16);
// Create and configure min_max_location configure function
NEMinMaxLocation min_max_loc;
- min_max_loc.configure(&src, &min, &max, &min_loc, &max_loc, &min_count, &max_count);
+ min_max_loc.configure(&src, min, max, &min_loc, &max_loc, &min_count, &max_count);
// Allocate tensors
src.allocator()->allocate();
@@ -117,6 +116,7 @@ void validate_configuration(const Tensor &src, TensorShape shape)
BOOST_AUTO_TEST_SUITE(NEON)
BOOST_AUTO_TEST_SUITE(MinMaxLocation)
+BOOST_AUTO_TEST_SUITE(Integer)
BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit") * boost::unit_test::label("nightly"))
BOOST_DATA_TEST_CASE(Configuration, (Small2DShapes() + Large2DShapes()) * boost::unit_test::data::make({ DataType::U8, DataType::S16 }),
shape, dt)
@@ -148,10 +148,10 @@ BOOST_DATA_TEST_CASE(RunSmall, Small2DShapes() * boost::unit_test::data::make({
uint32_t ref_max_count;
// Compute function
- compute_min_max_location(shape, dt, min, max, min_loc, max_loc, min_count, max_count);
+ compute_min_max_location(shape, dt, &min, &max, min_loc, max_loc, min_count, max_count);
// Compute reference
- Reference::compute_reference_min_max_location(shape, dt, ref_min, ref_max, ref_min_loc, ref_max_loc, ref_min_count, ref_max_count);
+ Reference::compute_reference_min_max_location(shape, dt, &ref_min, &ref_max, ref_min_loc, ref_max_loc, ref_min_count, ref_max_count);
// Validate output
validate_min_max_loc(min, ref_min, max, ref_max, min_loc, ref_min_loc, max_loc, ref_max_loc, min_count, ref_min_count, max_count, ref_max_count);
@@ -177,15 +177,48 @@ BOOST_DATA_TEST_CASE(RunLarge, Large2DShapes() * boost::unit_test::data::make({
uint32_t ref_max_count;
// Compute function
- compute_min_max_location(shape, dt, min, max, min_loc, max_loc, min_count, max_count);
+ compute_min_max_location(shape, dt, &min, &max, min_loc, max_loc, min_count, max_count);
+
+ // Compute reference
+ Reference::compute_reference_min_max_location(shape, dt, &ref_min, &ref_max, ref_min_loc, ref_max_loc, ref_min_count, ref_max_count);
+
+ // Validate output
+ validate_min_max_loc(min, ref_min, max, ref_max, min_loc, ref_min_loc, max_loc, ref_max_loc, min_count, ref_min_count, max_count, ref_max_count);
+}
+BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE(Float)
+BOOST_TEST_DECORATOR(*boost::unit_test::label("precommit"))
+BOOST_DATA_TEST_CASE(RunSmall, Small2DShapes() * DataType::F32,
+ shape, dt)
+{
+ // Create output storage
+ float min;
+ float max;
+ Coordinates2DArray min_loc(shape.total_size());
+ Coordinates2DArray max_loc(shape.total_size());
+ uint32_t min_count;
+ uint32_t max_count;
+
+ float ref_min;
+ float ref_max;
+ Coordinates2DArray ref_min_loc(shape.total_size());
+ Coordinates2DArray ref_max_loc(shape.total_size());
+ uint32_t ref_min_count;
+ uint32_t ref_max_count;
+
+ // Compute function
+ compute_min_max_location(shape, dt, &min, &max, min_loc, max_loc, min_count, max_count);
// Compute reference
- Reference::compute_reference_min_max_location(shape, dt, ref_min, ref_max, ref_min_loc, ref_max_loc, ref_min_count, ref_max_count);
+ Reference::compute_reference_min_max_location(shape, dt, &ref_min, &ref_max, ref_min_loc, ref_max_loc, ref_min_count, ref_max_count);
// Validate output
validate_min_max_loc(min, ref_min, max, ref_max, min_loc, ref_min_loc, max_loc, ref_max_loc, min_count, ref_min_count, max_count, ref_max_count);
}
BOOST_AUTO_TEST_SUITE_END()
+
+BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE_END()
-#endif /* DOXYGEN_SKIP_THIS */ \ No newline at end of file
+#endif /* DOXYGEN_SKIP_THIS */