13 explicit ElementWiseUnaryFixture(
const std::string& operatorCode,
14 const std::string& dataType,
15 const std::string& inputShape,
16 const std::string& outputShape)
21 "operator_codes": [ { "builtin_code": )" + operatorCode + R"( } ], 25 "shape": )" + inputShape + R"(, 26 "type": )" + dataType + R"( , 28 "name": "inputTensor", 37 "shape": )" + outputShape + R"( , 38 "type": )" + dataType + R"( , 40 "name": "outputTensor", 56 "custom_options_format": "FLEXBUFFERS" 70 struct SimpleAbsFixture :
public ElementWiseUnaryFixture
72 SimpleAbsFixture() : ElementWiseUnaryFixture(
"ABS",
"FLOAT32",
"[ 2, 2 ]",
"[ 2, 2 ]") {}
77 std::vector<float> inputValues
84 std::vector<float> expectedOutputValues(inputValues.size());
85 for (
unsigned int i = 0; i < inputValues.size(); ++i)
87 expectedOutputValues[i] = std::abs(inputValues[i]);
90 RunTest<2, armnn::DataType::Float32>(0, {{
"inputTensor", { inputValues } }},
91 {{
"outputTensor",{ expectedOutputValues } } });
94 struct SimpleExpFixture :
public ElementWiseUnaryFixture
96 SimpleExpFixture() : ElementWiseUnaryFixture(
"EXP",
"FLOAT32",
"[ 1, 2, 3, 1 ]",
"[ 1, 2, 3, 1 ]") {}
101 RunTest<4, armnn::DataType::Float32>(0, {{
"inputTensor", { 0.0f, 1.0f, 2.0f,
102 3.0f, 4.0f, 5.0f} }},
103 {{
"outputTensor",{ 1.0f, 2.718281f, 7.3890515f,
104 20.0855185f, 54.5980834f, 148.4129329f} } });
107 struct SimpleLogicalNotFixture :
public ElementWiseUnaryFixture
109 SimpleLogicalNotFixture() : ElementWiseUnaryFixture(
"LOGICAL_NOT",
"BOOL",
"[ 1, 1, 1, 4 ]",
"[ 1, 1, 1, 4 ]") {}
114 RunTest<4, armnn::DataType::Boolean>(0, {{
"inputTensor", { 0, 1, 0, 1 } }},
115 {{
"outputTensor",{ 1, 0, 1, 0 } } });
118 struct SimpleNegFixture :
public ElementWiseUnaryFixture
120 SimpleNegFixture() : ElementWiseUnaryFixture(
"NEG",
"FLOAT32",
"[ 1, 2, 3, 1 ]",
"[ 1, 2, 3, 1 ]") {}
125 RunTest<4, armnn::DataType::Float32>(0, {{
"inputTensor", { 0.0f, 1.0f, -2.0f,
126 20.0855185f, -54.5980834f, 5.0f} }},
127 {{
"outputTensor",{ 0.0f, -1.0f, 2.0f,
128 -20.0855185f, 54.5980834f, -5.0f} }});
131 struct SimpleRsqrtFixture :
public ElementWiseUnaryFixture
133 SimpleRsqrtFixture() : ElementWiseUnaryFixture(
"RSQRT",
"FLOAT32",
"[ 1, 2, 3, 1 ]",
"[ 1, 2, 3, 1 ]") {}
138 RunTest<4, armnn::DataType::Float32>(0, {{
"inputTensor", { 1.0f, 4.0f, 16.0f,
139 25.0f, 64.0f, 100.0f } }},
140 {{
"outputTensor",{ 1.0f, 0.5f, 0.25f,
141 0.2f, 0.125f, 0.1f} }});
TEST_SUITE("TensorflowLiteParser_ElementwiseUnary")
TEST_CASE_FIXTURE(ClContextControlFixture, "CopyBetweenNeonAndGpu")
void Setup(bool testDynamic=true)