Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / onert-micro / luci-interpreter / include / luci_interpreter / test_models / greater_equal / FloatGreaterEqualKernel.h
1 /*
2  * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *    http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef LUCI_INTERPRETER_TEST_MODELS_GREATER_EQUAL_KERNEL_FLOAT_H
18 #define LUCI_INTERPRETER_TEST_MODELS_GREATER_EQUAL_KERNEL_FLOAT_H
19
20 #include "TestDataGreaterEqualBase.h"
21
22 namespace luci_interpreter
23 {
24 namespace test_kernel
25 {
26 namespace greater_equal_float
27 {
28
29 /*
30  * GreaterEqual Kernel:
31  *
32  * Input_1(1, 4, 4, 3)   Input_2(1, 4, 4, 3)
33  *       \             /
34  *     GreaterEqual(no broadcast)
35  *              |
36  *          Output(1, 4, 4, 3)
37  */
38 const unsigned char test_kernel_model_circle[] = {
39   0x18, 0x00, 0x00, 0x00, 0x43, 0x49, 0x52, 0x30, 0x00, 0x00, 0x0e, 0x00, 0x14, 0x00, 0x00, 0x00,
40   0x0c, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
41   0x30, 0x00, 0x00, 0x00, 0x7c, 0x01, 0x00, 0x00, 0x98, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
42   0x1c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
43   0x88, 0xff, 0xff, 0xff, 0x8c, 0xff, 0xff, 0xff, 0x90, 0xff, 0xff, 0xff, 0x94, 0xff, 0xff, 0xff,
44   0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x14, 0x00,
45   0x10, 0x00, 0x0c, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
46   0x1c, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00,
47   0x04, 0x00, 0x00, 0x00, 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
48   0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x14, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0c, 0x00,
49   0x07, 0x00, 0x08, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2d, 0x10, 0x00, 0x00, 0x00,
50   0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00,
51   0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
52   0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
53   0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00,
54   0x44, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0f, 0x00,
55   0x08, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
56   0x00, 0x00, 0x00, 0x06, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6f, 0x66, 0x6d, 0x00,
57   0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
58   0x03, 0x00, 0x00, 0x00, 0xd0, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
59   0x10, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x69, 0x66, 0x6d, 0x32, 0x00, 0x00, 0x00, 0x00,
60   0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
61   0x03, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00,
62   0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
63   0x04, 0x00, 0x00, 0x00, 0x69, 0x66, 0x6d, 0x31, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
64   0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
65   0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x00, 0x00,
66   0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e,
67   0x11, 0x00, 0x00, 0x00, 0x4f, 0x4e, 0x45, 0x2d, 0x74, 0x66, 0x6c, 0x69, 0x74, 0x65, 0x32, 0x63,
68   0x69, 0x72, 0x63, 0x6c, 0x65, 0x00, 0x00, 0x00};
69
70 const std::vector<float> input1_data = {
71   -0.01787583, -0.8314556, -0.47624078, -1.9747407,    -0.51676583, -0.20183715, -1.9358647,
72   0.7616414,   -0.0899037, 2.048367,    -1.3174965,    1.5267943,   0.68707687,  1.3464743,
73   0.98674047,  -1.4853697, 1.9973947,   0.5170953,     0.37471953,  -1.6011852,  0.32045737,
74   -0.6598305,  -1.7946662, 1.2349467,   1.3320708,     0.5151753,   1.345111,    -0.16560331,
75   0.82792366,  -1.734876,  0.043626763, -0.0118546495, 0.31535238,  0.1888555,   -0.32523626,
76   -0.997665,   0.5819472,  -2.3194845,  -1.6897905,    0.9981752,   -1.2897044,  0.75768864,
77   0.56781554,  -1.0565805, -1.4891449,  0.2493645,     -1.1312587,  0.6837854};
78
79 const std::vector<float> input2_data = {
80   0.30809638,  -0.28285328, -0.8437058,  1.7689779,   0.5182942,    0.571205,    -0.89484423,
81   0.28100377,  0.5453497,   1.3848042,   -0.04359268, -1.7448778,   -0.5375435,  -0.85059136,
82   -0.77961826, -0.4916915,  1.3359088,   -0.09580261, 0.6158275,    -0.05056348, 0.90505254,
83   0.94226706,  1.136139,    -0.45077038, -0.5018571,  -1.1543767,   0.85094684,  -0.13731039,
84   -0.3298641,  0.9474698,   -0.48497504, -0.14864737, -0.009302358, -1.1259161,  0.44226727,
85   1.0149708,   0.36024934,  0.4969523,   0.45014778,  -0.34718898,  1.2260172,   0.35304692,
86   -1.3037513,  -0.2565706,  0.18085766,  -0.7099202,  -0.9203537,   -1.2257448};
87
88 const std::vector<bool> reference_output_data = {
89   false, false, true,  false, false, false, false, true,  false, true,  false, true,
90   true,  true,  true,  false, true,  true,  false, false, false, false, false, true,
91   true,  true,  true,  false, true,  false, true,  true,  true,  true,  false, false,
92   true,  false, false, true,  false, true,  true,  false, false, true,  false, true};
93
94 } // namespace greater_equal_float
95
96 namespace neg_greater_equal_float_with_no_broadcasting
97 {
98
99 /*
100  * GreaterEqual Kernel with input type mismatch:
101  *
102  * Input_1(1, 4, 4, 3)-float   Input_2(1, 4, 4, 3)-int
103  *       \             /
104  *     GreaterEqual(no broadcast)
105  *              |
106  *          Output(1, 4, 4, 3)
107  */
108
109 const unsigned char test_kernel_model_circle[] = {
110
111 };
112
113 const std::vector<float> input1_data = {};
114
115 const std::vector<float> input2_data = {};
116
117 const std::vector<bool> reference_output_data = {};
118
119 } // namespace neg_greater_equal_float_with_no_broadcasting
120
121 class TestDataFloatGreaterEqual : public TestDataGreaterEqualBase<float, bool>
122 {
123 public:
124   explicit TestDataFloatGreaterEqual(bool is_with_broadcast, bool is_neg)
125     : TestDataGreaterEqualBase<float, bool>(is_with_broadcast)
126   {
127     if (is_with_broadcast)
128     {
129       assert(false && "Not impl yet");
130     }
131     else
132     {
133       if (is_neg)
134       {
135         _input1_data = neg_greater_equal_float_with_no_broadcasting::input1_data;
136         _input2_data = neg_greater_equal_float_with_no_broadcasting::input2_data;
137         _reference_output_data =
138           neg_greater_equal_float_with_no_broadcasting::reference_output_data;
139         _test_kernel_model_circle =
140           neg_greater_equal_float_with_no_broadcasting::test_kernel_model_circle;
141       }
142       else
143       {
144         _input1_data = greater_equal_float::input1_data;
145         _input2_data = greater_equal_float::input2_data;
146         _reference_output_data = greater_equal_float::reference_output_data;
147         _test_kernel_model_circle = greater_equal_float::test_kernel_model_circle;
148       }
149     }
150   }
151
152   ~TestDataFloatGreaterEqual() override = default;
153 };
154
155 } // namespace test_kernel
156 } // namespace luci_interpreter
157
158 #endif // LUCI_INTERPRETER_TEST_MODELS_GREATER_KERNEL_FLOAT_H