aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
diff options
context:
space:
mode:
Diffstat (limited to 'tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h')
-rw-r--r--tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
index 09905cfef7..cc73e530ef 100644
--- a/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
+++ b/tests/validation/fixtures/NormalizePlanarYUVLayerFixture.h
@@ -45,16 +45,16 @@ class NormalizePlanarYUVLayerValidationFixture : public framework::Fixture
{
public:
template <typename...>
- void setup(TensorShape shape0, TensorShape shape1, DataType dt)
+ void setup(TensorShape shape0, TensorShape shape1, DataType dt, DataLayout data_layout)
{
_data_type = dt;
- _target = compute_target(shape0, shape1, dt);
+ _target = compute_target(shape0, shape1, dt, data_layout);
_reference = compute_reference(shape0, shape1, dt);
}
protected:
template <typename U>
- void fill(U &&src_tensor, U &&mean_tensor, U &&sd_tensor)
+ void fill(U &&src_tensor, U &&mean_tensor, U &&std_tensor)
{
if(is_data_type_float(_data_type))
{
@@ -62,43 +62,48 @@ protected:
float max_bound = 0.f;
std::tie(min_bound, max_bound) = get_normalize_planar_yuv_layer_test_bounds<T>();
std::uniform_real_distribution<> distribution(min_bound, max_bound);
- std::uniform_real_distribution<> distribution_sd(0.1, max_bound);
+ std::uniform_real_distribution<> distribution_std(0.1, max_bound);
library->fill(src_tensor, distribution, 0);
library->fill(mean_tensor, distribution, 1);
- library->fill(sd_tensor, distribution_sd, 2);
+ library->fill(std_tensor, distribution_std, 2);
}
}
- TensorType compute_target(const TensorShape &shape0, const TensorShape &shape1, DataType dt)
+ TensorType compute_target(TensorShape shape0, const TensorShape &shape1, DataType dt, DataLayout data_layout)
{
+ if(data_layout == DataLayout::NHWC)
+ {
+ permute(shape0, PermutationVector(2U, 0U, 1U));
+ }
+
// Create tensors
- TensorType src = create_tensor<TensorType>(shape0, dt, 1);
- TensorType dst = create_tensor<TensorType>(shape0, dt, 1);
+ TensorType src = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout);
+ TensorType dst = create_tensor<TensorType>(shape0, dt, 1, QuantizationInfo(), data_layout);
TensorType mean = create_tensor<TensorType>(shape1, dt, 1);
- TensorType sd = create_tensor<TensorType>(shape1, dt, 1);
+ TensorType std = create_tensor<TensorType>(shape1, dt, 1);
// Create and configure function
FunctionType norm;
- norm.configure(&src, &dst, &mean, &sd);
+ norm.configure(&src, &dst, &mean, &std);
ARM_COMPUTE_EXPECT(src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(dst.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(mean.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(sd.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(std.info()->is_resizable(), framework::LogLevel::ERRORS);
// Allocate tensors
src.allocator()->allocate();
dst.allocator()->allocate();
mean.allocator()->allocate();
- sd.allocator()->allocate();
+ std.allocator()->allocate();
ARM_COMPUTE_EXPECT(!src.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
ARM_COMPUTE_EXPECT(!mean.info()->is_resizable(), framework::LogLevel::ERRORS);
- ARM_COMPUTE_EXPECT(!sd.info()->is_resizable(), framework::LogLevel::ERRORS);
+ ARM_COMPUTE_EXPECT(!std.info()->is_resizable(), framework::LogLevel::ERRORS);
// Fill tensors
- fill(AccessorType(src), AccessorType(mean), AccessorType(sd));
+ fill(AccessorType(src), AccessorType(mean), AccessorType(std));
// Compute function
norm.run();
@@ -111,12 +116,12 @@ protected:
// Create reference
SimpleTensor<T> ref_src{ shape0, dt, 1 };
SimpleTensor<T> ref_mean{ shape1, dt, 1 };
- SimpleTensor<T> ref_sd{ shape1, dt, 1 };
+ SimpleTensor<T> ref_std{ shape1, dt, 1 };
// Fill reference
- fill(ref_src, ref_mean, ref_sd);
+ fill(ref_src, ref_mean, ref_std);
- return reference::normalize_planar_yuv_layer(ref_src, ref_mean, ref_sd);
+ return reference::normalize_planar_yuv_layer(ref_src, ref_mean, ref_std);
}
TensorType _target{};