1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]

/* automatically generated by rust-bindgen */

pub const menoh_dtype_float: menoh_dtype_constant = 0;
pub type menoh_dtype_constant = u32;
pub type menoh_dtype = i32;
pub const menoh_error_code_success: menoh_error_code_constant = 0;
pub const menoh_error_code_std_error: menoh_error_code_constant = 1;
pub const menoh_error_code_unknown_error: menoh_error_code_constant = 2;
pub const menoh_error_code_invalid_filename: menoh_error_code_constant = 3;
pub const menoh_error_code_unsupported_onnx_opset_version: menoh_error_code_constant = 4;
pub const menoh_error_code_onnx_parse_error: menoh_error_code_constant = 5;
pub const menoh_error_code_invalid_dtype: menoh_error_code_constant = 6;
pub const menoh_error_code_invalid_attribute_type: menoh_error_code_constant = 7;
pub const menoh_error_code_unsupported_operator_attribute: menoh_error_code_constant = 8;
pub const menoh_error_code_dimension_mismatch: menoh_error_code_constant = 9;
pub const menoh_error_code_variable_not_found: menoh_error_code_constant = 10;
pub const menoh_error_code_index_out_of_range: menoh_error_code_constant = 11;
pub const menoh_error_code_json_parse_error: menoh_error_code_constant = 12;
pub const menoh_error_code_invalid_backend_name: menoh_error_code_constant = 13;
pub const menoh_error_code_unsupported_operator: menoh_error_code_constant = 14;
pub const menoh_error_code_failed_to_configure_operator: menoh_error_code_constant = 15;
pub const menoh_error_code_backend_error: menoh_error_code_constant = 16;
pub const menoh_error_code_same_named_variable_already_exist: menoh_error_code_constant = 17;
pub const menoh_error_code_unsupported_input_dims: menoh_error_code_constant = 18;
pub const menoh_error_code_same_named_parameter_already_exist: menoh_error_code_constant = 19;
pub const menoh_error_code_same_named_attribute_already_exist: menoh_error_code_constant = 20;
pub const menoh_error_code_invalid_backend_config_error: menoh_error_code_constant = 21;
pub const menoh_error_code_input_not_found_error: menoh_error_code_constant = 22;
pub const menoh_error_code_output_not_found_error: menoh_error_code_constant = 23;
pub type menoh_error_code_constant = u32;
pub type menoh_error_code = i32;
extern "C" {
    pub fn menoh_get_last_error_message() -> *const ::std::os::raw::c_char;
}
#[repr(C)]
pub struct menoh_model_data {
    _unused: [u8; 0],
}
pub type menoh_model_data_handle = *mut menoh_model_data;
extern "C" {
    pub fn menoh_delete_model_data(model_data: menoh_model_data_handle);
}
extern "C" {
    pub fn menoh_make_model_data_from_onnx(
        onnx_filename: *const ::std::os::raw::c_char,
        dst_handle: *mut menoh_model_data_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_make_model_data_from_onnx_data_on_memory(
        onnx_data: *const u8,
        size: i32,
        dst_handle: *mut menoh_model_data_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_make_model_data(dst_handle: *mut menoh_model_data_handle) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_parameter(
        model_data: menoh_model_data_handle,
        parameter_name: *const ::std::os::raw::c_char,
        dtype: menoh_dtype,
        dims_size: i32,
        dims: *const i32,
        buffer_handle: *mut ::std::os::raw::c_void,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_new_node(
        model_data: menoh_model_data_handle,
        op_type: *const ::std::os::raw::c_char,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_input_name_to_current_node(
        model_data: menoh_model_data_handle,
        input_name: *const ::std::os::raw::c_char,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_output_name_to_current_node(
        model_data: menoh_model_data_handle,
        output_name: *const ::std::os::raw::c_char,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_attribute_int_to_current_node(
        model_data: menoh_model_data_handle,
        attribute_name: *const ::std::os::raw::c_char,
        value: i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_attribute_float_to_current_node(
        model_data: menoh_model_data_handle,
        attribute_name: *const ::std::os::raw::c_char,
        value: f32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_attribute_ints_to_current_node(
        model_data: menoh_model_data_handle,
        attribute_name: *const ::std::os::raw::c_char,
        size: i32,
        value: *const i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_add_attribute_floats_to_current_node(
        model_data: menoh_model_data_handle,
        attribute_name: *const ::std::os::raw::c_char,
        size: i32,
        value: *const f32,
    ) -> menoh_error_code;
}
#[repr(C)]
pub struct menoh_variable_profile_table_builder {
    _unused: [u8; 0],
}
pub type menoh_variable_profile_table_builder_handle = *mut menoh_variable_profile_table_builder;
extern "C" {
    pub fn menoh_make_variable_profile_table_builder(
        dst_handle: *mut menoh_variable_profile_table_builder_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_delete_variable_profile_table_builder(
        builder: menoh_variable_profile_table_builder_handle,
    );
}
extern "C" {
    pub fn menoh_variable_profile_table_builder_add_input_profile(
        builder: menoh_variable_profile_table_builder_handle,
        name: *const ::std::os::raw::c_char,
        dtype: menoh_dtype,
        dims_size: i32,
        dims: *const i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_builder_add_input_profile_dims_2(
        builder: menoh_variable_profile_table_builder_handle,
        name: *const ::std::os::raw::c_char,
        dtype: menoh_dtype,
        num: i32,
        size: i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_builder_add_input_profile_dims_4(
        builder: menoh_variable_profile_table_builder_handle,
        name: *const ::std::os::raw::c_char,
        dtype: menoh_dtype,
        num: i32,
        channel: i32,
        height: i32,
        width: i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_builder_add_output_name(
        builder: menoh_variable_profile_table_builder_handle,
        name: *const ::std::os::raw::c_char,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_builder_add_output_profile(
        builder: menoh_variable_profile_table_builder_handle,
        name: *const ::std::os::raw::c_char,
        dtype: menoh_dtype,
    ) -> menoh_error_code;
}
#[repr(C)]
pub struct menoh_variable_profile_table {
    _unused: [u8; 0],
}
pub type menoh_variable_profile_table_handle = *mut menoh_variable_profile_table;
extern "C" {
    pub fn menoh_build_variable_profile_table(
        builder: menoh_variable_profile_table_builder_handle,
        model_data: menoh_model_data_handle,
        dst_handle: *mut menoh_variable_profile_table_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_delete_variable_profile_table(
        variable_profile_table: menoh_variable_profile_table_handle,
    );
}
extern "C" {
    pub fn menoh_variable_profile_table_get_dtype(
        variable_profile_table: menoh_variable_profile_table_handle,
        variable_name: *const ::std::os::raw::c_char,
        dst_dtype: *mut menoh_dtype,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_get_dims_size(
        variable_profile_table: menoh_variable_profile_table_handle,
        variable_name: *const ::std::os::raw::c_char,
        dst_size: *mut i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_variable_profile_table_get_dims_at(
        variable_profile_table: menoh_variable_profile_table_handle,
        variable_name: *const ::std::os::raw::c_char,
        index: i32,
        dst_size: *mut i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_data_optimize(
        model_data: menoh_model_data_handle,
        variable_profile_table: menoh_variable_profile_table_handle,
    ) -> menoh_error_code;
}
#[repr(C)]
pub struct menoh_model_builder {
    _unused: [u8; 0],
}
pub type menoh_model_builder_handle = *mut menoh_model_builder;
extern "C" {
    pub fn menoh_make_model_builder(
        variable_profile_table: menoh_variable_profile_table_handle,
        dst_handle: *mut menoh_model_builder_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_delete_model_builder(model_builder: menoh_model_builder_handle);
}
extern "C" {
    pub fn menoh_model_builder_attach_external_buffer(
        builder: menoh_model_builder_handle,
        variable_name: *const ::std::os::raw::c_char,
        buffer_handle: *mut ::std::os::raw::c_void,
    ) -> menoh_error_code;
}
#[repr(C)]
pub struct menoh_model {
    _unused: [u8; 0],
}
pub type menoh_model_handle = *mut menoh_model;
extern "C" {
    pub fn menoh_build_model(
        builder: menoh_model_builder_handle,
        model_data: menoh_model_data_handle,
        backend_name: *const ::std::os::raw::c_char,
        backend_config: *const ::std::os::raw::c_char,
        dst_model_handle: *mut menoh_model_handle,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_delete_model(model: menoh_model_handle);
}
extern "C" {
    pub fn menoh_model_get_variable_buffer_handle(
        model: menoh_model_handle,
        variable_name: *const ::std::os::raw::c_char,
        dst_data: *mut *mut ::std::os::raw::c_void,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_get_variable_dtype(
        model: menoh_model_handle,
        variable_name: *const ::std::os::raw::c_char,
        dst_dtype: *mut menoh_dtype,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_get_variable_dims_size(
        model: menoh_model_handle,
        variable_name: *const ::std::os::raw::c_char,
        dst_size: *mut i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_get_variable_dims_at(
        model: menoh_model_handle,
        variable_name: *const ::std::os::raw::c_char,
        index: i32,
        dst_size: *mut i32,
    ) -> menoh_error_code;
}
extern "C" {
    pub fn menoh_model_run(model: menoh_model_handle) -> menoh_error_code;
}