Imported Upstream version 1.25.0
[platform/core/ml/nnfw.git] / onert-micro / luci-interpreter / include / luci_interpreter / test_models / gather / TestDataGatherBase.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_GATHER_KERNEL_BASE_H
18 #define LUCI_INTERPRETER_TEST_MODELS_GATHER_KERNEL_BASE_H
19
20 #include "luci_interpreter/test_models/TestDataBase.h"
21
22 namespace luci_interpreter
23 {
24 namespace test_kernel
25 {
26
27 template <typename T> class TestDataGatherBase : public TestDataBase<T>
28 {
29 public:
30   TestDataGatherBase() = default;
31
32   const unsigned char *get_model_ptr() override final { return _test_kernel_model_circle; }
33
34   const std::vector<T> &get_input_data_by_index(int i) override final
35   {
36     switch (i)
37     {
38       case 0:
39         return _input_data;
40       default:
41         assert(false && "Wrong input index");
42     }
43   }
44
45   const std::vector<T> &get_output_data_by_index(int i) override final
46   {
47     assert(i == 0);
48     return _reference_output_data;
49   }
50
51 protected:
52   std::vector<T> _input_data;
53   std::vector<T> _reference_output_data;
54   const unsigned char *_test_kernel_model_circle;
55 };
56
57 } // namespace test_kernel
58 } // namespace luci_interpreter
59
60 #endif // LUCI_INTERPRETER_TEST_MODELS_GATHER_KERNEL_BASE_H