5 #include <boost/test/unit_test.hpp> 7 #include "../TfLiteParser.hpp" 16 explicit GetTensorIdsFixture(
const std::string& inputs,
const std::string& outputs)
21 "operator_codes": [ { "builtin_code": "AVERAGE_POOL_2D" } ], 26 "shape": [ 1, 1, 1, 1 ] , 29 "name": "OutputTensor", 38 "shape": [ 1, 2, 2, 1 ] , 41 "name": "InputTensor", 60 "builtin_options_type": "Pool2DOptions", 68 "fused_activation_function": "NONE" 70 "custom_options_format": "FLEXBUFFERS" 74 "description": "Test loading a model", 75 "buffers" : [ {}, {} ] 82 struct GetEmptyTensorIdsFixture : GetTensorIdsFixture
84 GetEmptyTensorIdsFixture() : GetTensorIdsFixture(
"[ ]",
"[ ]") {}
87 struct GetInputOutputTensorIdsFixture : GetTensorIdsFixture
89 GetInputOutputTensorIdsFixture() : GetTensorIdsFixture(
"[ 0, 1, 2 ]",
"[ 3 ]") {}
95 m_GraphBinary.size());
96 std::vector<int32_t> expectedIds = { };
97 std::vector<int32_t> inputTensorIds = TfLiteParserImpl::GetInputTensorIds(model, 0, 0);
98 BOOST_CHECK_EQUAL_COLLECTIONS(expectedIds.begin(), expectedIds.end(),
99 inputTensorIds.begin(), inputTensorIds.end());
105 m_GraphBinary.size());
106 std::vector<int32_t> expectedIds = { };
107 std::vector<int32_t> outputTensorIds = TfLiteParserImpl::GetOutputTensorIds(model, 0, 0);
108 BOOST_CHECK_EQUAL_COLLECTIONS(expectedIds.begin(), expectedIds.end(),
109 outputTensorIds.begin(), outputTensorIds.end());
115 m_GraphBinary.size());
116 std::vector<int32_t> expectedInputIds = { 0, 1, 2 };
117 std::vector<int32_t> inputTensorIds = TfLiteParserImpl::GetInputTensorIds(model, 0, 0);
118 BOOST_CHECK_EQUAL_COLLECTIONS(expectedInputIds.begin(), expectedInputIds.end(),
119 inputTensorIds.begin(), inputTensorIds.end());
125 m_GraphBinary.size());
126 std::vector<int32_t> expectedOutputIds = { 3 };
127 std::vector<int32_t> outputTensorIds = TfLiteParserImpl::GetOutputTensorIds(model, 0, 0);
128 BOOST_CHECK_EQUAL_COLLECTIONS(expectedOutputIds.begin(), expectedOutputIds.end(),
129 outputTensorIds.begin(), outputTensorIds.end());
145 m_GraphBinary.size());
152 m_GraphBinary.size());
159 m_GraphBinary.size());
166 m_GraphBinary.size());
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(GetEmptyInputTensorIds, GetEmptyTensorIdsFixture)
TfLiteParserImpl::ModelPtr ModelPtr
bool ReadStringToBinary()
BOOST_AUTO_TEST_SUITE_END()