xref: /aosp_15_r20/external/armnn/src/armnnDeserializer/test/DeserializeFill.cpp (revision 89c4ff92f2867872bb9e2354d150bf0c8c502810)
1 //
2 // Copyright © 2020, 2023 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "ParserFlatbuffersSerializeFixture.hpp"
7 #include <armnnDeserializer/IDeserializer.hpp>
8 
9 #include <string>
10 
11 TEST_SUITE("Deserializer_Fill")
12 {
13 struct FillFixture : public ParserFlatbuffersSerializeFixture
14 {
FillFixtureFillFixture15     explicit FillFixture()
16     {
17         m_JsonString = R"(
18         {
19           layers: [
20             {
21               layer_type: "InputLayer",
22               layer: {
23                 base: {
24                   base: {
25                     layerName: "InputLayer",
26                     layerType: "Input",
27                     inputSlots: [
28 
29                     ],
30                     outputSlots: [
31                       {
32                         tensorInfo: {
33                           dimensions: [
34                             4
35                           ],
36                           dataType: "Signed32",
37                           quantizationScale: 1.0
38                         }
39                       }
40                     ]
41                   }
42                 }
43               }
44             },
45             {
46               layer_type: "FillLayer",
47               layer: {
48                 base: {
49                   index: 1,
50                   layerName: "FillLayer",
51                   layerType: "Fill",
52                   inputSlots: [
53                     {
54                       connection: {
55                         sourceLayerIndex: 0,
56                         outputSlotIndex: 0
57                       }
58                     }
59                   ],
60                   outputSlots: [
61                     {
62                       tensorInfo: {
63                         dimensions: [
64                           1,
65                           3,
66                           3,
67                           1
68                         ],
69                         dataType: "Float32",
70                         quantizationScale: 0.0
71                       }
72                     }
73                   ]
74                 },
75                 descriptor: {
76                   value: 1.0
77                 }
78               }
79             },
80             {
81               layer_type: "OutputLayer",
82               layer: {
83                 base: {
84                   base: {
85                     index: 2,
86                     layerName: "OutputLayer",
87                     layerType: "Output",
88                     inputSlots: [
89                       {
90                         connection: {
91                           sourceLayerIndex: 1,
92                           outputSlotIndex: 0
93                         }
94                       }
95                     ],
96                     outputSlots: [
97 
98                     ]
99                   }
100                 }
101               }
102             }
103           ],
104           inputIds: [
105             0
106           ],
107           outputIds: [
108             0
109           ],
110           featureVersions: {
111             bindingIdsScheme: 1
112           }
113         }
114     )";
115         Setup();
116     }
117 };
118 
119 
120 struct SimpleFillFixture : FillFixture
121 {
SimpleFillFixtureSimpleFillFixture122     SimpleFillFixture() : FillFixture() {}
123 };
124 
125 TEST_CASE_FIXTURE(SimpleFillFixture, "Fill")
126 {
127     RunTest<4, armnn::DataType::Signed32, armnn::DataType::Float32>(
128             0,
129             {{"InputLayer", { 1, 3, 3, 1 }}},
130             {{"OutputLayer",{ 1, 1, 1, 1, 1, 1, 1, 1, 1}}});
131 }
132 
133 }
134