Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2017 Arm Ltd. All rights reserved. |
| 3 | // SPDX-License-Identifier: MIT |
| 4 | // |
| 5 | |
| 6 | #include <boost/test/unit_test.hpp> |
| 7 | #include "ParserFlatbuffersSerializeFixture.hpp" |
Finn Williams | 85d3671 | 2021-01-26 22:30:06 +0000 | [diff] [blame] | 8 | #include <armnnDeserializer/IDeserializer.hpp> |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 9 | |
| 10 | #include <string> |
Finn Williams | dd2ba7e | 2019-03-01 11:51:52 +0000 | [diff] [blame] | 11 | |
| 12 | BOOST_AUTO_TEST_SUITE(Deserializer) |
| 13 | |
| 14 | struct FloorFixture : public ParserFlatbuffersSerializeFixture |
| 15 | { |
| 16 | explicit FloorFixture(const std::string& shape, |
| 17 | const std::string& dataType) |
| 18 | { |
| 19 | m_JsonString = R"( |
| 20 | { |
| 21 | inputIds: [0], |
| 22 | outputIds: [2], |
| 23 | layers: [ |
| 24 | { |
| 25 | layer_type: "InputLayer", |
| 26 | layer: { |
| 27 | base: { |
| 28 | layerBindingId: 0, |
| 29 | base: { |
| 30 | index: 0, |
| 31 | layerName: "InputLayer", |
| 32 | layerType: "Input", |
| 33 | inputSlots: [{ |
| 34 | index: 0, |
| 35 | connection: {sourceLayerIndex:0, outputSlotIndex:0 }, |
| 36 | }], |
| 37 | outputSlots: [ { |
| 38 | index: 0, |
| 39 | tensorInfo: { |
| 40 | dimensions: )" + shape + R"(, |
| 41 | dataType: )" + dataType + R"( |
| 42 | }}] |
| 43 | } |
| 44 | }}}, |
| 45 | { |
| 46 | layer_type: "FloorLayer", |
| 47 | layer: { |
| 48 | base: { |
| 49 | index: 1, |
| 50 | layerName: "FloorLayer", |
| 51 | layerType: "Floor", |
| 52 | inputSlots: [{ |
| 53 | index: 0, |
| 54 | connection: {sourceLayerIndex:0, outputSlotIndex:0 }, |
| 55 | }], |
| 56 | outputSlots: [ { |
| 57 | index: 0, |
| 58 | tensorInfo: { |
| 59 | dimensions: )" + shape + R"(, |
| 60 | dataType: )" + dataType + R"( |
| 61 | |
| 62 | }}]}, |
| 63 | |
| 64 | }}, |
| 65 | { |
| 66 | layer_type: "OutputLayer", |
| 67 | layer: { |
| 68 | base:{ |
| 69 | layerBindingId: 2, |
| 70 | base: { |
| 71 | index: 2, |
| 72 | layerName: "OutputLayer", |
| 73 | layerType: "Output", |
| 74 | inputSlots: [{ |
| 75 | index: 0, |
| 76 | connection: {sourceLayerIndex:1, outputSlotIndex:0 }, |
| 77 | }], |
| 78 | outputSlots: [ { |
| 79 | index: 0, |
| 80 | tensorInfo: { |
| 81 | dimensions: )" + shape + R"(, |
| 82 | dataType: )" + dataType + R"( |
| 83 | }, |
| 84 | }], |
| 85 | }}}, |
| 86 | }] |
| 87 | } |
| 88 | )"; |
| 89 | Setup(); |
| 90 | } |
| 91 | }; |
| 92 | |
| 93 | |
| 94 | struct SimpleFloorFixture : FloorFixture |
| 95 | { |
| 96 | SimpleFloorFixture() : FloorFixture("[ 1, 3, 3, 1 ]", |
| 97 | "Float32") {} |
| 98 | }; |
| 99 | |
| 100 | BOOST_FIXTURE_TEST_CASE(Floor, SimpleFloorFixture) |
| 101 | { |
| 102 | RunTest<4, armnn::DataType::Float32>( |
| 103 | 4, |
| 104 | {{"InputLayer", { -37.5f, -15.2f, -8.76f, -2.0f, -1.5f, -1.3f, -0.5f, -0.4f, 0.0f}}}, |
| 105 | {{"OutputLayer",{ -38.0f, -16.0f, -9.0f, -2.0f, -2.0f, -2.0f, -1.0f, -1.0f, 0.0f}}}); |
| 106 | } |
| 107 | |
| 108 | |
| 109 | BOOST_AUTO_TEST_SUITE_END() |