aboutsummaryrefslogtreecommitdiff
path: root/tests/validation/fixtures
diff options
context:
space:
mode:
authorUsama Arif <usama.arif@arm.com>2019-05-10 12:06:28 +0100
committerUsama Arif <usama.arif@arm.com>2019-05-13 09:01:24 +0000
commitf6e475c9a092bc6e0fb53f484fbf2832183a9c44 (patch)
treea6a5f1cd6b48a8615fd942639d2b52c61d5c46be /tests/validation/fixtures
parentbcfd09a14a61bb8457555c61e7c5697b1f901ddb (diff)
downloadComputeLibrary-f6e475c9a092bc6e0fb53f484fbf2832183a9c44.tar.gz
COMPMID-2268: Implement NEG for NEON.
Change-Id: I90c023dbea8ea12e9af677294ba576b2bfcc02a4 Signed-off-by: Usama Arif <usama.arif@arm.com> Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/184216 Tested-by: bsgcomp <bsgcomp@arm.com> Comments-Addressed: bsgcomp <bsgcomp@arm.com> Reviewed-by: Pablo Tello <pablo.tello@arm.com> Reviewed-on: https://review.mlplatform.org/c/1099 Tested-by: Arm Jenkins <bsgcomp@arm.com> Reviewed-by: Pablo Marquez <pablo.tello@arm.com> Comments-Addressed: Arm Jenkins <bsgcomp@arm.com>
Diffstat (limited to 'tests/validation/fixtures')
-rw-r--r--tests/validation/fixtures/ElementWiseUnaryFixture.h41
1 files changed, 37 insertions, 4 deletions
diff --git a/tests/validation/fixtures/ElementWiseUnaryFixture.h b/tests/validation/fixtures/ElementWiseUnaryFixture.h
index f508bc1d34..ba131630a3 100644
--- a/tests/validation/fixtures/ElementWiseUnaryFixture.h
+++ b/tests/validation/fixtures/ElementWiseUnaryFixture.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018 ARM Limited.
+ * Copyright (c) 2018-2019 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -53,7 +53,7 @@ public:
protected:
template <typename U>
- void fill(U &&tensor, int i)
+ void fill(U &&tensor, int i, DataType data_type)
{
switch(_op)
{
@@ -69,6 +69,28 @@ protected:
library->fill(tensor, distribution, i);
break;
}
+ case ElementWiseUnary::NEG:
+ {
+ switch(data_type)
+ {
+ case DataType::F32:
+ case DataType::F16:
+ {
+ std::uniform_real_distribution<> distribution(-2.0f, 2.0f);
+ library->fill(tensor, distribution, i);
+ break;
+ }
+ case DataType::S32:
+ {
+ std::uniform_int_distribution<int32_t> distribution(-100, 100);
+ library->fill(tensor, distribution, i);
+ break;
+ }
+ default:
+ ARM_COMPUTE_ERROR("DataType for Elementwise Negation Not implemented");
+ }
+ break;
+ }
default:
ARM_COMPUTE_ERROR("Not implemented");
}
@@ -95,7 +117,7 @@ protected:
ARM_COMPUTE_EXPECT(!dst.info()->is_resizable(), framework::LogLevel::ERRORS);
// Fill tensors
- fill(AccessorType(src), 0);
+ fill(AccessorType(src), 0, data_type);
// Compute function
elwiseunary_layer.run();
@@ -109,7 +131,7 @@ protected:
SimpleTensor<T> src{ shape, data_type };
// Fill reference
- fill(src, 0);
+ fill(src, 0, data_type);
return reference::elementwise_unary<T>(src, _op);
}
@@ -140,6 +162,17 @@ public:
ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, ElementWiseUnary::EXP);
}
};
+
+template <typename TensorType, typename AccessorType, typename FunctionType, typename T>
+class NegValidationFixture : public ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>
+{
+public:
+ template <typename...>
+ void setup(const TensorShape &shape, DataType data_type)
+ {
+ ElementWiseUnaryValidationFixture<TensorType, AccessorType, FunctionType, T>::setup(shape, data_type, ElementWiseUnary::NEG);
+ }
+};
} // namespace validation
} // namespace test
} // namespace arm_compute