11 #include <boost/test/unit_test.hpp> 21 text.append(std::to_string(shape[i])); 28 void octalHelper(
const std::vector<int>& content, std::string& text){
29 for (
unsigned int i = 0; i < content.size(); ++i)
39 const std::vector<int>& beginData,
40 const std::vector<int>& endData,
41 const std::vector<int>& stridesData,
46 int shrinkAxisMask = 0)
62 shapeHelper(inputShape, m_Prototext); 90 octalHelper(beginData, m_Prototext); 117 tensor_content: ")"); 118 octalHelper(endData, m_Prototext); 145 tensor_content: ")"); 146 octalHelper(stridesData, m_Prototext); 192 key: "shrink_axis_mask" 201 Setup({ { "input", inputShape } }, {
"output" });
205 struct StridedSlice4DFixture : StridedSliceFixture
207 StridedSlice4DFixture() : StridedSliceFixture({ 3, 2, 3, 1 },
217 {{
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f,
218 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f,
219 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f }}},
220 {{
"output", { 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f }}});
223 struct StridedSlice4DReverseFixture : StridedSliceFixture
226 StridedSlice4DReverseFixture() : StridedSliceFixture({ 3, 2, 3, 1 },
236 {{
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f,
237 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f,
238 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f }}},
239 {{
"output", { 4.0f, 4.0f, 4.0f, 3.0f, 3.0f, 3.0f }}});
242 struct StridedSliceSimpleStrideFixture : StridedSliceFixture
244 StridedSliceSimpleStrideFixture() : StridedSliceFixture({ 3, 2, 3, 1 },
254 {{
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f,
255 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f,
256 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f }}},
257 {{
"output", { 1.0f, 1.0f,
261 struct StridedSliceSimpleRangeMaskFixture : StridedSliceFixture
263 StridedSliceSimpleRangeMaskFixture() : StridedSliceFixture({ 3, 2, 3, 1 },
275 {{
"input", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f,
276 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f,
277 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f }}},
278 {{
"output", { 1.0f, 1.0f, 1.0f, 2.0f, 2.0f, 2.0f,
279 3.0f, 3.0f, 3.0f, 4.0f, 4.0f, 4.0f,
280 5.0f, 5.0f, 5.0f, 6.0f, 6.0f, 6.0f }}});
unsigned int GetNumDimensions() const
std::string ConvertInt32ToOctalString(int value)
Converts an int value into the Prototxt octal representation.
BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_SUITE(TensorflowLiteParser)
BOOST_FIXTURE_TEST_CASE(StridedSlice4D, StridedSlice4DFixture)