11 #include <boost/test/unit_test.hpp> 18 const std::vector<unsigned int>& axis,
bool keepDims)
20 std::string protobufAxisString;
21 std::vector<unsigned int> protobufAxis(axis);
25 if (protobufAxis.size() == 0)
29 protobufAxis.push_back(i);
33 for (
unsigned int i = 0; i < protobufAxis.size(); ++i)
74 int_val: )").append(std::to_string(protobufAxis[0])).append(R"( 86 tensor_content: ")").append(protobufAxisString).append(R"(" 113 b: )").append(keepDims ? "true" :
"false").append(R
"( 122 struct MeanNoAxisNoKeepDimsFixture: MeanFixture
124 MeanNoAxisNoKeepDimsFixture() : MeanFixture({ 2, 3 }, { 1 }, {},
false) {}
127 struct MeanWithAxis0NoKeepDimsFixture: MeanFixture
129 MeanWithAxis0NoKeepDimsFixture() : MeanFixture({ 2, 3 }, { 3 }, { 0 },
false) {}
132 struct MeanWithAxis1NoKeepDimsFixture: MeanFixture
134 MeanWithAxis1NoKeepDimsFixture() : MeanFixture({ 2, 3 }, { 2 }, { 1 },
false) {}
137 struct MeanWithAxis0KeepDimsFixture: MeanFixture
139 MeanWithAxis0KeepDimsFixture() : MeanFixture({ 2, 3 }, { 1, 3 }, { 0 },
true) {}
142 struct MeanWithAxis1KeepDimsFixture: MeanFixture
144 MeanWithAxis1KeepDimsFixture() : MeanFixture({ 2, 3 }, { 2, 1 }, { 1 },
true) {}
150 RunTest<1>({ {
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f } } },
151 { {
"output", { 1.5f } } });
156 RunTest<1>({ {
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f } } },
157 { {
"output", { 1.5f, 1.5f, 1.5f } } });
162 RunTest<1>({ {
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f } } },
163 { {
"output", { 1.f, 2.f } } });
168 RunTest<2>({ {
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f } } },
169 { {
"output", { 1.5f, 1.5f, 1.5f } } });
174 RunTest<2>({ {
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f } } },
175 { {
"output", { 1.f, 2.f } } });
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
std::string ConvertInt32ToOctalString(int value)
Converts an int value into the Prototxt octal representation.
BOOST_FIXTURE_TEST_CASE(ParseMeanNoReduce, SimpleMeanNoReduceFixture)
BOOST_AUTO_TEST_SUITE_END()
void SetupSingleInputSingleOutput(const std::string &inputName, const std::string &outputName)
Parses and loads the network defined by the m_Prototext string.
unsigned int GetNumDimensions() const