1use core::ffi::{c_char, c_void};
2
3pub type TensorArrayCallback = unsafe extern "C" fn(context: *mut c_void) -> *mut c_void;
5pub type TensorArrayInputCallback =
7 unsafe extern "C" fn(context: *mut c_void, input_box_handle: *mut c_void) -> *mut c_void;
8pub type WhileBeforeCallback = unsafe extern "C" fn(
10 context: *mut c_void,
11 input_box_handle: *mut c_void,
12 out_result_box_handle: *mut *mut c_void,
13) -> *mut c_void;
14pub type ForBodyCallback = unsafe extern "C" fn(
16 context: *mut c_void,
17 index_handle: *mut c_void,
18 input_box_handle: *mut c_void,
19) -> *mut c_void;
20
21mod specialized;
22pub use specialized::*;
24
25unsafe extern "C" {
26pub fn mpsgraph_object_release(handle: *mut c_void);
28
29pub fn mpsgraph_tensor_data_new_with_bytes(
31 device_handle: *mut c_void,
32 bytes: *const c_void,
33 byte_len: usize,
34 shape: *const usize,
35 shape_len: usize,
36 data_type: u32,
37 ) -> *mut c_void;
38pub fn mpsgraph_tensor_data_new_with_buffer(
40 buffer_handle: *mut c_void,
41 shape: *const usize,
42 shape_len: usize,
43 data_type: u32,
44 ) -> *mut c_void;
45pub fn mpsgraph_tensor_data_new_with_tensor(tensor_handle: *mut c_void) -> *mut c_void;
47pub fn mpsgraph_tensor_data_data_type(handle: *mut c_void) -> u32;
49pub fn mpsgraph_tensor_data_shape_len(handle: *mut c_void) -> usize;
51pub fn mpsgraph_tensor_data_copy_shape(handle: *mut c_void, out_shape: *mut usize);
53pub fn mpsgraph_tensor_data_read_bytes(
55 handle: *mut c_void,
56 dst: *mut c_void,
57 dst_len: usize,
58 ) -> bool;
59pub fn mpsgraph_tensor_data_device(handle: *mut c_void) -> *mut c_void;
61
62pub fn mpsgraph_graph_new() -> *mut c_void;
64pub fn mpsgraph_graph_placeholder(
66 graph_handle: *mut c_void,
67 shape: *const usize,
68 shape_len: usize,
69 data_type: u32,
70 name: *const c_char,
71 ) -> *mut c_void;
72pub fn mpsgraph_graph_constant_data(
74 graph_handle: *mut c_void,
75 bytes: *const c_void,
76 byte_len: usize,
77 shape: *const usize,
78 shape_len: usize,
79 data_type: u32,
80 ) -> *mut c_void;
81pub fn mpsgraph_graph_constant_scalar(
83 graph_handle: *mut c_void,
84 scalar: f64,
85 data_type: u32,
86 ) -> *mut c_void;
87pub fn mpsgraph_graph_constant_scalar_shaped(
89 graph_handle: *mut c_void,
90 scalar: f64,
91 shape: *const usize,
92 shape_len: usize,
93 data_type: u32,
94 ) -> *mut c_void;
95
96pub fn mpsgraph_graph_addition(
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;
103pub fn mpsgraph_graph_subtraction(
105 graph_handle: *mut c_void,
106 primary_tensor: *mut c_void,
107 secondary_tensor: *mut c_void,
108 name: *const c_char,
109 ) -> *mut c_void;
110pub fn mpsgraph_graph_multiplication(
112 graph_handle: *mut c_void,
113 primary_tensor: *mut c_void,
114 secondary_tensor: *mut c_void,
115 name: *const c_char,
116 ) -> *mut c_void;
117pub fn mpsgraph_graph_division(
119 graph_handle: *mut c_void,
120 primary_tensor: *mut c_void,
121 secondary_tensor: *mut c_void,
122 name: *const c_char,
123 ) -> *mut c_void;
124pub fn mpsgraph_graph_matrix_multiplication(
126 graph_handle: *mut c_void,
127 primary_tensor: *mut c_void,
128 secondary_tensor: *mut c_void,
129 name: *const c_char,
130 ) -> *mut c_void;
131pub fn mpsgraph_graph_relu(
133 graph_handle: *mut c_void,
134 tensor: *mut c_void,
135 name: *const c_char,
136 ) -> *mut c_void;
137pub fn mpsgraph_graph_sigmoid(
139 graph_handle: *mut c_void,
140 tensor: *mut c_void,
141 name: *const c_char,
142 ) -> *mut c_void;
143pub fn mpsgraph_graph_softmax(
145 graph_handle: *mut c_void,
146 tensor: *mut c_void,
147 axis: isize,
148 name: *const c_char,
149 ) -> *mut c_void;
150pub fn mpsgraph_graph_reshape(
152 graph_handle: *mut c_void,
153 tensor: *mut c_void,
154 shape: *const usize,
155 shape_len: usize,
156 name: *const c_char,
157 ) -> *mut c_void;
158pub fn mpsgraph_graph_transpose(
160 graph_handle: *mut c_void,
161 tensor: *mut c_void,
162 permutation: *const usize,
163 permutation_len: usize,
164 name: *const c_char,
165 ) -> *mut c_void;
166pub fn mpsgraph_graph_slice(
168 graph_handle: *mut c_void,
169 tensor: *mut c_void,
170 dimension: usize,
171 start: isize,
172 length: isize,
173 name: *const c_char,
174 ) -> *mut c_void;
175pub fn mpsgraph_graph_broadcast(
177 graph_handle: *mut c_void,
178 tensor: *mut c_void,
179 shape: *const usize,
180 shape_len: usize,
181 name: *const c_char,
182 ) -> *mut c_void;
183pub fn mpsgraph_graph_reduction_sum(
185 graph_handle: *mut c_void,
186 tensor: *mut c_void,
187 axes: *const usize,
188 axes_len: usize,
189 name: *const c_char,
190 ) -> *mut c_void;
191pub fn mpsgraph_graph_reduction_maximum(
193 graph_handle: *mut c_void,
194 tensor: *mut c_void,
195 axes: *const usize,
196 axes_len: usize,
197 name: *const c_char,
198 ) -> *mut c_void;
199pub fn mpsgraph_graph_reduction_minimum(
201 graph_handle: *mut c_void,
202 tensor: *mut c_void,
203 axes: *const usize,
204 axes_len: usize,
205 name: *const c_char,
206 ) -> *mut c_void;
207pub fn mpsgraph_graph_mean(
209 graph_handle: *mut c_void,
210 tensor: *mut c_void,
211 axes: *const usize,
212 axes_len: usize,
213 name: *const c_char,
214 ) -> *mut c_void;
215
216pub fn mpsgraph_convolution2d_descriptor_new(
218 stride_in_x: usize,
219 stride_in_y: usize,
220 dilation_rate_in_x: usize,
221 dilation_rate_in_y: usize,
222 groups: usize,
223 padding_left: usize,
224 padding_right: usize,
225 padding_top: usize,
226 padding_bottom: usize,
227 padding_style: usize,
228 data_layout: usize,
229 weights_layout: usize,
230 ) -> *mut c_void;
231pub fn mpsgraph_pooling2d_descriptor_new(
233 kernel_width: usize,
234 kernel_height: usize,
235 stride_in_x: usize,
236 stride_in_y: usize,
237 dilation_rate_in_x: usize,
238 dilation_rate_in_y: usize,
239 padding_left: usize,
240 padding_right: usize,
241 padding_top: usize,
242 padding_bottom: usize,
243 padding_style: usize,
244 data_layout: usize,
245 ) -> *mut c_void;
246pub fn mpsgraph_graph_convolution2d(
248 graph_handle: *mut c_void,
249 source_tensor: *mut c_void,
250 weights_tensor: *mut c_void,
251 descriptor_handle: *mut c_void,
252 name: *const c_char,
253 ) -> *mut c_void;
254pub fn mpsgraph_graph_max_pooling2d(
256 graph_handle: *mut c_void,
257 source_tensor: *mut c_void,
258 descriptor_handle: *mut c_void,
259 name: *const c_char,
260 ) -> *mut c_void;
261pub fn mpsgraph_graph_normalize(
263 graph_handle: *mut c_void,
264 tensor: *mut c_void,
265 mean_tensor: *mut c_void,
266 variance_tensor: *mut c_void,
267 gamma_tensor: *mut c_void,
268 beta_tensor: *mut c_void,
269 epsilon: f32,
270 name: *const c_char,
271 ) -> *mut c_void;
272
273pub fn mpsgraph_graph_run(
275 graph_handle: *mut c_void,
276 feed_tensors: *const *mut c_void,
277 feed_data: *const *mut c_void,
278 feed_count: usize,
279 target_tensors: *const *mut c_void,
280 target_count: usize,
281 out_results: *mut *mut c_void,
282 ) -> bool;
283pub fn mpsgraph_graph_run_with_command_queue(
285 graph_handle: *mut c_void,
286 command_queue_handle: *mut c_void,
287 feed_tensors: *const *mut c_void,
288 feed_data: *const *mut c_void,
289 feed_count: usize,
290 target_tensors: *const *mut c_void,
291 target_count: usize,
292 out_results: *mut *mut c_void,
293 ) -> bool;
294pub fn mpsgraph_graph_compile(
296 graph_handle: *mut c_void,
297 device_handle: *mut c_void,
298 feed_tensors: *const *mut c_void,
299 feed_count: usize,
300 flat_shapes: *const usize,
301 shape_lengths: *const usize,
302 data_types: *const u32,
303 target_tensors: *const *mut c_void,
304 target_count: usize,
305 ) -> *mut c_void;
306pub fn mpsgraph_executable_run(
308 executable_handle: *mut c_void,
309 command_queue_handle: *mut c_void,
310 input_data: *const *mut c_void,
311 input_count: usize,
312 output_count: usize,
313 out_results: *mut *mut c_void,
314 ) -> bool;
315
316pub fn mpsgraph_tensor_array_box_len(handle: *mut c_void) -> usize;
318pub fn mpsgraph_tensor_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
320pub fn mpsgraph_tensor_data_array_box_len(handle: *mut c_void) -> usize;
322pub fn mpsgraph_tensor_data_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
324pub fn mpsgraph_shaped_type_array_box_len(handle: *mut c_void) -> usize;
326pub fn mpsgraph_shaped_type_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
328
329pub fn mpsgraph_device_new_with_metal_device(metal_device_handle: *mut c_void) -> *mut c_void;
331pub fn mpsgraph_device_type(handle: *mut c_void) -> u32;
333
334pub fn mpsgraph_shaped_type_new(
336 shape: *const isize,
337 shape_len: usize,
338 data_type: u32,
339 ) -> *mut c_void;
340pub fn mpsgraph_shaped_type_has_shape(handle: *mut c_void) -> bool;
342pub fn mpsgraph_shaped_type_shape_len(handle: *mut c_void) -> usize;
344pub fn mpsgraph_shaped_type_copy_shape(handle: *mut c_void, out_shape: *mut isize);
346pub fn mpsgraph_shaped_type_data_type(handle: *mut c_void) -> u32;
348pub fn mpsgraph_shaped_type_set_shape(
350 handle: *mut c_void,
351 shape: *const isize,
352 shape_len: usize,
353 ) -> bool;
354pub fn mpsgraph_shaped_type_set_data_type(handle: *mut c_void, data_type: u32) -> bool;
356pub fn mpsgraph_shaped_type_is_equal(handle: *mut c_void, other_handle: *mut c_void) -> bool;
358
359pub fn mpsgraph_tensor_has_shape(handle: *mut c_void) -> bool;
361pub fn mpsgraph_tensor_shape_len(handle: *mut c_void) -> usize;
363pub fn mpsgraph_tensor_copy_shape(handle: *mut c_void, out_shape: *mut isize);
365pub fn mpsgraph_tensor_data_type(handle: *mut c_void) -> u32;
367pub fn mpsgraph_tensor_operation(handle: *mut c_void) -> *mut c_void;
369
370pub fn mpsgraph_graph_options(handle: *mut c_void) -> u64;
372pub fn mpsgraph_graph_set_options(handle: *mut c_void, raw_value: u64) -> bool;
374pub fn mpsgraph_graph_placeholder_tensors(handle: *mut c_void) -> *mut c_void;
376
377pub fn mpsgraph_compilation_descriptor_new() -> *mut c_void;
379pub fn mpsgraph_compilation_descriptor_disable_type_inference(handle: *mut c_void) -> bool;
381pub fn mpsgraph_compilation_descriptor_optimization_level(handle: *mut c_void) -> u64;
383pub fn mpsgraph_compilation_descriptor_set_optimization_level(
385 handle: *mut c_void,
386 raw_value: u64,
387 ) -> bool;
388pub fn mpsgraph_compilation_descriptor_wait_for_completion(handle: *mut c_void) -> bool;
390pub fn mpsgraph_compilation_descriptor_set_wait_for_completion(
392 handle: *mut c_void,
393 value: bool,
394 ) -> bool;
395pub fn mpsgraph_compilation_descriptor_optimization_profile(handle: *mut c_void) -> u64;
397pub fn mpsgraph_compilation_descriptor_set_optimization_profile(
399 handle: *mut c_void,
400 raw_value: u64,
401 ) -> bool;
402pub fn mpsgraph_compilation_descriptor_reduced_precision_fast_math(
404 handle: *mut c_void,
405 ) -> usize;
406pub fn mpsgraph_compilation_descriptor_set_reduced_precision_fast_math(
408 handle: *mut c_void,
409 raw_value: usize,
410 ) -> bool;
411
412pub fn mpsgraph_execution_descriptor_new() -> *mut c_void;
414pub fn mpsgraph_execution_descriptor_wait_until_completed(handle: *mut c_void) -> bool;
416pub fn mpsgraph_execution_descriptor_set_wait_until_completed(
418 handle: *mut c_void,
419 value: bool,
420 ) -> bool;
421pub fn mpsgraph_execution_descriptor_compilation_descriptor(handle: *mut c_void)
423 -> *mut c_void;
424pub fn mpsgraph_execution_descriptor_set_compilation_descriptor(
426 handle: *mut c_void,
427 compilation_descriptor_handle: *mut c_void,
428 ) -> bool;
429
430pub fn mpsgraph_executable_execution_descriptor_new() -> *mut c_void;
432pub fn mpsgraph_executable_execution_descriptor_wait_until_completed(
434 handle: *mut c_void,
435 ) -> bool;
436pub fn mpsgraph_executable_execution_descriptor_set_wait_until_completed(
438 handle: *mut c_void,
439 value: bool,
440 ) -> bool;
441
442pub fn mpsgraph_executable_serialization_descriptor_new() -> *mut c_void;
444pub fn mpsgraph_executable_serialization_descriptor_append(handle: *mut c_void) -> bool;
446pub fn mpsgraph_executable_serialization_descriptor_set_append(
448 handle: *mut c_void,
449 value: bool,
450 ) -> bool;
451pub fn mpsgraph_executable_serialization_descriptor_deployment_platform(
453 handle: *mut c_void,
454 ) -> u64;
455pub fn mpsgraph_executable_serialization_descriptor_set_deployment_platform(
457 handle: *mut c_void,
458 raw_value: u64,
459 ) -> bool;
460pub fn mpsgraph_executable_serialization_descriptor_minimum_deployment_target_len(
462 handle: *mut c_void,
463 ) -> usize;
464pub fn mpsgraph_executable_serialization_descriptor_copy_minimum_deployment_target(
466 handle: *mut c_void,
467 out_bytes: *mut u8,
468 out_len: usize,
469 ) -> bool;
470pub fn mpsgraph_executable_serialization_descriptor_set_minimum_deployment_target(
472 handle: *mut c_void,
473 value: *const c_char,
474 ) -> bool;
475
476pub fn mpsgraph_graph_compile_with_descriptor(
478 graph_handle: *mut c_void,
479 device_handle: *mut c_void,
480 feed_tensors: *const *mut c_void,
481 feed_count: usize,
482 flat_shapes: *const usize,
483 shape_lengths: *const usize,
484 data_types: *const u32,
485 target_tensors: *const *mut c_void,
486 target_count: usize,
487 compilation_descriptor_handle: *mut c_void,
488 ) -> *mut c_void;
489
490pub fn mpsgraph_executable_options(handle: *mut c_void) -> u64;
492pub fn mpsgraph_executable_set_options(handle: *mut c_void, raw_value: u64) -> bool;
494pub fn mpsgraph_executable_feed_tensors(handle: *mut c_void) -> *mut c_void;
496pub fn mpsgraph_executable_target_tensors(handle: *mut c_void) -> *mut c_void;
498pub fn mpsgraph_executable_specialize(
500 handle: *mut c_void,
501 device_handle: *mut c_void,
502 input_type_handles: *const *mut c_void,
503 input_type_count: usize,
504 compilation_descriptor_handle: *mut c_void,
505 ) -> bool;
506pub fn mpsgraph_executable_get_output_types(
508 handle: *mut c_void,
509 device_handle: *mut c_void,
510 input_type_handles: *const *mut c_void,
511 input_type_count: usize,
512 compilation_descriptor_handle: *mut c_void,
513 ) -> *mut c_void;
514pub fn mpsgraph_executable_run_with_descriptor(
516 executable_handle: *mut c_void,
517 command_queue_handle: *mut c_void,
518 input_handles: *const *mut c_void,
519 input_count: usize,
520 result_handles: *const *mut c_void,
521 result_count: usize,
522 execution_descriptor_handle: *mut c_void,
523 ) -> *mut c_void;
524pub fn mpsgraph_executable_run_async_with_descriptor(
526 executable_handle: *mut c_void,
527 command_queue_handle: *mut c_void,
528 input_handles: *const *mut c_void,
529 input_count: usize,
530 result_handles: *const *mut c_void,
531 result_count: usize,
532 execution_descriptor_handle: *mut c_void,
533 ) -> *mut c_void;
534pub fn mpsgraph_executable_serialize_package(
536 handle: *mut c_void,
537 path: *const c_char,
538 descriptor_handle: *mut c_void,
539 ) -> bool;
540pub fn mpsgraph_executable_new_with_package(
542 path: *const c_char,
543 compilation_descriptor_handle: *mut c_void,
544 ) -> *mut c_void;
545
546pub fn mpsgraph_graph_arithmetic_unary(
548 graph_handle: *mut c_void,
549 op: u32,
550 tensor_handle: *mut c_void,
551 name: *const c_char,
552 ) -> *mut c_void;
553pub fn mpsgraph_graph_arithmetic_binary(
555 graph_handle: *mut c_void,
556 op: u32,
557 primary_handle: *mut c_void,
558 secondary_handle: *mut c_void,
559 name: *const c_char,
560 ) -> *mut c_void;
561pub fn mpsgraph_graph_select(
563 graph_handle: *mut c_void,
564 predicate_handle: *mut c_void,
565 true_handle: *mut c_void,
566 false_handle: *mut c_void,
567 name: *const c_char,
568 ) -> *mut c_void;
569pub fn mpsgraph_graph_relu_gradient(
571 graph_handle: *mut c_void,
572 gradient_handle: *mut c_void,
573 source_handle: *mut c_void,
574 name: *const c_char,
575 ) -> *mut c_void;
576pub fn mpsgraph_graph_sigmoid_gradient(
578 graph_handle: *mut c_void,
579 gradient_handle: *mut c_void,
580 source_handle: *mut c_void,
581 name: *const c_char,
582 ) -> *mut c_void;
583pub fn mpsgraph_graph_softmax_gradient(
585 graph_handle: *mut c_void,
586 gradient_handle: *mut c_void,
587 source_handle: *mut c_void,
588 axis: isize,
589 name: *const c_char,
590 ) -> *mut c_void;
591pub fn mpsgraph_graph_leaky_relu_scalar(
593 graph_handle: *mut c_void,
594 tensor_handle: *mut c_void,
595 alpha: f64,
596 name: *const c_char,
597 ) -> *mut c_void;
598pub fn mpsgraph_graph_leaky_relu_tensor(
600 graph_handle: *mut c_void,
601 tensor_handle: *mut c_void,
602 alpha_tensor_handle: *mut c_void,
603 name: *const c_char,
604 ) -> *mut c_void;
605pub fn mpsgraph_graph_leaky_relu_gradient(
607 graph_handle: *mut c_void,
608 gradient_handle: *mut c_void,
609 source_handle: *mut c_void,
610 alpha_tensor_handle: *mut c_void,
611 name: *const c_char,
612 ) -> *mut c_void;
613pub fn mpsgraph_graph_reduction_axis(
615 graph_handle: *mut c_void,
616 op: u32,
617 tensor_handle: *mut c_void,
618 axis: isize,
619 name: *const c_char,
620 ) -> *mut c_void;
621pub fn mpsgraph_graph_reduction_axes(
623 graph_handle: *mut c_void,
624 op: u32,
625 tensor_handle: *mut c_void,
626 axes: *const usize,
627 axes_len: usize,
628 name: *const c_char,
629 ) -> *mut c_void;
630pub fn mpsgraph_graph_concat_pair(
632 graph_handle: *mut c_void,
633 first_handle: *mut c_void,
634 second_handle: *mut c_void,
635 dimension: isize,
636 name: *const c_char,
637 ) -> *mut c_void;
638pub fn mpsgraph_graph_concat_tensors(
640 graph_handle: *mut c_void,
641 tensor_handles: *const *mut c_void,
642 tensor_count: usize,
643 dimension: isize,
644 interleave: bool,
645 name: *const c_char,
646 ) -> *mut c_void;
647pub fn mpsgraph_graph_split_sizes(
649 graph_handle: *mut c_void,
650 tensor_handle: *mut c_void,
651 split_sizes: *const usize,
652 split_count: usize,
653 axis: isize,
654 name: *const c_char,
655 ) -> *mut c_void;
656pub fn mpsgraph_graph_split_sizes_tensor(
658 graph_handle: *mut c_void,
659 tensor_handle: *mut c_void,
660 split_sizes_tensor_handle: *mut c_void,
661 axis: isize,
662 name: *const c_char,
663 ) -> *mut c_void;
664pub fn mpsgraph_graph_split_num(
666 graph_handle: *mut c_void,
667 tensor_handle: *mut c_void,
668 num_splits: usize,
669 axis: isize,
670 name: *const c_char,
671 ) -> *mut c_void;
672pub fn mpsgraph_graph_stack(
674 graph_handle: *mut c_void,
675 tensor_handles: *const *mut c_void,
676 tensor_count: usize,
677 axis: isize,
678 name: *const c_char,
679 ) -> *mut c_void;
680pub fn mpsgraph_graph_pad(
682 graph_handle: *mut c_void,
683 tensor_handle: *mut c_void,
684 padding_mode: isize,
685 left_padding: *const isize,
686 left_padding_len: usize,
687 right_padding: *const isize,
688 right_padding_len: usize,
689 constant_value: f64,
690 name: *const c_char,
691 ) -> *mut c_void;
692pub fn mpsgraph_graph_top_k(
694 graph_handle: *mut c_void,
695 source_handle: *mut c_void,
696 k: usize,
697 name: *const c_char,
698 ) -> *mut c_void;
699pub fn mpsgraph_graph_top_k_tensor(
701 graph_handle: *mut c_void,
702 source_handle: *mut c_void,
703 k_tensor_handle: *mut c_void,
704 name: *const c_char,
705 ) -> *mut c_void;
706pub fn mpsgraph_tensor_array_box_new(handles: *const *mut c_void, count: usize) -> *mut c_void;
708pub fn mpsgraph_compilation_descriptor_set_callable(
710 handle: *mut c_void,
711 symbol_name: *const c_char,
712 executable_handle: *mut c_void,
713 ) -> bool;
714pub fn mpsgraph_graph_call_symbol(
716 graph_handle: *mut c_void,
717 symbol_name: *const c_char,
718 input_handles: *const *mut c_void,
719 input_count: usize,
720 output_type_handles: *const *mut c_void,
721 output_type_count: usize,
722 name: *const c_char,
723 ) -> *mut c_void;
724pub fn mpsgraph_graph_gather_nd(
726 graph_handle: *mut c_void,
727 updates_tensor_handle: *mut c_void,
728 indices_tensor_handle: *mut c_void,
729 batch_dimensions: usize,
730 name: *const c_char,
731 ) -> *mut c_void;
732pub fn mpsgraph_graph_gather(
734 graph_handle: *mut c_void,
735 updates_tensor_handle: *mut c_void,
736 indices_tensor_handle: *mut c_void,
737 axis: usize,
738 batch_dimensions: usize,
739 name: *const c_char,
740 ) -> *mut c_void;
741pub fn mpsgraph_graph_gather_along_axis(
743 graph_handle: *mut c_void,
744 axis: isize,
745 updates_tensor_handle: *mut c_void,
746 indices_tensor_handle: *mut c_void,
747 name: *const c_char,
748 ) -> *mut c_void;
749pub fn mpsgraph_graph_gather_along_axis_tensor(
751 graph_handle: *mut c_void,
752 axis_tensor_handle: *mut c_void,
753 updates_tensor_handle: *mut c_void,
754 indices_tensor_handle: *mut c_void,
755 name: *const c_char,
756 ) -> *mut c_void;
757pub fn mpsgraph_random_op_descriptor_new(distribution: u64, data_type: u32) -> *mut c_void;
759pub fn mpsgraph_random_op_descriptor_distribution(handle: *mut c_void) -> u64;
761pub fn mpsgraph_random_op_descriptor_set_distribution(
763 handle: *mut c_void,
764 raw_value: u64,
765 ) -> bool;
766pub fn mpsgraph_random_op_descriptor_data_type(handle: *mut c_void) -> u32;
768pub fn mpsgraph_random_op_descriptor_set_data_type(handle: *mut c_void, raw_value: u32)
770 -> bool;
771pub fn mpsgraph_random_op_descriptor_min(handle: *mut c_void) -> f32;
773pub fn mpsgraph_random_op_descriptor_set_min(handle: *mut c_void, value: f32) -> bool;
775pub fn mpsgraph_random_op_descriptor_max(handle: *mut c_void) -> f32;
777pub fn mpsgraph_random_op_descriptor_set_max(handle: *mut c_void, value: f32) -> bool;
779pub fn mpsgraph_random_op_descriptor_min_integer(handle: *mut c_void) -> isize;
781pub fn mpsgraph_random_op_descriptor_set_min_integer(handle: *mut c_void, value: isize)
783 -> bool;
784pub fn mpsgraph_random_op_descriptor_max_integer(handle: *mut c_void) -> isize;
786pub fn mpsgraph_random_op_descriptor_set_max_integer(handle: *mut c_void, value: isize)
788 -> bool;
789pub fn mpsgraph_random_op_descriptor_mean(handle: *mut c_void) -> f32;
791pub fn mpsgraph_random_op_descriptor_set_mean(handle: *mut c_void, value: f32) -> bool;
793pub fn mpsgraph_random_op_descriptor_standard_deviation(handle: *mut c_void) -> f32;
795pub fn mpsgraph_random_op_descriptor_set_standard_deviation(
797 handle: *mut c_void,
798 value: f32,
799 ) -> bool;
800pub fn mpsgraph_random_op_descriptor_sampling_method(handle: *mut c_void) -> u64;
802pub fn mpsgraph_random_op_descriptor_set_sampling_method(
804 handle: *mut c_void,
805 raw_value: u64,
806 ) -> bool;
807pub fn mpsgraph_graph_random_philox_state_seed(
809 graph_handle: *mut c_void,
810 seed: usize,
811 name: *const c_char,
812 ) -> *mut c_void;
813pub fn mpsgraph_graph_random_philox_state_counter(
815 graph_handle: *mut c_void,
816 counter_low: usize,
817 counter_high: usize,
818 key: usize,
819 name: *const c_char,
820 ) -> *mut c_void;
821pub fn mpsgraph_graph_random_tensor(
823 graph_handle: *mut c_void,
824 shape: *const usize,
825 shape_len: usize,
826 descriptor_handle: *mut c_void,
827 name: *const c_char,
828 ) -> *mut c_void;
829pub fn mpsgraph_graph_random_tensor_shape_tensor(
831 graph_handle: *mut c_void,
832 shape_tensor_handle: *mut c_void,
833 descriptor_handle: *mut c_void,
834 name: *const c_char,
835 ) -> *mut c_void;
836pub fn mpsgraph_graph_random_tensor_seed(
838 graph_handle: *mut c_void,
839 shape: *const usize,
840 shape_len: usize,
841 descriptor_handle: *mut c_void,
842 seed: usize,
843 name: *const c_char,
844 ) -> *mut c_void;
845pub fn mpsgraph_graph_random_tensor_shape_tensor_seed(
847 graph_handle: *mut c_void,
848 shape_tensor_handle: *mut c_void,
849 descriptor_handle: *mut c_void,
850 seed: usize,
851 name: *const c_char,
852 ) -> *mut c_void;
853pub fn mpsgraph_graph_random_tensor_state(
855 graph_handle: *mut c_void,
856 shape: *const usize,
857 shape_len: usize,
858 descriptor_handle: *mut c_void,
859 state_handle: *mut c_void,
860 name: *const c_char,
861 ) -> *mut c_void;
862pub fn mpsgraph_graph_random_tensor_shape_tensor_state(
864 graph_handle: *mut c_void,
865 shape_tensor_handle: *mut c_void,
866 descriptor_handle: *mut c_void,
867 state_handle: *mut c_void,
868 name: *const c_char,
869 ) -> *mut c_void;
870pub fn mpsgraph_graph_dropout(
872 graph_handle: *mut c_void,
873 tensor_handle: *mut c_void,
874 rate: f64,
875 name: *const c_char,
876 ) -> *mut c_void;
877pub fn mpsgraph_graph_dropout_tensor(
879 graph_handle: *mut c_void,
880 tensor_handle: *mut c_void,
881 rate_tensor_handle: *mut c_void,
882 name: *const c_char,
883 ) -> *mut c_void;
884pub fn mpsgraph_single_gate_rnn_descriptor_new() -> *mut c_void;
886pub fn mpsgraph_single_gate_rnn_descriptor_reverse(handle: *mut c_void) -> bool;
888pub fn mpsgraph_single_gate_rnn_descriptor_set_reverse(
890 handle: *mut c_void,
891 value: bool,
892 ) -> bool;
893pub fn mpsgraph_single_gate_rnn_descriptor_bidirectional(handle: *mut c_void) -> bool;
895pub fn mpsgraph_single_gate_rnn_descriptor_set_bidirectional(
897 handle: *mut c_void,
898 value: bool,
899 ) -> bool;
900pub fn mpsgraph_single_gate_rnn_descriptor_training(handle: *mut c_void) -> bool;
902pub fn mpsgraph_single_gate_rnn_descriptor_set_training(
904 handle: *mut c_void,
905 value: bool,
906 ) -> bool;
907pub fn mpsgraph_single_gate_rnn_descriptor_activation(handle: *mut c_void) -> usize;
909pub fn mpsgraph_single_gate_rnn_descriptor_set_activation(
911 handle: *mut c_void,
912 value: usize,
913 ) -> bool;
914pub fn mpsgraph_lstm_descriptor_new() -> *mut c_void;
916pub fn mpsgraph_lstm_descriptor_reverse(handle: *mut c_void) -> bool;
918pub fn mpsgraph_lstm_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
920pub fn mpsgraph_lstm_descriptor_bidirectional(handle: *mut c_void) -> bool;
922pub fn mpsgraph_lstm_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
924pub fn mpsgraph_lstm_descriptor_produce_cell(handle: *mut c_void) -> bool;
926pub fn mpsgraph_lstm_descriptor_set_produce_cell(handle: *mut c_void, value: bool) -> bool;
928pub fn mpsgraph_lstm_descriptor_training(handle: *mut c_void) -> bool;
930pub fn mpsgraph_lstm_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
932pub fn mpsgraph_lstm_descriptor_forget_gate_last(handle: *mut c_void) -> bool;
934pub fn mpsgraph_lstm_descriptor_set_forget_gate_last(handle: *mut c_void, value: bool) -> bool;
936pub fn mpsgraph_lstm_descriptor_input_gate_activation(handle: *mut c_void) -> usize;
938pub fn mpsgraph_lstm_descriptor_set_input_gate_activation(
940 handle: *mut c_void,
941 value: usize,
942 ) -> bool;
943pub fn mpsgraph_lstm_descriptor_forget_gate_activation(handle: *mut c_void) -> usize;
945pub fn mpsgraph_lstm_descriptor_set_forget_gate_activation(
947 handle: *mut c_void,
948 value: usize,
949 ) -> bool;
950pub fn mpsgraph_lstm_descriptor_cell_gate_activation(handle: *mut c_void) -> usize;
952pub fn mpsgraph_lstm_descriptor_set_cell_gate_activation(
954 handle: *mut c_void,
955 value: usize,
956 ) -> bool;
957pub fn mpsgraph_lstm_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
959pub fn mpsgraph_lstm_descriptor_set_output_gate_activation(
961 handle: *mut c_void,
962 value: usize,
963 ) -> bool;
964pub fn mpsgraph_lstm_descriptor_activation(handle: *mut c_void) -> usize;
966pub fn mpsgraph_lstm_descriptor_set_activation(handle: *mut c_void, value: usize) -> bool;
968pub fn mpsgraph_gru_descriptor_new() -> *mut c_void;
970pub fn mpsgraph_gru_descriptor_reverse(handle: *mut c_void) -> bool;
972pub fn mpsgraph_gru_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
974pub fn mpsgraph_gru_descriptor_bidirectional(handle: *mut c_void) -> bool;
976pub fn mpsgraph_gru_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
978pub fn mpsgraph_gru_descriptor_training(handle: *mut c_void) -> bool;
980pub fn mpsgraph_gru_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
982pub fn mpsgraph_gru_descriptor_reset_gate_first(handle: *mut c_void) -> bool;
984pub fn mpsgraph_gru_descriptor_set_reset_gate_first(handle: *mut c_void, value: bool) -> bool;
986pub fn mpsgraph_gru_descriptor_reset_after(handle: *mut c_void) -> bool;
988pub fn mpsgraph_gru_descriptor_set_reset_after(handle: *mut c_void, value: bool) -> bool;
990pub fn mpsgraph_gru_descriptor_flip_z(handle: *mut c_void) -> bool;
992pub fn mpsgraph_gru_descriptor_set_flip_z(handle: *mut c_void, value: bool) -> bool;
994pub fn mpsgraph_gru_descriptor_update_gate_activation(handle: *mut c_void) -> usize;
996pub fn mpsgraph_gru_descriptor_set_update_gate_activation(
998 handle: *mut c_void,
999 value: usize,
1000 ) -> bool;
1001pub fn mpsgraph_gru_descriptor_reset_gate_activation(handle: *mut c_void) -> usize;
1003pub fn mpsgraph_gru_descriptor_set_reset_gate_activation(
1005 handle: *mut c_void,
1006 value: usize,
1007 ) -> bool;
1008pub fn mpsgraph_gru_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
1010pub fn mpsgraph_gru_descriptor_set_output_gate_activation(
1012 handle: *mut c_void,
1013 value: usize,
1014 ) -> bool;
1015pub fn mpsgraph_graph_single_gate_rnn(
1017 graph_handle: *mut c_void,
1018 source_handle: *mut c_void,
1019 recurrent_weight_handle: *mut c_void,
1020 input_weight_handle: *mut c_void,
1021 bias_handle: *mut c_void,
1022 init_state_handle: *mut c_void,
1023 mask_handle: *mut c_void,
1024 descriptor_handle: *mut c_void,
1025 name: *const c_char,
1026 ) -> *mut c_void;
1027pub fn mpsgraph_graph_lstm(
1029 graph_handle: *mut c_void,
1030 source_handle: *mut c_void,
1031 recurrent_weight_handle: *mut c_void,
1032 input_weight_handle: *mut c_void,
1033 bias_handle: *mut c_void,
1034 init_state_handle: *mut c_void,
1035 init_cell_handle: *mut c_void,
1036 mask_handle: *mut c_void,
1037 peephole_handle: *mut c_void,
1038 descriptor_handle: *mut c_void,
1039 name: *const c_char,
1040 ) -> *mut c_void;
1041pub fn mpsgraph_graph_gru(
1043 graph_handle: *mut c_void,
1044 source_handle: *mut c_void,
1045 recurrent_weight_handle: *mut c_void,
1046 input_weight_handle: *mut c_void,
1047 bias_handle: *mut c_void,
1048 init_state_handle: *mut c_void,
1049 mask_handle: *mut c_void,
1050 secondary_bias_handle: *mut c_void,
1051 descriptor_handle: *mut c_void,
1052 name: *const c_char,
1053 ) -> *mut c_void;
1054pub fn mpsgraph_graph_control_dependency(
1056 graph_handle: *mut c_void,
1057 operation_handles: *const *mut c_void,
1058 operation_count: usize,
1059 dependent_callback: Option<TensorArrayCallback>,
1060 dependent_context: *mut c_void,
1061 name: *const c_char,
1062 ) -> *mut c_void;
1063pub fn mpsgraph_graph_if_then_else(
1065 graph_handle: *mut c_void,
1066 predicate_handle: *mut c_void,
1067 then_callback: Option<TensorArrayCallback>,
1068 then_context: *mut c_void,
1069 else_callback: Option<TensorArrayCallback>,
1070 else_context: *mut c_void,
1071 name: *const c_char,
1072 ) -> *mut c_void;
1073pub fn mpsgraph_graph_while_loop(
1075 graph_handle: *mut c_void,
1076 input_handles: *const *mut c_void,
1077 input_count: usize,
1078 before_callback: Option<WhileBeforeCallback>,
1079 before_context: *mut c_void,
1080 after_callback: Option<TensorArrayInputCallback>,
1081 after_context: *mut c_void,
1082 name: *const c_char,
1083 ) -> *mut c_void;
1084pub fn mpsgraph_graph_for_loop(
1086 graph_handle: *mut c_void,
1087 lower_bound_handle: *mut c_void,
1088 upper_bound_handle: *mut c_void,
1089 step_handle: *mut c_void,
1090 argument_handles: *const *mut c_void,
1091 argument_count: usize,
1092 body_callback: Option<ForBodyCallback>,
1093 body_context: *mut c_void,
1094 name: *const c_char,
1095 ) -> *mut c_void;
1096pub fn mpsgraph_graph_for_loop_iterations(
1098 graph_handle: *mut c_void,
1099 number_of_iterations_handle: *mut c_void,
1100 argument_handles: *const *mut c_void,
1101 argument_count: usize,
1102 body_callback: Option<ForBodyCallback>,
1103 body_context: *mut c_void,
1104 name: *const c_char,
1105 ) -> *mut c_void;
1106}