Keith Davis | 300ad56 | 2020-06-04 16:34:23 +0100 | [diff] [blame] | 1 | // |
| 2 | // Copyright © 2020 Arm Ltd and Contributors. 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> |
Keith Davis | 300ad56 | 2020-06-04 16:34:23 +0100 | [diff] [blame] | 9 | |
| 10 | #include <string> |
| 11 | |
| 12 | BOOST_AUTO_TEST_SUITE(Deserializer) |
| 13 | |
| 14 | struct FillFixture : public ParserFlatbuffersSerializeFixture |
| 15 | { |
| 16 | explicit FillFixture() |
| 17 | { |
| 18 | m_JsonString = R"( |
| 19 | { |
| 20 | layers: [ |
| 21 | { |
| 22 | layer_type: "InputLayer", |
| 23 | layer: { |
| 24 | base: { |
| 25 | base: { |
| 26 | layerName: "InputLayer", |
| 27 | layerType: "Input", |
| 28 | inputSlots: [ |
| 29 | |
| 30 | ], |
| 31 | outputSlots: [ |
| 32 | { |
| 33 | tensorInfo: { |
| 34 | dimensions: [ |
| 35 | 4 |
| 36 | ], |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 37 | dataType: "Signed32", |
Keith Davis | 300ad56 | 2020-06-04 16:34:23 +0100 | [diff] [blame] | 38 | quantizationScale: 0.0 |
| 39 | } |
| 40 | } |
| 41 | ] |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | }, |
| 46 | { |
| 47 | layer_type: "FillLayer", |
| 48 | layer: { |
| 49 | base: { |
| 50 | index: 1, |
| 51 | layerName: "FillLayer", |
| 52 | layerType: "Fill", |
| 53 | inputSlots: [ |
| 54 | { |
| 55 | connection: { |
| 56 | sourceLayerIndex: 0, |
| 57 | outputSlotIndex: 0 |
| 58 | } |
| 59 | } |
| 60 | ], |
| 61 | outputSlots: [ |
| 62 | { |
| 63 | tensorInfo: { |
| 64 | dimensions: [ |
| 65 | 1, |
| 66 | 3, |
| 67 | 3, |
| 68 | 1 |
| 69 | ], |
| 70 | dataType: "Float32", |
| 71 | quantizationScale: 0.0 |
| 72 | } |
| 73 | } |
| 74 | ] |
| 75 | }, |
| 76 | descriptor: { |
| 77 | value: 1.0 |
| 78 | } |
| 79 | } |
| 80 | }, |
| 81 | { |
| 82 | layer_type: "OutputLayer", |
| 83 | layer: { |
| 84 | base: { |
| 85 | base: { |
| 86 | index: 2, |
| 87 | layerName: "OutputLayer", |
| 88 | layerType: "Output", |
| 89 | inputSlots: [ |
| 90 | { |
| 91 | connection: { |
| 92 | sourceLayerIndex: 1, |
| 93 | outputSlotIndex: 0 |
| 94 | } |
| 95 | } |
| 96 | ], |
| 97 | outputSlots: [ |
| 98 | |
| 99 | ] |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | } |
| 104 | ], |
| 105 | inputIds: [ |
| 106 | 0 |
| 107 | ], |
| 108 | outputIds: [ |
| 109 | 0 |
| 110 | ], |
| 111 | featureVersions: { |
| 112 | bindingIdsScheme: 1 |
| 113 | } |
| 114 | } |
| 115 | )"; |
| 116 | Setup(); |
| 117 | } |
| 118 | }; |
| 119 | |
| 120 | |
| 121 | struct SimpleFillFixture : FillFixture |
| 122 | { |
| 123 | SimpleFillFixture() : FillFixture() {} |
| 124 | }; |
| 125 | |
| 126 | BOOST_FIXTURE_TEST_CASE(Fill, SimpleFillFixture) |
| 127 | { |
Teresa Charlin | 4b10fef | 2020-07-29 09:36:41 +0100 | [diff] [blame] | 128 | RunTest<4, armnn::DataType::Signed32, armnn::DataType::Float32>( |
Keith Davis | 300ad56 | 2020-06-04 16:34:23 +0100 | [diff] [blame] | 129 | 0, |
| 130 | {{"InputLayer", { 1, 3, 3, 1 }}}, |
| 131 | {{"OutputLayer",{ 1, 1, 1, 1, 1, 1, 1, 1, 1}}}); |
| 132 | } |
| 133 | |
| 134 | BOOST_AUTO_TEST_SUITE_END() |