aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/InstanceNormalizationLayerFixture.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/fixtures/InstanceNormalizationLayerFixture.h')
-rw-r--r--tests/validation/fixtures/InstanceNormalizationLayerFixture.h16
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/validation/fixtures/InstanceNormalizationLayerFixture.h b/tests/validation/fixtures/InstanceNormalizationLayerFixture.h
index 5e230d4430..c26dd99f02 100644
--- a/tests/validation/fixtures/InstanceNormalizationLayerFixture.h
+++ b/tests/validation/fixtures/InstanceNormalizationLayerFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2019 ARM Limited.
+ * Copyright (c) 2019-2021, 2023 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -44,7 +44,6 @@ template <typename TensorType, typename AccessorType, typename FunctionType, typ
class InstanceNormalizationLayerValidationFixture : public framework::Fixture
{
public:
- template <typename...>
void setup(TensorShape shape, DataType data_type, DataLayout data_layout, bool in_place)
{
_target = compute_target(shape, data_type, data_layout, in_place);
@@ -55,7 +54,10 @@ protected:
template <typename U>
void fill(U &&tensor)
{
- std::uniform_real_distribution<> distribution(1.f, 2.f);
+ static_assert(std::is_floating_point<T>::value || std::is_same<T, half>::value, "Only floating point data types supported.");
+ using DistributionType = typename std::conditional<std::is_same<T, half>::value, arm_compute::utils::uniform_real_distribution_16bit<T>, std::uniform_real_distribution<T>>::type;
+
+ DistributionType distribution{ T(1.0f), T(2.0f) };
library->fill(tensor, distribution, 0);
}
@@ -83,10 +85,10 @@ protected:
FunctionType instance_norm_func;
instance_norm_func.configure(&src, in_place ? nullptr : &dst, gamma, beta, epsilon);
- ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_ASSERT(src.info()->is_resizable());
if(!in_place)
{
- ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_ASSERT(dst.info()->is_resizable());
}
// Allocate tensors
@@ -96,10 +98,10 @@ protected:
dst.allocator()->allocate();
}
- ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_ASSERT(!src.info()->is_resizable());
if(!in_place)
{
- ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_ASSERT(!dst.info()->is_resizable());
}
// Fill tensors