blob: 6358b538dc7796f87899648c1da214a049bc9436 [file] [log] [blame]
Mike Kelly1f140f72021-04-06 12:25:55 +01001//
2// Copyright © 2021 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"
8#include "../Deserializer.hpp"
9
10#include <string>
11#include <iostream>
12
13BOOST_AUTO_TEST_SUITE(DeserializeParser)
14
15struct ArgMinMaxFixture : public ParserFlatbuffersSerializeFixture
16{
17 explicit ArgMinMaxFixture(const std::string& inputShape,
18 const std::string& outputShape,
19 const std::string& axis,
20 const std::string& argMinMaxFunction)
21 {
22 m_JsonString = R"(
23 {
24 layers: [
25 {
26 layer_type: "InputLayer",
27 layer: {
28 base: {
29 base: {
30 layerName: "InputLayer",
31 layerType: "Input",
32 inputSlots: [
33
34 ],
35 outputSlots: [
36 {
37 tensorInfo: {
38 dimensions: )" + inputShape + R"(,
39 dataType: "Float32",
40 quantizationScale: 0.0
41 }
42 }
43 ]
44 }
45 }
46 }
47 },
48 {
49 layer_type: "ArgMinMaxLayer",
50 layer: {
51 base: {
52 index: 1,
53 layerName: "ArgMinMaxLayer",
54 layerType: "ArgMinMax",
55 inputSlots: [
56 {
57 connection: {
58 sourceLayerIndex: 0,
59 outputSlotIndex: 0
60 }
61 }
62 ],
63 outputSlots: [
64 {
65 tensorInfo: {
66 dimensions: )" + outputShape + R"(,
67 dataType: "Signed64",
68 quantizationScale: 0.0
69 }
70 }
71 ]
72 },
73 descriptor: {
74 axis: )" + axis + R"(,
75 argMinMaxFunction: )" + argMinMaxFunction + R"(
76 }
77 }
78 },
79 {
80 layer_type: "OutputLayer",
81 layer: {
82 base: {
83 base: {
84 index: 2,
85 layerName: "OutputLayer",
86 layerType: "Output",
87 inputSlots: [
88 {
89 connection: {
90 sourceLayerIndex: 1,
91 outputSlotIndex: 0
92 }
93 }
94 ],
95 outputSlots: [
96
97 ]
98 }
99 }
100 }
101 }
102 ],
103 inputIds: [
104 0
105 ],
106 outputIds: [
107 0
108 ],
109 featureVersions: {
110 bindingIdsScheme: 1
111 }
112 }
113 )";
114 Setup();
115 }
116};
117
118struct SimpleArgMinMaxFixture : public ArgMinMaxFixture
119{
120 SimpleArgMinMaxFixture() : ArgMinMaxFixture("[ 1, 1, 1, 5 ]",
121 "[ 1, 1, 1 ]",
122 "-1",
123 "Max") {}
124};
125
126BOOST_FIXTURE_TEST_CASE(ArgMinMax, SimpleArgMinMaxFixture)
127{
128 RunTest<3, armnn::DataType::Float32, armnn::DataType::Signed64>(
129 0,
130 {{"InputLayer", { 6.0f, 2.0f, 8.0f, 10.0f, 9.0f}}},
131 {{"OutputLayer",{ 3l }}});
132}
133
134BOOST_AUTO_TEST_SUITE_END()