Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / onert-micro / luci-interpreter / include / luci_interpreter / test_models / average_pool_2d / FloatAveragePool2DKernel.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_FLOAT_AVERAGE_POOL2D_KERNEL_H
18 #define LUCI_INTERPRETER_TEST_MODELS_FLOAT_AVERAGE_POOL2D_KERNEL_H
19
20 #include "TestDataAveragePool2DBase.h"
21
22 namespace luci_interpreter
23 {
24 namespace test_kernel
25 {
26 namespace average_pool2d_float
27 {
28 /*
29  * AveragePool2D Kernel:
30  *
31  *      Input(1, 8, 8, 1)
32  *            |
33  *       AveragePool2D
34  *            |
35  *      Output(1, 7, 7, 1)
36  */
37 const unsigned char test_kernel_model_circle[] = {
38   0x18, 0x00, 0x00, 0x00, 0x43, 0x49, 0x52, 0x30, 0x00, 0x00, 0x0e, 0x00, 0x14, 0x00, 0x00, 0x00,
39   0x0c, 0x00, 0x08, 0x00, 0x10, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
40   0x2c, 0x00, 0x00, 0x00, 0x48, 0x01, 0x00, 0x00, 0x64, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
41   0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
42   0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
43   0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0c, 0x00,
44   0x08, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
45   0x7c, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
46   0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
47   0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x08, 0x00,
48   0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
49   0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x17, 0x00, 0x10, 0x00, 0x0c, 0x00,
50   0x08, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
51   0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00,
52   0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
53   0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
54   0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xd4, 0xff, 0xff, 0xff, 0x0c, 0x00, 0x00, 0x00,
55   0x02, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x6f, 0x66, 0x6d, 0x00,
56   0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00,
57   0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00,
58   0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
59   0x03, 0x00, 0x00, 0x00, 0x69, 0x66, 0x6d, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
60   0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
61   0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
62   0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x11, 0x00, 0x00, 0x00,
63   0x4f, 0x4e, 0x45, 0x2d, 0x74, 0x66, 0x6c, 0x69, 0x74, 0x65, 0x32, 0x63, 0x69, 0x72, 0x63, 0x6c,
64   0x65, 0x00, 0x00, 0x00};
65
66 const std::vector<float> input_data = {
67   -10.829727, -5.0753784, -0.46581638, 1.1337309,  -12.983028, -1.7739874, -3.8115792, -1.470794,
68   0.8652655,  3.5751436,  3.142009,    -2.881177,  0.21681504, -0.6201232, -1.168152,  -5.972758,
69   6.4394593,  0.60464424, -1.8141485,  -17.769108, -13.40761,  6.139243,   -2.3543136, -2.5557704,
70   15.057343,  7.4924536,  -20.035614,  4.250232,   5.9063106,  10.382995,  -7.45354,   3.7568998,
71   5.0376787,  2.825182,   -7.3617344,  -3.2233214, 2.2610564,  -6.776909,  -2.56466,   17.584259,
72   15.771288,  5.9487047,  -0.11435696, 8.510494,   9.547339,   11.753286,  12.103353,  -14.300014,
73   4.453389,   11.3001,    -7.494295,   9.240987,   -2.8403296, -1.9216467, 8.1578245,  -7.334697,
74   1.2287734,  0.7231084,  9.715425,    -7.466359,  -15.67608,  6.574766,   4.489766,   -1.6495954};
75
76 const std::vector<float> reference_output_data{
77   -2.866174, 0.29398948, 0.23218668,  -3.6284149, -3.790081,  -1.8434604, -3.1058207,
78   2.871128,  1.376912,   -4.830606,   -8.46027,   -1.9179188, 0.4991635,  -3.0127485,
79   7.3984747, -3.4381661, -8.842159,   -5.2550435, 2.2552347,  1.678596,   -2.151681,
80   7.6031637, -4.269928,  -6.5926094,  2.2985694,  2.9433632,  -1.6030285, 2.83074,
81   7.395714,  0.32444882, -0.54722965, 4.273892,   4.196193,   3.6287675,  3.2057345,
82   9.368371,  2.4100385,  2.535707,    6.1146226,  4.134662,   7.523204,   -0.3433833,
83   4.426343,  3.5610845,  0.9989393,   -4.1854453, -3.4658222, 4.3251777,  0.91582465};
84
85 } // namespace average_pool2d_float
86
87 class TestDataFloatAveragePool2D : public TestDataAveragePool2DBase<float>
88 {
89 public:
90   TestDataFloatAveragePool2D()
91   {
92     _input_data = average_pool2d_float::input_data;
93     _reference_output_data = average_pool2d_float::reference_output_data;
94     _test_kernel_model_circle = average_pool2d_float::test_kernel_model_circle;
95   }
96
97   ~TestDataFloatAveragePool2D() override = default;
98 };
99
100 } // namespace test_kernel
101 } // namespace luci_interpreter
102
103 #endif // LUCI_INTERPRETER_TEST_MODELS_FLOAT_AVERAGE_POOL2D_KERNEL_H