4cd5c585aad588ffc00cfcfda72b3b82fa6603c0
[platform/core/ml/nnfw.git] / runtime / onert / api / include / nnfw_experimental.h
1 /*
2  * Copyright (c) 2019 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 __NNFW_EXPERIMENTAL_H__
18 #define __NNFW_EXPERIMENTAL_H__
19
20 #include "nnfw.h"
21
22 // Used for custom kernel development
23
24 /*
25  * operand type, used only for custom operations
26  */
27 typedef struct
28 {
29   nnfw_tensorinfo type;
30   void *allocation;
31 } nnfw_operand;
32
33 /*
34  * Used as input to custom operation eval function
35  */
36 typedef struct
37 {
38   size_t ninputs;
39   nnfw_operand *inputs;
40
41   size_t noutputs;
42   nnfw_operand *outputs;
43 } nnfw_custom_kernel_params;
44
45 /*
46  * Custom kernel evaluation function
47  *
48  * param[in] params custom operation parameters
49  * param[in] userdata pointer to user-specified buffer( kernel instance specific )
50  */
51 typedef void (*nnfw_custom_eval)(nnfw_custom_kernel_params *params, char *userdata,
52                                  size_t userdata_size);
53
54 /*
55  * custom operation registration info
56  */
57 typedef struct
58 {
59   nnfw_custom_eval eval_function;
60 } custom_kernel_registration_info;
61
62 NNFW_STATUS nnfw_register_custom_op_info(nnfw_session *session, const char *id,
63                                          custom_kernel_registration_info *info);
64
65 #endif // __NNFW_EXPERIMENTAL_H__