aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures
diff options
context:
space:
mode:
authorMichele Di Giorgio <michele.digiorgio@arm.com>2018-08-31 16:26:25 +0100
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:54:54 +0000
commitb57be0da77370e5e71fe82dfa281f528279e8127 (patch)
tree2e08acec6363b74f840bad04c3b7195a0bd1b300 /tests/validation/fixtures
parenta34286ecabf4fc9e66e423332063a3d5fb17b8f8 (diff)
downloadComputeLibrary-b57be0da77370e5e71fe82dfa281f528279e8127.tar.gz
COMPMID-1330: Add support for NormalizePlanarYUV operator in CL
Change-Id: Id0754b9e2bc3ef7ff2c4c21c3b89709588c41bd3 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/146637 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Georgios Pinitas <georgios.pinitas@arm.com> Reviewed-by: Giorgio Arena <giorgio.arena@arm.com>
Diffstat (limited to 'tests/validation/fixtures')
-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{};