2 // Copyright © 2019 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
6 #include "ParserFlatbuffersSerializeFixture.hpp"
8 #include "../Deserializer.hpp"
10 #include <boost/test/unit_test.hpp>
14 BOOST_AUTO_TEST_SUITE(Deserializer)
16 struct SliceFixture : public ParserFlatbuffersSerializeFixture
18 explicit SliceFixture(const std::string& inputShape,
19 const std::string& outputShape,
20 const std::string& begin,
21 const std::string& size,
22 const std::string& dataType)
30 layer_type: "InputLayer",
36 layerName: "InputLayer",
40 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
45 dimensions: )" + inputShape + R"(,
46 dataType: )" + dataType + R"(
54 layer_type: "SliceLayer",
58 layerName: "SliceLayer",
62 connection: {sourceLayerIndex:0, outputSlotIndex:0 },
67 dimensions: )" + outputShape + R"(,
68 dataType: )" + dataType + R"(
73 begin: )" + begin + R"(,
74 size: )" + size + R"(,
79 layer_type: "OutputLayer",
85 layerName: "OutputLayer",
89 connection: {sourceLayerIndex:1, outputSlotIndex:0 },
94 dimensions: )" + outputShape + R"(,
95 dataType: )" + dataType + R"(
105 SetupSingleInputSingleOutput("InputLayer", "OutputLayer");
109 struct SimpleSliceFixture : SliceFixture
111 SimpleSliceFixture() : SliceFixture("[ 3, 2, 3, 5 ]", // input shape
112 "[ 2, 1, 2, 3 ]", // output shape
113 "[ 1, 0, 1, 2 ]", // begin
114 "[ 2, 1, 2, 3 ]", // size
115 "Float32") {} // data type
118 BOOST_FIXTURE_TEST_CASE(SimpleSliceFloat32, SimpleSliceFixture)
120 RunTest<4, armnn::DataType::Float32>(
123 0.f, 1.f, 2.f, 3.f, 4.f,
124 5.f, 6.f, 7.f, 8.f, 9.f,
125 10.f, 11.f, 12.f, 13.f, 14.f,
127 15.f, 16.f, 17.f, 18.f, 19.f,
128 20.f, 21.f, 22.f, 23.f, 24.f,
129 25.f, 26.f, 27.f, 28.f, 29.f,
132 30.f, 31.f, 32.f, 33.f, 34.f,
133 35.f, 36.f, 37.f, 38.f, 39.f,
134 40.f, 41.f, 42.f, 43.f, 44.f,
136 45.f, 46.f, 47.f, 48.f, 49.f,
137 50.f, 51.f, 52.f, 53.f, 54.f,
138 55.f, 56.f, 57.f, 58.f, 59.f,
141 60.f, 61.f, 62.f, 63.f, 64.f,
142 65.f, 66.f, 67.f, 68.f, 69.f,
143 70.f, 71.f, 72.f, 73.f, 74.f,
145 75.f, 76.f, 77.f, 78.f, 79.f,
146 80.f, 81.f, 82.f, 83.f, 84.f,
147 85.f, 86.f, 87.f, 88.f, 89.f
158 BOOST_AUTO_TEST_SUITE_END()