1use core::ffi::{c_char, c_void};
2
3pub type TensorArrayCallback = unsafe extern "C" fn(context: *mut c_void) -> *mut c_void;
4pub type TensorArrayInputCallback =
5 unsafe extern "C" fn(context: *mut c_void, input_box_handle: *mut c_void) -> *mut c_void;
6pub type WhileBeforeCallback = unsafe extern "C" fn(
7 context: *mut c_void,
8 input_box_handle: *mut c_void,
9 out_result_box_handle: *mut *mut c_void,
10) -> *mut c_void;
11pub type ForBodyCallback = unsafe extern "C" fn(
12 context: *mut c_void,
13 index_handle: *mut c_void,
14 input_box_handle: *mut c_void,
15) -> *mut c_void;
16
17unsafe extern "C" {
18 pub fn mpsgraph_object_release(handle: *mut c_void);
19
20 pub fn mpsgraph_tensor_data_new_with_bytes(
21 device_handle: *mut c_void,
22 bytes: *const c_void,
23 byte_len: usize,
24 shape: *const usize,
25 shape_len: usize,
26 data_type: u32,
27 ) -> *mut c_void;
28 pub fn mpsgraph_tensor_data_new_with_buffer(
29 buffer_handle: *mut c_void,
30 shape: *const usize,
31 shape_len: usize,
32 data_type: u32,
33 ) -> *mut c_void;
34 pub fn mpsgraph_tensor_data_data_type(handle: *mut c_void) -> u32;
35 pub fn mpsgraph_tensor_data_shape_len(handle: *mut c_void) -> usize;
36 pub fn mpsgraph_tensor_data_copy_shape(handle: *mut c_void, out_shape: *mut usize);
37 pub fn mpsgraph_tensor_data_read_bytes(
38 handle: *mut c_void,
39 dst: *mut c_void,
40 dst_len: usize,
41 ) -> bool;
42 pub fn mpsgraph_tensor_data_device(handle: *mut c_void) -> *mut c_void;
43
44 pub fn mpsgraph_graph_new() -> *mut c_void;
45 pub fn mpsgraph_graph_placeholder(
46 graph_handle: *mut c_void,
47 shape: *const usize,
48 shape_len: usize,
49 data_type: u32,
50 name: *const c_char,
51 ) -> *mut c_void;
52 pub fn mpsgraph_graph_constant_data(
53 graph_handle: *mut c_void,
54 bytes: *const c_void,
55 byte_len: usize,
56 shape: *const usize,
57 shape_len: usize,
58 data_type: u32,
59 ) -> *mut c_void;
60 pub fn mpsgraph_graph_constant_scalar(
61 graph_handle: *mut c_void,
62 scalar: f64,
63 data_type: u32,
64 ) -> *mut c_void;
65 pub fn mpsgraph_graph_constant_scalar_shaped(
66 graph_handle: *mut c_void,
67 scalar: f64,
68 shape: *const usize,
69 shape_len: usize,
70 data_type: u32,
71 ) -> *mut c_void;
72
73 pub fn mpsgraph_graph_addition(
74 graph_handle: *mut c_void,
75 primary_tensor: *mut c_void,
76 secondary_tensor: *mut c_void,
77 name: *const c_char,
78 ) -> *mut c_void;
79 pub fn mpsgraph_graph_subtraction(
80 graph_handle: *mut c_void,
81 primary_tensor: *mut c_void,
82 secondary_tensor: *mut c_void,
83 name: *const c_char,
84 ) -> *mut c_void;
85 pub fn mpsgraph_graph_multiplication(
86 graph_handle: *mut c_void,
87 primary_tensor: *mut c_void,
88 secondary_tensor: *mut c_void,
89 name: *const c_char,
90 ) -> *mut c_void;
91 pub fn mpsgraph_graph_division(
92 graph_handle: *mut c_void,
93 primary_tensor: *mut c_void,
94 secondary_tensor: *mut c_void,
95 name: *const c_char,
96 ) -> *mut c_void;
97 pub fn mpsgraph_graph_matrix_multiplication(
98 graph_handle: *mut c_void,
99 primary_tensor: *mut c_void,
100 secondary_tensor: *mut c_void,
101 name: *const c_char,
102 ) -> *mut c_void;
103 pub fn mpsgraph_graph_relu(
104 graph_handle: *mut c_void,
105 tensor: *mut c_void,
106 name: *const c_char,
107 ) -> *mut c_void;
108 pub fn mpsgraph_graph_sigmoid(
109 graph_handle: *mut c_void,
110 tensor: *mut c_void,
111 name: *const c_char,
112 ) -> *mut c_void;
113 pub fn mpsgraph_graph_softmax(
114 graph_handle: *mut c_void,
115 tensor: *mut c_void,
116 axis: isize,
117 name: *const c_char,
118 ) -> *mut c_void;
119 pub fn mpsgraph_graph_reshape(
120 graph_handle: *mut c_void,
121 tensor: *mut c_void,
122 shape: *const usize,
123 shape_len: usize,
124 name: *const c_char,
125 ) -> *mut c_void;
126 pub fn mpsgraph_graph_transpose(
127 graph_handle: *mut c_void,
128 tensor: *mut c_void,
129 permutation: *const usize,
130 permutation_len: usize,
131 name: *const c_char,
132 ) -> *mut c_void;
133 pub fn mpsgraph_graph_slice(
134 graph_handle: *mut c_void,
135 tensor: *mut c_void,
136 dimension: usize,
137 start: isize,
138 length: isize,
139 name: *const c_char,
140 ) -> *mut c_void;
141 pub fn mpsgraph_graph_broadcast(
142 graph_handle: *mut c_void,
143 tensor: *mut c_void,
144 shape: *const usize,
145 shape_len: usize,
146 name: *const c_char,
147 ) -> *mut c_void;
148 pub fn mpsgraph_graph_reduction_sum(
149 graph_handle: *mut c_void,
150 tensor: *mut c_void,
151 axes: *const usize,
152 axes_len: usize,
153 name: *const c_char,
154 ) -> *mut c_void;
155 pub fn mpsgraph_graph_reduction_maximum(
156 graph_handle: *mut c_void,
157 tensor: *mut c_void,
158 axes: *const usize,
159 axes_len: usize,
160 name: *const c_char,
161 ) -> *mut c_void;
162 pub fn mpsgraph_graph_reduction_minimum(
163 graph_handle: *mut c_void,
164 tensor: *mut c_void,
165 axes: *const usize,
166 axes_len: usize,
167 name: *const c_char,
168 ) -> *mut c_void;
169 pub fn mpsgraph_graph_mean(
170 graph_handle: *mut c_void,
171 tensor: *mut c_void,
172 axes: *const usize,
173 axes_len: usize,
174 name: *const c_char,
175 ) -> *mut c_void;
176
177 pub fn mpsgraph_convolution2d_descriptor_new(
178 stride_in_x: usize,
179 stride_in_y: usize,
180 dilation_rate_in_x: usize,
181 dilation_rate_in_y: usize,
182 groups: usize,
183 padding_left: usize,
184 padding_right: usize,
185 padding_top: usize,
186 padding_bottom: usize,
187 padding_style: usize,
188 data_layout: usize,
189 weights_layout: usize,
190 ) -> *mut c_void;
191 pub fn mpsgraph_pooling2d_descriptor_new(
192 kernel_width: usize,
193 kernel_height: usize,
194 stride_in_x: usize,
195 stride_in_y: usize,
196 dilation_rate_in_x: usize,
197 dilation_rate_in_y: usize,
198 padding_left: usize,
199 padding_right: usize,
200 padding_top: usize,
201 padding_bottom: usize,
202 padding_style: usize,
203 data_layout: usize,
204 ) -> *mut c_void;
205 pub fn mpsgraph_graph_convolution2d(
206 graph_handle: *mut c_void,
207 source_tensor: *mut c_void,
208 weights_tensor: *mut c_void,
209 descriptor_handle: *mut c_void,
210 name: *const c_char,
211 ) -> *mut c_void;
212 pub fn mpsgraph_graph_max_pooling2d(
213 graph_handle: *mut c_void,
214 source_tensor: *mut c_void,
215 descriptor_handle: *mut c_void,
216 name: *const c_char,
217 ) -> *mut c_void;
218 pub fn mpsgraph_graph_normalize(
219 graph_handle: *mut c_void,
220 tensor: *mut c_void,
221 mean_tensor: *mut c_void,
222 variance_tensor: *mut c_void,
223 gamma_tensor: *mut c_void,
224 beta_tensor: *mut c_void,
225 epsilon: f32,
226 name: *const c_char,
227 ) -> *mut c_void;
228
229 pub fn mpsgraph_graph_run(
230 graph_handle: *mut c_void,
231 feed_tensors: *const *mut c_void,
232 feed_data: *const *mut c_void,
233 feed_count: usize,
234 target_tensors: *const *mut c_void,
235 target_count: usize,
236 out_results: *mut *mut c_void,
237 ) -> bool;
238 pub fn mpsgraph_graph_run_with_command_queue(
239 graph_handle: *mut c_void,
240 command_queue_handle: *mut c_void,
241 feed_tensors: *const *mut c_void,
242 feed_data: *const *mut c_void,
243 feed_count: usize,
244 target_tensors: *const *mut c_void,
245 target_count: usize,
246 out_results: *mut *mut c_void,
247 ) -> bool;
248 pub fn mpsgraph_graph_compile(
249 graph_handle: *mut c_void,
250 device_handle: *mut c_void,
251 feed_tensors: *const *mut c_void,
252 feed_count: usize,
253 flat_shapes: *const usize,
254 shape_lengths: *const usize,
255 data_types: *const u32,
256 target_tensors: *const *mut c_void,
257 target_count: usize,
258 ) -> *mut c_void;
259 pub fn mpsgraph_executable_run(
260 executable_handle: *mut c_void,
261 command_queue_handle: *mut c_void,
262 input_data: *const *mut c_void,
263 input_count: usize,
264 output_count: usize,
265 out_results: *mut *mut c_void,
266 ) -> bool;
267
268 pub fn mpsgraph_tensor_array_box_len(handle: *mut c_void) -> usize;
269 pub fn mpsgraph_tensor_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
270 pub fn mpsgraph_tensor_data_array_box_len(handle: *mut c_void) -> usize;
271 pub fn mpsgraph_tensor_data_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
272 pub fn mpsgraph_shaped_type_array_box_len(handle: *mut c_void) -> usize;
273 pub fn mpsgraph_shaped_type_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
274
275 pub fn mpsgraph_device_new_with_metal_device(metal_device_handle: *mut c_void) -> *mut c_void;
276 pub fn mpsgraph_device_type(handle: *mut c_void) -> u32;
277
278 pub fn mpsgraph_shaped_type_new(
279 shape: *const isize,
280 shape_len: usize,
281 data_type: u32,
282 ) -> *mut c_void;
283 pub fn mpsgraph_shaped_type_has_shape(handle: *mut c_void) -> bool;
284 pub fn mpsgraph_shaped_type_shape_len(handle: *mut c_void) -> usize;
285 pub fn mpsgraph_shaped_type_copy_shape(handle: *mut c_void, out_shape: *mut isize);
286 pub fn mpsgraph_shaped_type_data_type(handle: *mut c_void) -> u32;
287 pub fn mpsgraph_shaped_type_set_shape(
288 handle: *mut c_void,
289 shape: *const isize,
290 shape_len: usize,
291 ) -> bool;
292 pub fn mpsgraph_shaped_type_set_data_type(handle: *mut c_void, data_type: u32) -> bool;
293 pub fn mpsgraph_shaped_type_is_equal(handle: *mut c_void, other_handle: *mut c_void) -> bool;
294
295 pub fn mpsgraph_tensor_has_shape(handle: *mut c_void) -> bool;
296 pub fn mpsgraph_tensor_shape_len(handle: *mut c_void) -> usize;
297 pub fn mpsgraph_tensor_copy_shape(handle: *mut c_void, out_shape: *mut isize);
298 pub fn mpsgraph_tensor_data_type(handle: *mut c_void) -> u32;
299 pub fn mpsgraph_tensor_operation(handle: *mut c_void) -> *mut c_void;
300
301 pub fn mpsgraph_graph_options(handle: *mut c_void) -> u64;
302 pub fn mpsgraph_graph_set_options(handle: *mut c_void, raw_value: u64) -> bool;
303 pub fn mpsgraph_graph_placeholder_tensors(handle: *mut c_void) -> *mut c_void;
304
305 pub fn mpsgraph_compilation_descriptor_new() -> *mut c_void;
306 pub fn mpsgraph_compilation_descriptor_disable_type_inference(handle: *mut c_void) -> bool;
307 pub fn mpsgraph_compilation_descriptor_optimization_level(handle: *mut c_void) -> u64;
308 pub fn mpsgraph_compilation_descriptor_set_optimization_level(
309 handle: *mut c_void,
310 raw_value: u64,
311 ) -> bool;
312 pub fn mpsgraph_compilation_descriptor_wait_for_completion(handle: *mut c_void) -> bool;
313 pub fn mpsgraph_compilation_descriptor_set_wait_for_completion(
314 handle: *mut c_void,
315 value: bool,
316 ) -> bool;
317 pub fn mpsgraph_compilation_descriptor_optimization_profile(handle: *mut c_void) -> u64;
318 pub fn mpsgraph_compilation_descriptor_set_optimization_profile(
319 handle: *mut c_void,
320 raw_value: u64,
321 ) -> bool;
322 pub fn mpsgraph_compilation_descriptor_reduced_precision_fast_math(handle: *mut c_void)
323 -> usize;
324 pub fn mpsgraph_compilation_descriptor_set_reduced_precision_fast_math(
325 handle: *mut c_void,
326 raw_value: usize,
327 ) -> bool;
328
329 pub fn mpsgraph_execution_descriptor_new() -> *mut c_void;
330 pub fn mpsgraph_execution_descriptor_wait_until_completed(handle: *mut c_void) -> bool;
331 pub fn mpsgraph_execution_descriptor_set_wait_until_completed(
332 handle: *mut c_void,
333 value: bool,
334 ) -> bool;
335 pub fn mpsgraph_execution_descriptor_compilation_descriptor(handle: *mut c_void) -> *mut c_void;
336 pub fn mpsgraph_execution_descriptor_set_compilation_descriptor(
337 handle: *mut c_void,
338 compilation_descriptor_handle: *mut c_void,
339 ) -> bool;
340
341 pub fn mpsgraph_executable_execution_descriptor_new() -> *mut c_void;
342 pub fn mpsgraph_executable_execution_descriptor_wait_until_completed(
343 handle: *mut c_void,
344 ) -> bool;
345 pub fn mpsgraph_executable_execution_descriptor_set_wait_until_completed(
346 handle: *mut c_void,
347 value: bool,
348 ) -> bool;
349
350 pub fn mpsgraph_executable_serialization_descriptor_new() -> *mut c_void;
351 pub fn mpsgraph_executable_serialization_descriptor_append(handle: *mut c_void) -> bool;
352 pub fn mpsgraph_executable_serialization_descriptor_set_append(
353 handle: *mut c_void,
354 value: bool,
355 ) -> bool;
356 pub fn mpsgraph_executable_serialization_descriptor_deployment_platform(
357 handle: *mut c_void,
358 ) -> u64;
359 pub fn mpsgraph_executable_serialization_descriptor_set_deployment_platform(
360 handle: *mut c_void,
361 raw_value: u64,
362 ) -> bool;
363 pub fn mpsgraph_executable_serialization_descriptor_minimum_deployment_target_len(
364 handle: *mut c_void,
365 ) -> usize;
366 pub fn mpsgraph_executable_serialization_descriptor_copy_minimum_deployment_target(
367 handle: *mut c_void,
368 out_bytes: *mut u8,
369 out_len: usize,
370 ) -> bool;
371 pub fn mpsgraph_executable_serialization_descriptor_set_minimum_deployment_target(
372 handle: *mut c_void,
373 value: *const c_char,
374 ) -> bool;
375
376 pub fn mpsgraph_graph_compile_with_descriptor(
377 graph_handle: *mut c_void,
378 device_handle: *mut c_void,
379 feed_tensors: *const *mut c_void,
380 feed_count: usize,
381 flat_shapes: *const usize,
382 shape_lengths: *const usize,
383 data_types: *const u32,
384 target_tensors: *const *mut c_void,
385 target_count: usize,
386 compilation_descriptor_handle: *mut c_void,
387 ) -> *mut c_void;
388
389 pub fn mpsgraph_executable_options(handle: *mut c_void) -> u64;
390 pub fn mpsgraph_executable_set_options(handle: *mut c_void, raw_value: u64) -> bool;
391 pub fn mpsgraph_executable_feed_tensors(handle: *mut c_void) -> *mut c_void;
392 pub fn mpsgraph_executable_target_tensors(handle: *mut c_void) -> *mut c_void;
393 pub fn mpsgraph_executable_specialize(
394 handle: *mut c_void,
395 device_handle: *mut c_void,
396 input_type_handles: *const *mut c_void,
397 input_type_count: usize,
398 compilation_descriptor_handle: *mut c_void,
399 ) -> bool;
400 pub fn mpsgraph_executable_get_output_types(
401 handle: *mut c_void,
402 device_handle: *mut c_void,
403 input_type_handles: *const *mut c_void,
404 input_type_count: usize,
405 compilation_descriptor_handle: *mut c_void,
406 ) -> *mut c_void;
407 pub fn mpsgraph_executable_run_with_descriptor(
408 executable_handle: *mut c_void,
409 command_queue_handle: *mut c_void,
410 input_handles: *const *mut c_void,
411 input_count: usize,
412 result_handles: *const *mut c_void,
413 result_count: usize,
414 execution_descriptor_handle: *mut c_void,
415 ) -> *mut c_void;
416 pub fn mpsgraph_executable_run_async_with_descriptor(
417 executable_handle: *mut c_void,
418 command_queue_handle: *mut c_void,
419 input_handles: *const *mut c_void,
420 input_count: usize,
421 result_handles: *const *mut c_void,
422 result_count: usize,
423 execution_descriptor_handle: *mut c_void,
424 ) -> *mut c_void;
425 pub fn mpsgraph_executable_serialize_package(
426 handle: *mut c_void,
427 path: *const c_char,
428 descriptor_handle: *mut c_void,
429 ) -> bool;
430 pub fn mpsgraph_executable_new_with_package(
431 path: *const c_char,
432 compilation_descriptor_handle: *mut c_void,
433 ) -> *mut c_void;
434
435 pub fn mpsgraph_graph_arithmetic_unary(
436 graph_handle: *mut c_void,
437 op: u32,
438 tensor_handle: *mut c_void,
439 name: *const c_char,
440 ) -> *mut c_void;
441 pub fn mpsgraph_graph_arithmetic_binary(
442 graph_handle: *mut c_void,
443 op: u32,
444 primary_handle: *mut c_void,
445 secondary_handle: *mut c_void,
446 name: *const c_char,
447 ) -> *mut c_void;
448 pub fn mpsgraph_graph_select(
449 graph_handle: *mut c_void,
450 predicate_handle: *mut c_void,
451 true_handle: *mut c_void,
452 false_handle: *mut c_void,
453 name: *const c_char,
454 ) -> *mut c_void;
455 pub fn mpsgraph_graph_relu_gradient(
456 graph_handle: *mut c_void,
457 gradient_handle: *mut c_void,
458 source_handle: *mut c_void,
459 name: *const c_char,
460 ) -> *mut c_void;
461 pub fn mpsgraph_graph_sigmoid_gradient(
462 graph_handle: *mut c_void,
463 gradient_handle: *mut c_void,
464 source_handle: *mut c_void,
465 name: *const c_char,
466 ) -> *mut c_void;
467 pub fn mpsgraph_graph_softmax_gradient(
468 graph_handle: *mut c_void,
469 gradient_handle: *mut c_void,
470 source_handle: *mut c_void,
471 axis: isize,
472 name: *const c_char,
473 ) -> *mut c_void;
474 pub fn mpsgraph_graph_leaky_relu_scalar(
475 graph_handle: *mut c_void,
476 tensor_handle: *mut c_void,
477 alpha: f64,
478 name: *const c_char,
479 ) -> *mut c_void;
480 pub fn mpsgraph_graph_leaky_relu_tensor(
481 graph_handle: *mut c_void,
482 tensor_handle: *mut c_void,
483 alpha_tensor_handle: *mut c_void,
484 name: *const c_char,
485 ) -> *mut c_void;
486 pub fn mpsgraph_graph_leaky_relu_gradient(
487 graph_handle: *mut c_void,
488 gradient_handle: *mut c_void,
489 source_handle: *mut c_void,
490 alpha_tensor_handle: *mut c_void,
491 name: *const c_char,
492 ) -> *mut c_void;
493 pub fn mpsgraph_graph_reduction_axis(
494 graph_handle: *mut c_void,
495 op: u32,
496 tensor_handle: *mut c_void,
497 axis: isize,
498 name: *const c_char,
499 ) -> *mut c_void;
500 pub fn mpsgraph_graph_reduction_axes(
501 graph_handle: *mut c_void,
502 op: u32,
503 tensor_handle: *mut c_void,
504 axes: *const usize,
505 axes_len: usize,
506 name: *const c_char,
507 ) -> *mut c_void;
508 pub fn mpsgraph_graph_concat_pair(
509 graph_handle: *mut c_void,
510 first_handle: *mut c_void,
511 second_handle: *mut c_void,
512 dimension: isize,
513 name: *const c_char,
514 ) -> *mut c_void;
515 pub fn mpsgraph_graph_concat_tensors(
516 graph_handle: *mut c_void,
517 tensor_handles: *const *mut c_void,
518 tensor_count: usize,
519 dimension: isize,
520 interleave: bool,
521 name: *const c_char,
522 ) -> *mut c_void;
523 pub fn mpsgraph_graph_split_sizes(
524 graph_handle: *mut c_void,
525 tensor_handle: *mut c_void,
526 split_sizes: *const usize,
527 split_count: usize,
528 axis: isize,
529 name: *const c_char,
530 ) -> *mut c_void;
531 pub fn mpsgraph_graph_split_sizes_tensor(
532 graph_handle: *mut c_void,
533 tensor_handle: *mut c_void,
534 split_sizes_tensor_handle: *mut c_void,
535 axis: isize,
536 name: *const c_char,
537 ) -> *mut c_void;
538 pub fn mpsgraph_graph_split_num(
539 graph_handle: *mut c_void,
540 tensor_handle: *mut c_void,
541 num_splits: usize,
542 axis: isize,
543 name: *const c_char,
544 ) -> *mut c_void;
545 pub fn mpsgraph_graph_stack(
546 graph_handle: *mut c_void,
547 tensor_handles: *const *mut c_void,
548 tensor_count: usize,
549 axis: isize,
550 name: *const c_char,
551 ) -> *mut c_void;
552 pub fn mpsgraph_graph_pad(
553 graph_handle: *mut c_void,
554 tensor_handle: *mut c_void,
555 padding_mode: isize,
556 left_padding: *const isize,
557 left_padding_len: usize,
558 right_padding: *const isize,
559 right_padding_len: usize,
560 constant_value: f64,
561 name: *const c_char,
562 ) -> *mut c_void;
563 pub fn mpsgraph_graph_top_k(
564 graph_handle: *mut c_void,
565 source_handle: *mut c_void,
566 k: usize,
567 name: *const c_char,
568 ) -> *mut c_void;
569 pub fn mpsgraph_graph_top_k_tensor(
570 graph_handle: *mut c_void,
571 source_handle: *mut c_void,
572 k_tensor_handle: *mut c_void,
573 name: *const c_char,
574 ) -> *mut c_void;
575 pub fn mpsgraph_tensor_array_box_new(
576 handles: *const *mut c_void,
577 count: usize,
578 ) -> *mut c_void;
579 pub fn mpsgraph_compilation_descriptor_set_callable(
580 handle: *mut c_void,
581 symbol_name: *const c_char,
582 executable_handle: *mut c_void,
583 ) -> bool;
584 pub fn mpsgraph_graph_call_symbol(
585 graph_handle: *mut c_void,
586 symbol_name: *const c_char,
587 input_handles: *const *mut c_void,
588 input_count: usize,
589 output_type_handles: *const *mut c_void,
590 output_type_count: usize,
591 name: *const c_char,
592 ) -> *mut c_void;
593 pub fn mpsgraph_graph_gather_nd(
594 graph_handle: *mut c_void,
595 updates_tensor_handle: *mut c_void,
596 indices_tensor_handle: *mut c_void,
597 batch_dimensions: usize,
598 name: *const c_char,
599 ) -> *mut c_void;
600 pub fn mpsgraph_graph_gather(
601 graph_handle: *mut c_void,
602 updates_tensor_handle: *mut c_void,
603 indices_tensor_handle: *mut c_void,
604 axis: usize,
605 batch_dimensions: usize,
606 name: *const c_char,
607 ) -> *mut c_void;
608 pub fn mpsgraph_graph_gather_along_axis(
609 graph_handle: *mut c_void,
610 axis: isize,
611 updates_tensor_handle: *mut c_void,
612 indices_tensor_handle: *mut c_void,
613 name: *const c_char,
614 ) -> *mut c_void;
615 pub fn mpsgraph_graph_gather_along_axis_tensor(
616 graph_handle: *mut c_void,
617 axis_tensor_handle: *mut c_void,
618 updates_tensor_handle: *mut c_void,
619 indices_tensor_handle: *mut c_void,
620 name: *const c_char,
621 ) -> *mut c_void;
622 pub fn mpsgraph_random_op_descriptor_new(distribution: u64, data_type: u32) -> *mut c_void;
623 pub fn mpsgraph_random_op_descriptor_distribution(handle: *mut c_void) -> u64;
624 pub fn mpsgraph_random_op_descriptor_set_distribution(handle: *mut c_void, raw_value: u64)
625 -> bool;
626 pub fn mpsgraph_random_op_descriptor_data_type(handle: *mut c_void) -> u32;
627 pub fn mpsgraph_random_op_descriptor_set_data_type(handle: *mut c_void, raw_value: u32)
628 -> bool;
629 pub fn mpsgraph_random_op_descriptor_min(handle: *mut c_void) -> f32;
630 pub fn mpsgraph_random_op_descriptor_set_min(handle: *mut c_void, value: f32) -> bool;
631 pub fn mpsgraph_random_op_descriptor_max(handle: *mut c_void) -> f32;
632 pub fn mpsgraph_random_op_descriptor_set_max(handle: *mut c_void, value: f32) -> bool;
633 pub fn mpsgraph_random_op_descriptor_min_integer(handle: *mut c_void) -> isize;
634 pub fn mpsgraph_random_op_descriptor_set_min_integer(handle: *mut c_void, value: isize)
635 -> bool;
636 pub fn mpsgraph_random_op_descriptor_max_integer(handle: *mut c_void) -> isize;
637 pub fn mpsgraph_random_op_descriptor_set_max_integer(handle: *mut c_void, value: isize)
638 -> bool;
639 pub fn mpsgraph_random_op_descriptor_mean(handle: *mut c_void) -> f32;
640 pub fn mpsgraph_random_op_descriptor_set_mean(handle: *mut c_void, value: f32) -> bool;
641 pub fn mpsgraph_random_op_descriptor_standard_deviation(handle: *mut c_void) -> f32;
642 pub fn mpsgraph_random_op_descriptor_set_standard_deviation(
643 handle: *mut c_void,
644 value: f32,
645 ) -> bool;
646 pub fn mpsgraph_random_op_descriptor_sampling_method(handle: *mut c_void) -> u64;
647 pub fn mpsgraph_random_op_descriptor_set_sampling_method(handle: *mut c_void, raw_value: u64)
648 -> bool;
649 pub fn mpsgraph_graph_random_philox_state_seed(
650 graph_handle: *mut c_void,
651 seed: usize,
652 name: *const c_char,
653 ) -> *mut c_void;
654 pub fn mpsgraph_graph_random_philox_state_counter(
655 graph_handle: *mut c_void,
656 counter_low: usize,
657 counter_high: usize,
658 key: usize,
659 name: *const c_char,
660 ) -> *mut c_void;
661 pub fn mpsgraph_graph_random_tensor(
662 graph_handle: *mut c_void,
663 shape: *const usize,
664 shape_len: usize,
665 descriptor_handle: *mut c_void,
666 name: *const c_char,
667 ) -> *mut c_void;
668 pub fn mpsgraph_graph_random_tensor_shape_tensor(
669 graph_handle: *mut c_void,
670 shape_tensor_handle: *mut c_void,
671 descriptor_handle: *mut c_void,
672 name: *const c_char,
673 ) -> *mut c_void;
674 pub fn mpsgraph_graph_random_tensor_seed(
675 graph_handle: *mut c_void,
676 shape: *const usize,
677 shape_len: usize,
678 descriptor_handle: *mut c_void,
679 seed: usize,
680 name: *const c_char,
681 ) -> *mut c_void;
682 pub fn mpsgraph_graph_random_tensor_shape_tensor_seed(
683 graph_handle: *mut c_void,
684 shape_tensor_handle: *mut c_void,
685 descriptor_handle: *mut c_void,
686 seed: usize,
687 name: *const c_char,
688 ) -> *mut c_void;
689 pub fn mpsgraph_graph_random_tensor_state(
690 graph_handle: *mut c_void,
691 shape: *const usize,
692 shape_len: usize,
693 descriptor_handle: *mut c_void,
694 state_handle: *mut c_void,
695 name: *const c_char,
696 ) -> *mut c_void;
697 pub fn mpsgraph_graph_random_tensor_shape_tensor_state(
698 graph_handle: *mut c_void,
699 shape_tensor_handle: *mut c_void,
700 descriptor_handle: *mut c_void,
701 state_handle: *mut c_void,
702 name: *const c_char,
703 ) -> *mut c_void;
704 pub fn mpsgraph_graph_dropout(
705 graph_handle: *mut c_void,
706 tensor_handle: *mut c_void,
707 rate: f64,
708 name: *const c_char,
709 ) -> *mut c_void;
710 pub fn mpsgraph_graph_dropout_tensor(
711 graph_handle: *mut c_void,
712 tensor_handle: *mut c_void,
713 rate_tensor_handle: *mut c_void,
714 name: *const c_char,
715 ) -> *mut c_void;
716 pub fn mpsgraph_single_gate_rnn_descriptor_new() -> *mut c_void;
717 pub fn mpsgraph_single_gate_rnn_descriptor_reverse(handle: *mut c_void) -> bool;
718 pub fn mpsgraph_single_gate_rnn_descriptor_set_reverse(handle: *mut c_void, value: bool)
719 -> bool;
720 pub fn mpsgraph_single_gate_rnn_descriptor_bidirectional(handle: *mut c_void) -> bool;
721 pub fn mpsgraph_single_gate_rnn_descriptor_set_bidirectional(handle: *mut c_void, value: bool)
722 -> bool;
723 pub fn mpsgraph_single_gate_rnn_descriptor_training(handle: *mut c_void) -> bool;
724 pub fn mpsgraph_single_gate_rnn_descriptor_set_training(handle: *mut c_void, value: bool)
725 -> bool;
726 pub fn mpsgraph_single_gate_rnn_descriptor_activation(handle: *mut c_void) -> usize;
727 pub fn mpsgraph_single_gate_rnn_descriptor_set_activation(handle: *mut c_void, value: usize)
728 -> bool;
729 pub fn mpsgraph_lstm_descriptor_new() -> *mut c_void;
730 pub fn mpsgraph_lstm_descriptor_reverse(handle: *mut c_void) -> bool;
731 pub fn mpsgraph_lstm_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
732 pub fn mpsgraph_lstm_descriptor_bidirectional(handle: *mut c_void) -> bool;
733 pub fn mpsgraph_lstm_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
734 pub fn mpsgraph_lstm_descriptor_produce_cell(handle: *mut c_void) -> bool;
735 pub fn mpsgraph_lstm_descriptor_set_produce_cell(handle: *mut c_void, value: bool) -> bool;
736 pub fn mpsgraph_lstm_descriptor_training(handle: *mut c_void) -> bool;
737 pub fn mpsgraph_lstm_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
738 pub fn mpsgraph_lstm_descriptor_forget_gate_last(handle: *mut c_void) -> bool;
739 pub fn mpsgraph_lstm_descriptor_set_forget_gate_last(handle: *mut c_void, value: bool)
740 -> bool;
741 pub fn mpsgraph_lstm_descriptor_input_gate_activation(handle: *mut c_void) -> usize;
742 pub fn mpsgraph_lstm_descriptor_set_input_gate_activation(
743 handle: *mut c_void,
744 value: usize,
745 ) -> bool;
746 pub fn mpsgraph_lstm_descriptor_forget_gate_activation(handle: *mut c_void) -> usize;
747 pub fn mpsgraph_lstm_descriptor_set_forget_gate_activation(
748 handle: *mut c_void,
749 value: usize,
750 ) -> bool;
751 pub fn mpsgraph_lstm_descriptor_cell_gate_activation(handle: *mut c_void) -> usize;
752 pub fn mpsgraph_lstm_descriptor_set_cell_gate_activation(handle: *mut c_void, value: usize)
753 -> bool;
754 pub fn mpsgraph_lstm_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
755 pub fn mpsgraph_lstm_descriptor_set_output_gate_activation(
756 handle: *mut c_void,
757 value: usize,
758 ) -> bool;
759 pub fn mpsgraph_lstm_descriptor_activation(handle: *mut c_void) -> usize;
760 pub fn mpsgraph_lstm_descriptor_set_activation(handle: *mut c_void, value: usize) -> bool;
761 pub fn mpsgraph_gru_descriptor_new() -> *mut c_void;
762 pub fn mpsgraph_gru_descriptor_reverse(handle: *mut c_void) -> bool;
763 pub fn mpsgraph_gru_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
764 pub fn mpsgraph_gru_descriptor_bidirectional(handle: *mut c_void) -> bool;
765 pub fn mpsgraph_gru_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
766 pub fn mpsgraph_gru_descriptor_training(handle: *mut c_void) -> bool;
767 pub fn mpsgraph_gru_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
768 pub fn mpsgraph_gru_descriptor_reset_gate_first(handle: *mut c_void) -> bool;
769 pub fn mpsgraph_gru_descriptor_set_reset_gate_first(handle: *mut c_void, value: bool)
770 -> bool;
771 pub fn mpsgraph_gru_descriptor_reset_after(handle: *mut c_void) -> bool;
772 pub fn mpsgraph_gru_descriptor_set_reset_after(handle: *mut c_void, value: bool) -> bool;
773 pub fn mpsgraph_gru_descriptor_flip_z(handle: *mut c_void) -> bool;
774 pub fn mpsgraph_gru_descriptor_set_flip_z(handle: *mut c_void, value: bool) -> bool;
775 pub fn mpsgraph_gru_descriptor_update_gate_activation(handle: *mut c_void) -> usize;
776 pub fn mpsgraph_gru_descriptor_set_update_gate_activation(handle: *mut c_void, value: usize)
777 -> bool;
778 pub fn mpsgraph_gru_descriptor_reset_gate_activation(handle: *mut c_void) -> usize;
779 pub fn mpsgraph_gru_descriptor_set_reset_gate_activation(handle: *mut c_void, value: usize)
780 -> bool;
781 pub fn mpsgraph_gru_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
782 pub fn mpsgraph_gru_descriptor_set_output_gate_activation(handle: *mut c_void, value: usize)
783 -> bool;
784 pub fn mpsgraph_graph_single_gate_rnn(
785 graph_handle: *mut c_void,
786 source_handle: *mut c_void,
787 recurrent_weight_handle: *mut c_void,
788 input_weight_handle: *mut c_void,
789 bias_handle: *mut c_void,
790 init_state_handle: *mut c_void,
791 mask_handle: *mut c_void,
792 descriptor_handle: *mut c_void,
793 name: *const c_char,
794 ) -> *mut c_void;
795 pub fn mpsgraph_graph_lstm(
796 graph_handle: *mut c_void,
797 source_handle: *mut c_void,
798 recurrent_weight_handle: *mut c_void,
799 input_weight_handle: *mut c_void,
800 bias_handle: *mut c_void,
801 init_state_handle: *mut c_void,
802 init_cell_handle: *mut c_void,
803 mask_handle: *mut c_void,
804 peephole_handle: *mut c_void,
805 descriptor_handle: *mut c_void,
806 name: *const c_char,
807 ) -> *mut c_void;
808 pub fn mpsgraph_graph_gru(
809 graph_handle: *mut c_void,
810 source_handle: *mut c_void,
811 recurrent_weight_handle: *mut c_void,
812 input_weight_handle: *mut c_void,
813 bias_handle: *mut c_void,
814 init_state_handle: *mut c_void,
815 mask_handle: *mut c_void,
816 secondary_bias_handle: *mut c_void,
817 descriptor_handle: *mut c_void,
818 name: *const c_char,
819 ) -> *mut c_void;
820 pub fn mpsgraph_graph_control_dependency(
821 graph_handle: *mut c_void,
822 operation_handles: *const *mut c_void,
823 operation_count: usize,
824 dependent_callback: Option<TensorArrayCallback>,
825 dependent_context: *mut c_void,
826 name: *const c_char,
827 ) -> *mut c_void;
828 pub fn mpsgraph_graph_if_then_else(
829 graph_handle: *mut c_void,
830 predicate_handle: *mut c_void,
831 then_callback: Option<TensorArrayCallback>,
832 then_context: *mut c_void,
833 else_callback: Option<TensorArrayCallback>,
834 else_context: *mut c_void,
835 name: *const c_char,
836 ) -> *mut c_void;
837 pub fn mpsgraph_graph_while_loop(
838 graph_handle: *mut c_void,
839 input_handles: *const *mut c_void,
840 input_count: usize,
841 before_callback: Option<WhileBeforeCallback>,
842 before_context: *mut c_void,
843 after_callback: Option<TensorArrayInputCallback>,
844 after_context: *mut c_void,
845 name: *const c_char,
846 ) -> *mut c_void;
847 pub fn mpsgraph_graph_for_loop(
848 graph_handle: *mut c_void,
849 lower_bound_handle: *mut c_void,
850 upper_bound_handle: *mut c_void,
851 step_handle: *mut c_void,
852 argument_handles: *const *mut c_void,
853 argument_count: usize,
854 body_callback: Option<ForBodyCallback>,
855 body_context: *mut c_void,
856 name: *const c_char,
857 ) -> *mut c_void;
858 pub fn mpsgraph_graph_for_loop_iterations(
859 graph_handle: *mut c_void,
860 number_of_iterations_handle: *mut c_void,
861 argument_handles: *const *mut c_void,
862 argument_count: usize,
863 body_callback: Option<ForBodyCallback>,
864 body_context: *mut c_void,
865 name: *const c_char,
866 ) -> *mut c_void;
867}