ONE - On-device Neural Engine
Loading...
Searching...
No Matches
ShapeKernel.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2024 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 ONERT_MICRO_TEST_MODELS_SHAPE_KERNEL_H
18#define ONERT_MICRO_TEST_MODELS_SHAPE_KERNEL_H
19
20#include "test_models/TestDataBase.h"
21
22namespace onert_micro
23{
24namespace test_model
25{
26
27namespace shape_kernel
28{
29/*
30 * Shape Kernel:
31 *
32 * Input(2, 3, 4)
33 * |
34 * Shape
35 * |
36 * Output(3)
37 */
38const 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 0x2c, 0x00, 0x00, 0x00, 0x30, 0x01, 0x00, 0x00, 0x4c, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
42 0x18, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff,
43 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
44 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x18, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0c, 0x00,
45 0x08, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00,
46 0x64, 0x00, 0x00, 0x00, 0x68, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
47 0x6d, 0x61, 0x69, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
48 0x00, 0x00, 0x0e, 0x00, 0x16, 0x00, 0x00, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x07, 0x00, 0x08, 0x00,
49 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x37, 0x14, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00,
50 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00,
51 0x00, 0x00, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
52 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
53 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,
54 0x0c, 0x00, 0x14, 0x00, 0x10, 0x00, 0x0f, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00,
55 0x10, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x00, 0x00, 0x00,
56 0x03, 0x00, 0x00, 0x00, 0x6f, 0x66, 0x6d, 0x00, 0x01, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
57 0x0c, 0x00, 0x10, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00,
58 0x0c, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
59 0x69, 0x66, 0x6d, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
60 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x0c, 0x00,
61 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x00, 0x00,
62 0x00, 0x00, 0x00, 0x4d, 0x11, 0x00, 0x00, 0x00, 0x4f, 0x4e, 0x45, 0x2d, 0x74, 0x66, 0x6c, 0x69,
63 0x74, 0x65, 0x32, 0x63, 0x69, 0x72, 0x63, 0x6c, 0x65, 0x00, 0x00, 0x00};
64
65const std::vector<float> input_data = {
66 9.817013, -10.169584, -11.175514, 6.3500366, -39.949837, 2.3447914, 14.254675, 20.6128,
67 8.819141, -10.237312, -5.171467, 4.7246437, 11.657671, 20.094395, 11.213078, -13.8377495,
68 10.846771, -15.841316, 7.4385757, -6.9196777, 12.076214, 18.011564, -14.684473, 2.7402115};
69
70const std::vector<int32_t> reference_output_data = {2, 3, 4};
71} // namespace shape_kernel
72
73template <typename T, typename U> class TestDataShapeKernel : public TestDataBase<T, U>
74{
75public:
82
83 ~TestDataShapeKernel() override = default;
84
85 const unsigned char *get_model_ptr() override final { return _test_kernel_model_circle; }
86
87 const std::vector<T> &get_input_data_by_index(int i) override final
88 {
89 switch (i)
90 {
91 case 0:
92 return _input_data;
93 default:
94 assert(false && "Wrong input index");
95 }
96 }
97
98 const std::vector<U> &get_output_data_by_index(int i) override final
99 {
100 assert(i == 0);
102 }
103
104protected:
105 std::vector<T> _input_data;
107 const unsigned char *_test_kernel_model_circle;
108};
109
110} // namespace test_model
111} // namespace onert_micro
112
113#endif // ONERT_MICRO_TEST_MODELS_SHAPE_KERNEL_H
const std::vector< U > & get_output_data_by_index(int i) override final
Definition ShapeKernel.h:98
const unsigned char * get_model_ptr() override final
Definition ShapeKernel.h:85
const std::vector< T > & get_input_data_by_index(int i) override final
Definition ShapeKernel.h:87
const unsigned char test_kernel_model_circle[]
Definition ShapeKernel.h:38
const std::vector< float > input_data
Definition ShapeKernel.h:65
const std::vector< int32_t > reference_output_data
Definition ShapeKernel.h:70