arm_compute v18.03
Change-Id: I8f9a2a9d32a6cab019b8504d313216f28671f9f5
diff --git a/tests/validation/CL/DepthConcatenateLayer.cpp b/tests/validation/CL/DepthConcatenateLayer.cpp
index bed2a45..725af88 100644
--- a/tests/validation/CL/DepthConcatenateLayer.cpp
+++ b/tests/validation/CL/DepthConcatenateLayer.cpp
@@ -42,6 +42,27 @@
TEST_SUITE(CL)
TEST_SUITE(DepthConcatenateLayer)
+TEST_CASE(Configuration, framework::DatasetMode::ALL)
+{
+ // Create tensors
+ CLTensor src1 = create_tensor<CLTensor>(TensorShape(32U, 32U, 128U), DataType::F32, 1);
+ CLTensor src2 = create_tensor<CLTensor>(TensorShape(32U, 32U, 32U), DataType::F32, 1);
+ CLTensor dst;
+
+ ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ CLDepthConcatenateLayer concat_layer;
+
+ concat_layer.configure({ &src1, &src2 }, &dst);
+
+ // Validate valid region
+ const ValidRegion valid_region = shape_to_valid_region(TensorShape(32U, 32U, 160U));
+ validate(dst.info()->valid_region(), valid_region);
+}
+
template <typename T>
using CLDepthConcatenateLayerFixture = DepthConcatenateLayerValidationFixture<CLTensor, ICLTensor, CLAccessor, CLDepthConcatenateLayer, T>;
diff --git a/tests/validation/CL/GEMM.cpp b/tests/validation/CL/GEMM.cpp
index 5f53d6f..3712de9 100644
--- a/tests/validation/CL/GEMM.cpp
+++ b/tests/validation/CL/GEMM.cpp
@@ -49,7 +49,9 @@
{
namespace
{
-RelativeTolerance<float> tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
+RelativeTolerance<float> tolerance_f32(0.001f); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
+constexpr float abs_tolerance_f32(
+ 0.0001f); /**< Absolute tolerance value for comparing reference's output against implementation's output for floating point data types in case using relative tolerance fails because of small values */
RelativeTolerance<half_float::half> tolerance_f16(half(0.2)); /**< Tolerance value for comparing reference's output against implementation's output for floating point data types */
constexpr AbsoluteTolerance<float> tolerance_q(1.0f); /**< Tolerance value for comparing reference's output against implementation's output for fixed point data types */
constexpr float tolerance_num = 0.02f; /**< Tolerance number */
@@ -198,7 +200,7 @@
FIXTURE_DATA_TEST_CASE(RunLarge, CLGEMMFixture<float>, framework::DatasetMode::NIGHTLY, combine(datasets::LargeGEMMDataset(), framework::dataset::make("DataType", DataType::F32)))
{
// Validate output
- validate(CLAccessor(_target), _reference, tolerance_f32);
+ validate(CLAccessor(_target), _reference, tolerance_f32, 0.f, abs_tolerance_f32);
}
TEST_SUITE_END()
TEST_SUITE_END()
diff --git a/tests/validation/NEON/DepthConcatenateLayer.cpp b/tests/validation/NEON/DepthConcatenateLayer.cpp
index f6df1fb..c3bb8a9 100644
--- a/tests/validation/NEON/DepthConcatenateLayer.cpp
+++ b/tests/validation/NEON/DepthConcatenateLayer.cpp
@@ -42,6 +42,27 @@
TEST_SUITE(NEON)
TEST_SUITE(DepthConcatenateLayer)
+TEST_CASE(Configuration, framework::DatasetMode::ALL)
+{
+ // Create tensors
+ Tensor src1 = create_tensor<Tensor>(TensorShape(32U, 32U, 128U), DataType::F32, 1);
+ Tensor src2 = create_tensor<Tensor>(TensorShape(32U, 32U, 32U), DataType::F32, 1);
+ Tensor dst;
+
+ ARM_COMPUTE_EXPECT(src1.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(src2.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+
+ // Create and configure function
+ NEDepthConcatenateLayer concat_layer;
+
+ concat_layer.configure({ &src1, &src2 }, &dst);
+
+ // Validate valid region
+ const ValidRegion valid_region = shape_to_valid_region(TensorShape(32U, 32U, 160U));
+ validate(dst.info()->valid_region(), valid_region);
+}
+
template <typename T>
using NEDepthConcatenateLayerFixture = DepthConcatenateLayerValidationFixture<Tensor, ITensor, Accessor, NEDepthConcatenateLayer, T>;
diff --git a/tests/validation/Validation.h b/tests/validation/Validation.h
index 8ed22c2..5063180 100644
--- a/tests/validation/Validation.h
+++ b/tests/validation/Validation.h
@@ -180,7 +180,7 @@
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value = U(), float tolerance_number = 0.f, float absolute_tolerance_value = 0.f);
/** Validate tensors with valid region.
*
@@ -193,7 +193,7 @@
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value = U(), float tolerance_number = 0.f, float absolute_tolerance_value = 0.f);
/** Validate tensors with valid mask.
*
@@ -206,7 +206,8 @@
* other test cases.
*/
template <typename T, typename U = AbsoluteTolerance<T>>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value = U(), float tolerance_number = 0.f);
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value = U(), float tolerance_number = 0.f,
+ float absolute_tolerance_value = 0.f);
/** Validate tensors against constant value.
*
@@ -317,10 +318,10 @@
};
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
// Validate with valid region covering the entire shape
- validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number);
+ validate(tensor, reference, shape_to_valid_region(tensor.shape()), tolerance_value, tolerance_number, absolute_tolerance_value);
}
template <typename T, typename U, typename = typename std::enable_if<std::is_integral<T>::value>::type>
@@ -331,7 +332,7 @@
}
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const ValidRegion &valid_region, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
int64_t num_mismatches = 0;
int64_t num_elements = 0;
@@ -363,11 +364,16 @@
const T &target_value = reinterpret_cast<const T *>(tensor(id))[c];
const T &reference_value = reinterpret_cast<const T *>(reference(id))[c];
- // Truncate numbers to the 4th decimal
- const T target_truncated_value = static_cast<T>(static_cast<int>(target_value * 10000) / 10000);
- const T reference_truncated_value = static_cast<T>(static_cast<int>(target_value * 10000) / 10000);
- if(!compare<U>(target_truncated_value, reference_truncated_value, tolerance_value))
+ if(!compare<U>(target_value, reference_value, tolerance_value))
{
+ if(absolute_tolerance_value != 0.f)
+ {
+ const AbsoluteTolerance<float> abs_tolerance(absolute_tolerance_value);
+ if(compare<AbsoluteTolerance<float>>(target_value, reference_value, abs_tolerance))
+ {
+ continue;
+ }
+ }
ARM_COMPUTE_TEST_INFO("id = " << id);
ARM_COMPUTE_TEST_INFO("channel = " << c);
ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value));
@@ -477,7 +483,7 @@
}
template <typename T, typename U>
-void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value, float tolerance_number)
+void validate(const IAccessor &tensor, const SimpleTensor<T> &reference, const SimpleTensor<T> &valid_mask, U tolerance_value, float tolerance_number, float absolute_tolerance_value)
{
int64_t num_mismatches = 0;
int64_t num_elements = 0;
@@ -511,6 +517,14 @@
if(!compare<U>(target_value, reference_value, tolerance_value))
{
+ if(absolute_tolerance_value != 0.f)
+ {
+ const AbsoluteTolerance<float> abs_tolerance(absolute_tolerance_value);
+ if(compare<AbsoluteTolerance<float>>(target_value, reference_value, abs_tolerance))
+ {
+ continue;
+ }
+ }
ARM_COMPUTE_TEST_INFO("id = " << id);
ARM_COMPUTE_TEST_INFO("channel = " << c);
ARM_COMPUTE_TEST_INFO("target = " << std::setprecision(5) << framework::make_printable(target_value));
diff --git a/tests/validation/fixtures/DepthConcatenateLayerFixture.h b/tests/validation/fixtures/DepthConcatenateLayerFixture.h
index e7fe634..6e112c7 100644
--- a/tests/validation/fixtures/DepthConcatenateLayerFixture.h
+++ b/tests/validation/fixtures/DepthConcatenateLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -51,12 +51,12 @@
{
// Create input shapes
std::mt19937 gen(library->seed());
- std::uniform_int_distribution<> num_dis(2, 6);
+ std::uniform_int_distribution<> num_dis(2, 4);
const int num_tensors = num_dis(gen);
std::vector<TensorShape> shapes(num_tensors, shape);
- std::uniform_int_distribution<> depth_dis(1, 7);
- std::bernoulli_distribution mutate_dis(0.25f);
+ std::uniform_int_distribution<> depth_dis(1, 3);
+ std::bernoulli_distribution mutate_dis(0.5f);
std::uniform_real_distribution<> change_dis(-0.25f, 0.f);
// Generate more shapes based on the input