ArmNN
 21.05
ElementWiseUnary.cpp File Reference
#include <boost/test/unit_test.hpp>
#include "ParserFlatbuffersFixture.hpp"
#include "../TfLiteParser.hpp"
#include <string>

Go to the source code of this file.

Functions

 BOOST_FIXTURE_TEST_CASE (ParseAbs, SimpleAbsFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseExp, SimpleExpFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseLogicalNot, SimpleLogicalNotFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseNeg, SimpleNegFixture)
 
 BOOST_FIXTURE_TEST_CASE (ParseRsqrt, SimpleRsqrtFixture)
 

Function Documentation

◆ BOOST_FIXTURE_TEST_CASE() [1/5]

BOOST_FIXTURE_TEST_CASE ( ParseAbs  ,
SimpleAbsFixture   
)

Definition at line 78 of file ElementWiseUnary.cpp.

79 {
80  std::vector<float> inputValues
81  {
82  -0.1f, 0.2f,
83  0.3f, -0.4f
84  };
85 
86  // Calculate output data
87  std::vector<float> expectedOutputValues(inputValues.size());
88  for (unsigned int i = 0; i < inputValues.size(); ++i)
89  {
90  expectedOutputValues[i] = std::abs(inputValues[i]);
91  }
92 
93  RunTest<2, armnn::DataType::Float32>(0, {{ "inputTensor", { inputValues } }},
94  {{ "outputTensor",{ expectedOutputValues } } });
95 }

◆ BOOST_FIXTURE_TEST_CASE() [2/5]

BOOST_FIXTURE_TEST_CASE ( ParseExp  ,
SimpleExpFixture   
)

Definition at line 102 of file ElementWiseUnary.cpp.

103 {
104  RunTest<4, armnn::DataType::Float32>(0, {{ "inputTensor", { 0.0f, 1.0f, 2.0f,
105  3.0f, 4.0f, 5.0f} }},
106  {{ "outputTensor",{ 1.0f, 2.718281f, 7.3890515f,
107  20.0855185f, 54.5980834f, 148.4129329f} } });
108 }

◆ BOOST_FIXTURE_TEST_CASE() [3/5]

BOOST_FIXTURE_TEST_CASE ( ParseLogicalNot  ,
SimpleLogicalNotFixture   
)

Definition at line 115 of file ElementWiseUnary.cpp.

116 {
117  RunTest<4, armnn::DataType::Boolean>(0, {{ "inputTensor", { 0, 1, 0, 1 } }},
118  {{ "outputTensor",{ 1, 0, 1, 0 } } });
119 }

◆ BOOST_FIXTURE_TEST_CASE() [4/5]

BOOST_FIXTURE_TEST_CASE ( ParseNeg  ,
SimpleNegFixture   
)

Definition at line 126 of file ElementWiseUnary.cpp.

127 {
128  RunTest<4, armnn::DataType::Float32>(0, {{ "inputTensor", { 0.0f, 1.0f, -2.0f,
129  20.0855185f, -54.5980834f, 5.0f} }},
130  {{ "outputTensor",{ 0.0f, -1.0f, 2.0f,
131  -20.0855185f, 54.5980834f, -5.0f} }});
132 }

◆ BOOST_FIXTURE_TEST_CASE() [5/5]

BOOST_FIXTURE_TEST_CASE ( ParseRsqrt  ,
SimpleRsqrtFixture   
)

Definition at line 139 of file ElementWiseUnary.cpp.

References BOOST_AUTO_TEST_SUITE_END().

140 {
141  RunTest<4, armnn::DataType::Float32>(0, {{ "inputTensor", { 1.0f, 4.0f, 16.0f,
142  25.0f, 64.0f, 100.0f } }},
143  {{ "outputTensor",{ 1.0f, 0.5f, 0.25f,
144  0.2f, 0.125f, 0.1f} }});
145 }