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_data_type(handle: *mut c_void) -> u32;
47pub fn mpsgraph_tensor_data_shape_len(handle: *mut c_void) -> usize;
49pub fn mpsgraph_tensor_data_copy_shape(handle: *mut c_void, out_shape: *mut usize);
51pub fn mpsgraph_tensor_data_read_bytes(
53 handle: *mut c_void,
54 dst: *mut c_void,
55 dst_len: usize,
56 ) -> bool;
57pub fn mpsgraph_tensor_data_device(handle: *mut c_void) -> *mut c_void;
59
60pub fn mpsgraph_graph_new() -> *mut c_void;
62pub fn mpsgraph_graph_placeholder(
64 graph_handle: *mut c_void,
65 shape: *const usize,
66 shape_len: usize,
67 data_type: u32,
68 name: *const c_char,
69 ) -> *mut c_void;
70pub fn mpsgraph_graph_constant_data(
72 graph_handle: *mut c_void,
73 bytes: *const c_void,
74 byte_len: usize,
75 shape: *const usize,
76 shape_len: usize,
77 data_type: u32,
78 ) -> *mut c_void;
79pub fn mpsgraph_graph_constant_scalar(
81 graph_handle: *mut c_void,
82 scalar: f64,
83 data_type: u32,
84 ) -> *mut c_void;
85pub fn mpsgraph_graph_constant_scalar_shaped(
87 graph_handle: *mut c_void,
88 scalar: f64,
89 shape: *const usize,
90 shape_len: usize,
91 data_type: u32,
92 ) -> *mut c_void;
93
94pub fn mpsgraph_graph_addition(
96 graph_handle: *mut c_void,
97 primary_tensor: *mut c_void,
98 secondary_tensor: *mut c_void,
99 name: *const c_char,
100 ) -> *mut c_void;
101pub fn mpsgraph_graph_subtraction(
103 graph_handle: *mut c_void,
104 primary_tensor: *mut c_void,
105 secondary_tensor: *mut c_void,
106 name: *const c_char,
107 ) -> *mut c_void;
108pub fn mpsgraph_graph_multiplication(
110 graph_handle: *mut c_void,
111 primary_tensor: *mut c_void,
112 secondary_tensor: *mut c_void,
113 name: *const c_char,
114 ) -> *mut c_void;
115pub fn mpsgraph_graph_division(
117 graph_handle: *mut c_void,
118 primary_tensor: *mut c_void,
119 secondary_tensor: *mut c_void,
120 name: *const c_char,
121 ) -> *mut c_void;
122pub fn mpsgraph_graph_matrix_multiplication(
124 graph_handle: *mut c_void,
125 primary_tensor: *mut c_void,
126 secondary_tensor: *mut c_void,
127 name: *const c_char,
128 ) -> *mut c_void;
129pub fn mpsgraph_graph_relu(
131 graph_handle: *mut c_void,
132 tensor: *mut c_void,
133 name: *const c_char,
134 ) -> *mut c_void;
135pub fn mpsgraph_graph_sigmoid(
137 graph_handle: *mut c_void,
138 tensor: *mut c_void,
139 name: *const c_char,
140 ) -> *mut c_void;
141pub fn mpsgraph_graph_softmax(
143 graph_handle: *mut c_void,
144 tensor: *mut c_void,
145 axis: isize,
146 name: *const c_char,
147 ) -> *mut c_void;
148pub fn mpsgraph_graph_reshape(
150 graph_handle: *mut c_void,
151 tensor: *mut c_void,
152 shape: *const usize,
153 shape_len: usize,
154 name: *const c_char,
155 ) -> *mut c_void;
156pub fn mpsgraph_graph_transpose(
158 graph_handle: *mut c_void,
159 tensor: *mut c_void,
160 permutation: *const usize,
161 permutation_len: usize,
162 name: *const c_char,
163 ) -> *mut c_void;
164pub fn mpsgraph_graph_slice(
166 graph_handle: *mut c_void,
167 tensor: *mut c_void,
168 dimension: usize,
169 start: isize,
170 length: isize,
171 name: *const c_char,
172 ) -> *mut c_void;
173pub fn mpsgraph_graph_broadcast(
175 graph_handle: *mut c_void,
176 tensor: *mut c_void,
177 shape: *const usize,
178 shape_len: usize,
179 name: *const c_char,
180 ) -> *mut c_void;
181pub fn mpsgraph_graph_reduction_sum(
183 graph_handle: *mut c_void,
184 tensor: *mut c_void,
185 axes: *const usize,
186 axes_len: usize,
187 name: *const c_char,
188 ) -> *mut c_void;
189pub fn mpsgraph_graph_reduction_maximum(
191 graph_handle: *mut c_void,
192 tensor: *mut c_void,
193 axes: *const usize,
194 axes_len: usize,
195 name: *const c_char,
196 ) -> *mut c_void;
197pub fn mpsgraph_graph_reduction_minimum(
199 graph_handle: *mut c_void,
200 tensor: *mut c_void,
201 axes: *const usize,
202 axes_len: usize,
203 name: *const c_char,
204 ) -> *mut c_void;
205pub fn mpsgraph_graph_mean(
207 graph_handle: *mut c_void,
208 tensor: *mut c_void,
209 axes: *const usize,
210 axes_len: usize,
211 name: *const c_char,
212 ) -> *mut c_void;
213
214pub fn mpsgraph_convolution2d_descriptor_new(
216 stride_in_x: usize,
217 stride_in_y: usize,
218 dilation_rate_in_x: usize,
219 dilation_rate_in_y: usize,
220 groups: usize,
221 padding_left: usize,
222 padding_right: usize,
223 padding_top: usize,
224 padding_bottom: usize,
225 padding_style: usize,
226 data_layout: usize,
227 weights_layout: usize,
228 ) -> *mut c_void;
229pub fn mpsgraph_pooling2d_descriptor_new(
231 kernel_width: usize,
232 kernel_height: usize,
233 stride_in_x: usize,
234 stride_in_y: usize,
235 dilation_rate_in_x: usize,
236 dilation_rate_in_y: usize,
237 padding_left: usize,
238 padding_right: usize,
239 padding_top: usize,
240 padding_bottom: usize,
241 padding_style: usize,
242 data_layout: usize,
243 ) -> *mut c_void;
244pub fn mpsgraph_graph_convolution2d(
246 graph_handle: *mut c_void,
247 source_tensor: *mut c_void,
248 weights_tensor: *mut c_void,
249 descriptor_handle: *mut c_void,
250 name: *const c_char,
251 ) -> *mut c_void;
252pub fn mpsgraph_graph_max_pooling2d(
254 graph_handle: *mut c_void,
255 source_tensor: *mut c_void,
256 descriptor_handle: *mut c_void,
257 name: *const c_char,
258 ) -> *mut c_void;
259pub fn mpsgraph_graph_normalize(
261 graph_handle: *mut c_void,
262 tensor: *mut c_void,
263 mean_tensor: *mut c_void,
264 variance_tensor: *mut c_void,
265 gamma_tensor: *mut c_void,
266 beta_tensor: *mut c_void,
267 epsilon: f32,
268 name: *const c_char,
269 ) -> *mut c_void;
270
271pub fn mpsgraph_graph_run(
273 graph_handle: *mut c_void,
274 feed_tensors: *const *mut c_void,
275 feed_data: *const *mut c_void,
276 feed_count: usize,
277 target_tensors: *const *mut c_void,
278 target_count: usize,
279 out_results: *mut *mut c_void,
280 ) -> bool;
281pub fn mpsgraph_graph_run_with_command_queue(
283 graph_handle: *mut c_void,
284 command_queue_handle: *mut c_void,
285 feed_tensors: *const *mut c_void,
286 feed_data: *const *mut c_void,
287 feed_count: usize,
288 target_tensors: *const *mut c_void,
289 target_count: usize,
290 out_results: *mut *mut c_void,
291 ) -> bool;
292pub fn mpsgraph_graph_compile(
294 graph_handle: *mut c_void,
295 device_handle: *mut c_void,
296 feed_tensors: *const *mut c_void,
297 feed_count: usize,
298 flat_shapes: *const usize,
299 shape_lengths: *const usize,
300 data_types: *const u32,
301 target_tensors: *const *mut c_void,
302 target_count: usize,
303 ) -> *mut c_void;
304pub fn mpsgraph_executable_run(
306 executable_handle: *mut c_void,
307 command_queue_handle: *mut c_void,
308 input_data: *const *mut c_void,
309 input_count: usize,
310 output_count: usize,
311 out_results: *mut *mut c_void,
312 ) -> bool;
313
314pub fn mpsgraph_tensor_array_box_len(handle: *mut c_void) -> usize;
316pub fn mpsgraph_tensor_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
318pub fn mpsgraph_tensor_data_array_box_len(handle: *mut c_void) -> usize;
320pub fn mpsgraph_tensor_data_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
322pub fn mpsgraph_shaped_type_array_box_len(handle: *mut c_void) -> usize;
324pub fn mpsgraph_shaped_type_array_box_get(handle: *mut c_void, index: usize) -> *mut c_void;
326
327pub fn mpsgraph_device_new_with_metal_device(metal_device_handle: *mut c_void) -> *mut c_void;
329pub fn mpsgraph_device_type(handle: *mut c_void) -> u32;
331
332pub fn mpsgraph_shaped_type_new(
334 shape: *const isize,
335 shape_len: usize,
336 data_type: u32,
337 ) -> *mut c_void;
338pub fn mpsgraph_shaped_type_has_shape(handle: *mut c_void) -> bool;
340pub fn mpsgraph_shaped_type_shape_len(handle: *mut c_void) -> usize;
342pub fn mpsgraph_shaped_type_copy_shape(handle: *mut c_void, out_shape: *mut isize);
344pub fn mpsgraph_shaped_type_data_type(handle: *mut c_void) -> u32;
346pub fn mpsgraph_shaped_type_set_shape(
348 handle: *mut c_void,
349 shape: *const isize,
350 shape_len: usize,
351 ) -> bool;
352pub fn mpsgraph_shaped_type_set_data_type(handle: *mut c_void, data_type: u32) -> bool;
354pub fn mpsgraph_shaped_type_is_equal(handle: *mut c_void, other_handle: *mut c_void) -> bool;
356
357pub fn mpsgraph_tensor_has_shape(handle: *mut c_void) -> bool;
359pub fn mpsgraph_tensor_shape_len(handle: *mut c_void) -> usize;
361pub fn mpsgraph_tensor_copy_shape(handle: *mut c_void, out_shape: *mut isize);
363pub fn mpsgraph_tensor_data_type(handle: *mut c_void) -> u32;
365pub fn mpsgraph_tensor_operation(handle: *mut c_void) -> *mut c_void;
367
368pub fn mpsgraph_graph_options(handle: *mut c_void) -> u64;
370pub fn mpsgraph_graph_set_options(handle: *mut c_void, raw_value: u64) -> bool;
372pub fn mpsgraph_graph_placeholder_tensors(handle: *mut c_void) -> *mut c_void;
374
375pub fn mpsgraph_compilation_descriptor_new() -> *mut c_void;
377pub fn mpsgraph_compilation_descriptor_disable_type_inference(handle: *mut c_void) -> bool;
379pub fn mpsgraph_compilation_descriptor_optimization_level(handle: *mut c_void) -> u64;
381pub fn mpsgraph_compilation_descriptor_set_optimization_level(
383 handle: *mut c_void,
384 raw_value: u64,
385 ) -> bool;
386pub fn mpsgraph_compilation_descriptor_wait_for_completion(handle: *mut c_void) -> bool;
388pub fn mpsgraph_compilation_descriptor_set_wait_for_completion(
390 handle: *mut c_void,
391 value: bool,
392 ) -> bool;
393pub fn mpsgraph_compilation_descriptor_optimization_profile(handle: *mut c_void) -> u64;
395pub fn mpsgraph_compilation_descriptor_set_optimization_profile(
397 handle: *mut c_void,
398 raw_value: u64,
399 ) -> bool;
400pub fn mpsgraph_compilation_descriptor_reduced_precision_fast_math(
402 handle: *mut c_void,
403 ) -> usize;
404pub fn mpsgraph_compilation_descriptor_set_reduced_precision_fast_math(
406 handle: *mut c_void,
407 raw_value: usize,
408 ) -> bool;
409
410pub fn mpsgraph_execution_descriptor_new() -> *mut c_void;
412pub fn mpsgraph_execution_descriptor_wait_until_completed(handle: *mut c_void) -> bool;
414pub fn mpsgraph_execution_descriptor_set_wait_until_completed(
416 handle: *mut c_void,
417 value: bool,
418 ) -> bool;
419pub fn mpsgraph_execution_descriptor_compilation_descriptor(handle: *mut c_void)
421 -> *mut c_void;
422pub fn mpsgraph_execution_descriptor_set_compilation_descriptor(
424 handle: *mut c_void,
425 compilation_descriptor_handle: *mut c_void,
426 ) -> bool;
427
428pub fn mpsgraph_executable_execution_descriptor_new() -> *mut c_void;
430pub fn mpsgraph_executable_execution_descriptor_wait_until_completed(
432 handle: *mut c_void,
433 ) -> bool;
434pub fn mpsgraph_executable_execution_descriptor_set_wait_until_completed(
436 handle: *mut c_void,
437 value: bool,
438 ) -> bool;
439
440pub fn mpsgraph_executable_serialization_descriptor_new() -> *mut c_void;
442pub fn mpsgraph_executable_serialization_descriptor_append(handle: *mut c_void) -> bool;
444pub fn mpsgraph_executable_serialization_descriptor_set_append(
446 handle: *mut c_void,
447 value: bool,
448 ) -> bool;
449pub fn mpsgraph_executable_serialization_descriptor_deployment_platform(
451 handle: *mut c_void,
452 ) -> u64;
453pub fn mpsgraph_executable_serialization_descriptor_set_deployment_platform(
455 handle: *mut c_void,
456 raw_value: u64,
457 ) -> bool;
458pub fn mpsgraph_executable_serialization_descriptor_minimum_deployment_target_len(
460 handle: *mut c_void,
461 ) -> usize;
462pub fn mpsgraph_executable_serialization_descriptor_copy_minimum_deployment_target(
464 handle: *mut c_void,
465 out_bytes: *mut u8,
466 out_len: usize,
467 ) -> bool;
468pub fn mpsgraph_executable_serialization_descriptor_set_minimum_deployment_target(
470 handle: *mut c_void,
471 value: *const c_char,
472 ) -> bool;
473
474pub fn mpsgraph_graph_compile_with_descriptor(
476 graph_handle: *mut c_void,
477 device_handle: *mut c_void,
478 feed_tensors: *const *mut c_void,
479 feed_count: usize,
480 flat_shapes: *const usize,
481 shape_lengths: *const usize,
482 data_types: *const u32,
483 target_tensors: *const *mut c_void,
484 target_count: usize,
485 compilation_descriptor_handle: *mut c_void,
486 ) -> *mut c_void;
487
488pub fn mpsgraph_executable_options(handle: *mut c_void) -> u64;
490pub fn mpsgraph_executable_set_options(handle: *mut c_void, raw_value: u64) -> bool;
492pub fn mpsgraph_executable_feed_tensors(handle: *mut c_void) -> *mut c_void;
494pub fn mpsgraph_executable_target_tensors(handle: *mut c_void) -> *mut c_void;
496pub fn mpsgraph_executable_specialize(
498 handle: *mut c_void,
499 device_handle: *mut c_void,
500 input_type_handles: *const *mut c_void,
501 input_type_count: usize,
502 compilation_descriptor_handle: *mut c_void,
503 ) -> bool;
504pub fn mpsgraph_executable_get_output_types(
506 handle: *mut c_void,
507 device_handle: *mut c_void,
508 input_type_handles: *const *mut c_void,
509 input_type_count: usize,
510 compilation_descriptor_handle: *mut c_void,
511 ) -> *mut c_void;
512pub fn mpsgraph_executable_run_with_descriptor(
514 executable_handle: *mut c_void,
515 command_queue_handle: *mut c_void,
516 input_handles: *const *mut c_void,
517 input_count: usize,
518 result_handles: *const *mut c_void,
519 result_count: usize,
520 execution_descriptor_handle: *mut c_void,
521 ) -> *mut c_void;
522pub fn mpsgraph_executable_run_async_with_descriptor(
524 executable_handle: *mut c_void,
525 command_queue_handle: *mut c_void,
526 input_handles: *const *mut c_void,
527 input_count: usize,
528 result_handles: *const *mut c_void,
529 result_count: usize,
530 execution_descriptor_handle: *mut c_void,
531 ) -> *mut c_void;
532pub fn mpsgraph_executable_serialize_package(
534 handle: *mut c_void,
535 path: *const c_char,
536 descriptor_handle: *mut c_void,
537 ) -> bool;
538pub fn mpsgraph_executable_new_with_package(
540 path: *const c_char,
541 compilation_descriptor_handle: *mut c_void,
542 ) -> *mut c_void;
543
544pub fn mpsgraph_graph_arithmetic_unary(
546 graph_handle: *mut c_void,
547 op: u32,
548 tensor_handle: *mut c_void,
549 name: *const c_char,
550 ) -> *mut c_void;
551pub fn mpsgraph_graph_arithmetic_binary(
553 graph_handle: *mut c_void,
554 op: u32,
555 primary_handle: *mut c_void,
556 secondary_handle: *mut c_void,
557 name: *const c_char,
558 ) -> *mut c_void;
559pub fn mpsgraph_graph_select(
561 graph_handle: *mut c_void,
562 predicate_handle: *mut c_void,
563 true_handle: *mut c_void,
564 false_handle: *mut c_void,
565 name: *const c_char,
566 ) -> *mut c_void;
567pub fn mpsgraph_graph_relu_gradient(
569 graph_handle: *mut c_void,
570 gradient_handle: *mut c_void,
571 source_handle: *mut c_void,
572 name: *const c_char,
573 ) -> *mut c_void;
574pub fn mpsgraph_graph_sigmoid_gradient(
576 graph_handle: *mut c_void,
577 gradient_handle: *mut c_void,
578 source_handle: *mut c_void,
579 name: *const c_char,
580 ) -> *mut c_void;
581pub fn mpsgraph_graph_softmax_gradient(
583 graph_handle: *mut c_void,
584 gradient_handle: *mut c_void,
585 source_handle: *mut c_void,
586 axis: isize,
587 name: *const c_char,
588 ) -> *mut c_void;
589pub fn mpsgraph_graph_leaky_relu_scalar(
591 graph_handle: *mut c_void,
592 tensor_handle: *mut c_void,
593 alpha: f64,
594 name: *const c_char,
595 ) -> *mut c_void;
596pub fn mpsgraph_graph_leaky_relu_tensor(
598 graph_handle: *mut c_void,
599 tensor_handle: *mut c_void,
600 alpha_tensor_handle: *mut c_void,
601 name: *const c_char,
602 ) -> *mut c_void;
603pub fn mpsgraph_graph_leaky_relu_gradient(
605 graph_handle: *mut c_void,
606 gradient_handle: *mut c_void,
607 source_handle: *mut c_void,
608 alpha_tensor_handle: *mut c_void,
609 name: *const c_char,
610 ) -> *mut c_void;
611pub fn mpsgraph_graph_reduction_axis(
613 graph_handle: *mut c_void,
614 op: u32,
615 tensor_handle: *mut c_void,
616 axis: isize,
617 name: *const c_char,
618 ) -> *mut c_void;
619pub fn mpsgraph_graph_reduction_axes(
621 graph_handle: *mut c_void,
622 op: u32,
623 tensor_handle: *mut c_void,
624 axes: *const usize,
625 axes_len: usize,
626 name: *const c_char,
627 ) -> *mut c_void;
628pub fn mpsgraph_graph_concat_pair(
630 graph_handle: *mut c_void,
631 first_handle: *mut c_void,
632 second_handle: *mut c_void,
633 dimension: isize,
634 name: *const c_char,
635 ) -> *mut c_void;
636pub fn mpsgraph_graph_concat_tensors(
638 graph_handle: *mut c_void,
639 tensor_handles: *const *mut c_void,
640 tensor_count: usize,
641 dimension: isize,
642 interleave: bool,
643 name: *const c_char,
644 ) -> *mut c_void;
645pub fn mpsgraph_graph_split_sizes(
647 graph_handle: *mut c_void,
648 tensor_handle: *mut c_void,
649 split_sizes: *const usize,
650 split_count: usize,
651 axis: isize,
652 name: *const c_char,
653 ) -> *mut c_void;
654pub fn mpsgraph_graph_split_sizes_tensor(
656 graph_handle: *mut c_void,
657 tensor_handle: *mut c_void,
658 split_sizes_tensor_handle: *mut c_void,
659 axis: isize,
660 name: *const c_char,
661 ) -> *mut c_void;
662pub fn mpsgraph_graph_split_num(
664 graph_handle: *mut c_void,
665 tensor_handle: *mut c_void,
666 num_splits: usize,
667 axis: isize,
668 name: *const c_char,
669 ) -> *mut c_void;
670pub fn mpsgraph_graph_stack(
672 graph_handle: *mut c_void,
673 tensor_handles: *const *mut c_void,
674 tensor_count: usize,
675 axis: isize,
676 name: *const c_char,
677 ) -> *mut c_void;
678pub fn mpsgraph_graph_pad(
680 graph_handle: *mut c_void,
681 tensor_handle: *mut c_void,
682 padding_mode: isize,
683 left_padding: *const isize,
684 left_padding_len: usize,
685 right_padding: *const isize,
686 right_padding_len: usize,
687 constant_value: f64,
688 name: *const c_char,
689 ) -> *mut c_void;
690pub fn mpsgraph_graph_top_k(
692 graph_handle: *mut c_void,
693 source_handle: *mut c_void,
694 k: usize,
695 name: *const c_char,
696 ) -> *mut c_void;
697pub fn mpsgraph_graph_top_k_tensor(
699 graph_handle: *mut c_void,
700 source_handle: *mut c_void,
701 k_tensor_handle: *mut c_void,
702 name: *const c_char,
703 ) -> *mut c_void;
704pub fn mpsgraph_tensor_array_box_new(handles: *const *mut c_void, count: usize) -> *mut c_void;
706pub fn mpsgraph_compilation_descriptor_set_callable(
708 handle: *mut c_void,
709 symbol_name: *const c_char,
710 executable_handle: *mut c_void,
711 ) -> bool;
712pub fn mpsgraph_graph_call_symbol(
714 graph_handle: *mut c_void,
715 symbol_name: *const c_char,
716 input_handles: *const *mut c_void,
717 input_count: usize,
718 output_type_handles: *const *mut c_void,
719 output_type_count: usize,
720 name: *const c_char,
721 ) -> *mut c_void;
722pub fn mpsgraph_graph_gather_nd(
724 graph_handle: *mut c_void,
725 updates_tensor_handle: *mut c_void,
726 indices_tensor_handle: *mut c_void,
727 batch_dimensions: usize,
728 name: *const c_char,
729 ) -> *mut c_void;
730pub fn mpsgraph_graph_gather(
732 graph_handle: *mut c_void,
733 updates_tensor_handle: *mut c_void,
734 indices_tensor_handle: *mut c_void,
735 axis: usize,
736 batch_dimensions: usize,
737 name: *const c_char,
738 ) -> *mut c_void;
739pub fn mpsgraph_graph_gather_along_axis(
741 graph_handle: *mut c_void,
742 axis: isize,
743 updates_tensor_handle: *mut c_void,
744 indices_tensor_handle: *mut c_void,
745 name: *const c_char,
746 ) -> *mut c_void;
747pub fn mpsgraph_graph_gather_along_axis_tensor(
749 graph_handle: *mut c_void,
750 axis_tensor_handle: *mut c_void,
751 updates_tensor_handle: *mut c_void,
752 indices_tensor_handle: *mut c_void,
753 name: *const c_char,
754 ) -> *mut c_void;
755pub fn mpsgraph_random_op_descriptor_new(distribution: u64, data_type: u32) -> *mut c_void;
757pub fn mpsgraph_random_op_descriptor_distribution(handle: *mut c_void) -> u64;
759pub fn mpsgraph_random_op_descriptor_set_distribution(
761 handle: *mut c_void,
762 raw_value: u64,
763 ) -> bool;
764pub fn mpsgraph_random_op_descriptor_data_type(handle: *mut c_void) -> u32;
766pub fn mpsgraph_random_op_descriptor_set_data_type(handle: *mut c_void, raw_value: u32)
768 -> bool;
769pub fn mpsgraph_random_op_descriptor_min(handle: *mut c_void) -> f32;
771pub fn mpsgraph_random_op_descriptor_set_min(handle: *mut c_void, value: f32) -> bool;
773pub fn mpsgraph_random_op_descriptor_max(handle: *mut c_void) -> f32;
775pub fn mpsgraph_random_op_descriptor_set_max(handle: *mut c_void, value: f32) -> bool;
777pub fn mpsgraph_random_op_descriptor_min_integer(handle: *mut c_void) -> isize;
779pub fn mpsgraph_random_op_descriptor_set_min_integer(handle: *mut c_void, value: isize)
781 -> bool;
782pub fn mpsgraph_random_op_descriptor_max_integer(handle: *mut c_void) -> isize;
784pub fn mpsgraph_random_op_descriptor_set_max_integer(handle: *mut c_void, value: isize)
786 -> bool;
787pub fn mpsgraph_random_op_descriptor_mean(handle: *mut c_void) -> f32;
789pub fn mpsgraph_random_op_descriptor_set_mean(handle: *mut c_void, value: f32) -> bool;
791pub fn mpsgraph_random_op_descriptor_standard_deviation(handle: *mut c_void) -> f32;
793pub fn mpsgraph_random_op_descriptor_set_standard_deviation(
795 handle: *mut c_void,
796 value: f32,
797 ) -> bool;
798pub fn mpsgraph_random_op_descriptor_sampling_method(handle: *mut c_void) -> u64;
800pub fn mpsgraph_random_op_descriptor_set_sampling_method(
802 handle: *mut c_void,
803 raw_value: u64,
804 ) -> bool;
805pub fn mpsgraph_graph_random_philox_state_seed(
807 graph_handle: *mut c_void,
808 seed: usize,
809 name: *const c_char,
810 ) -> *mut c_void;
811pub fn mpsgraph_graph_random_philox_state_counter(
813 graph_handle: *mut c_void,
814 counter_low: usize,
815 counter_high: usize,
816 key: usize,
817 name: *const c_char,
818 ) -> *mut c_void;
819pub fn mpsgraph_graph_random_tensor(
821 graph_handle: *mut c_void,
822 shape: *const usize,
823 shape_len: usize,
824 descriptor_handle: *mut c_void,
825 name: *const c_char,
826 ) -> *mut c_void;
827pub fn mpsgraph_graph_random_tensor_shape_tensor(
829 graph_handle: *mut c_void,
830 shape_tensor_handle: *mut c_void,
831 descriptor_handle: *mut c_void,
832 name: *const c_char,
833 ) -> *mut c_void;
834pub fn mpsgraph_graph_random_tensor_seed(
836 graph_handle: *mut c_void,
837 shape: *const usize,
838 shape_len: usize,
839 descriptor_handle: *mut c_void,
840 seed: usize,
841 name: *const c_char,
842 ) -> *mut c_void;
843pub fn mpsgraph_graph_random_tensor_shape_tensor_seed(
845 graph_handle: *mut c_void,
846 shape_tensor_handle: *mut c_void,
847 descriptor_handle: *mut c_void,
848 seed: usize,
849 name: *const c_char,
850 ) -> *mut c_void;
851pub fn mpsgraph_graph_random_tensor_state(
853 graph_handle: *mut c_void,
854 shape: *const usize,
855 shape_len: usize,
856 descriptor_handle: *mut c_void,
857 state_handle: *mut c_void,
858 name: *const c_char,
859 ) -> *mut c_void;
860pub fn mpsgraph_graph_random_tensor_shape_tensor_state(
862 graph_handle: *mut c_void,
863 shape_tensor_handle: *mut c_void,
864 descriptor_handle: *mut c_void,
865 state_handle: *mut c_void,
866 name: *const c_char,
867 ) -> *mut c_void;
868pub fn mpsgraph_graph_dropout(
870 graph_handle: *mut c_void,
871 tensor_handle: *mut c_void,
872 rate: f64,
873 name: *const c_char,
874 ) -> *mut c_void;
875pub fn mpsgraph_graph_dropout_tensor(
877 graph_handle: *mut c_void,
878 tensor_handle: *mut c_void,
879 rate_tensor_handle: *mut c_void,
880 name: *const c_char,
881 ) -> *mut c_void;
882pub fn mpsgraph_single_gate_rnn_descriptor_new() -> *mut c_void;
884pub fn mpsgraph_single_gate_rnn_descriptor_reverse(handle: *mut c_void) -> bool;
886pub fn mpsgraph_single_gate_rnn_descriptor_set_reverse(
888 handle: *mut c_void,
889 value: bool,
890 ) -> bool;
891pub fn mpsgraph_single_gate_rnn_descriptor_bidirectional(handle: *mut c_void) -> bool;
893pub fn mpsgraph_single_gate_rnn_descriptor_set_bidirectional(
895 handle: *mut c_void,
896 value: bool,
897 ) -> bool;
898pub fn mpsgraph_single_gate_rnn_descriptor_training(handle: *mut c_void) -> bool;
900pub fn mpsgraph_single_gate_rnn_descriptor_set_training(
902 handle: *mut c_void,
903 value: bool,
904 ) -> bool;
905pub fn mpsgraph_single_gate_rnn_descriptor_activation(handle: *mut c_void) -> usize;
907pub fn mpsgraph_single_gate_rnn_descriptor_set_activation(
909 handle: *mut c_void,
910 value: usize,
911 ) -> bool;
912pub fn mpsgraph_lstm_descriptor_new() -> *mut c_void;
914pub fn mpsgraph_lstm_descriptor_reverse(handle: *mut c_void) -> bool;
916pub fn mpsgraph_lstm_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
918pub fn mpsgraph_lstm_descriptor_bidirectional(handle: *mut c_void) -> bool;
920pub fn mpsgraph_lstm_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
922pub fn mpsgraph_lstm_descriptor_produce_cell(handle: *mut c_void) -> bool;
924pub fn mpsgraph_lstm_descriptor_set_produce_cell(handle: *mut c_void, value: bool) -> bool;
926pub fn mpsgraph_lstm_descriptor_training(handle: *mut c_void) -> bool;
928pub fn mpsgraph_lstm_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
930pub fn mpsgraph_lstm_descriptor_forget_gate_last(handle: *mut c_void) -> bool;
932pub fn mpsgraph_lstm_descriptor_set_forget_gate_last(handle: *mut c_void, value: bool) -> bool;
934pub fn mpsgraph_lstm_descriptor_input_gate_activation(handle: *mut c_void) -> usize;
936pub fn mpsgraph_lstm_descriptor_set_input_gate_activation(
938 handle: *mut c_void,
939 value: usize,
940 ) -> bool;
941pub fn mpsgraph_lstm_descriptor_forget_gate_activation(handle: *mut c_void) -> usize;
943pub fn mpsgraph_lstm_descriptor_set_forget_gate_activation(
945 handle: *mut c_void,
946 value: usize,
947 ) -> bool;
948pub fn mpsgraph_lstm_descriptor_cell_gate_activation(handle: *mut c_void) -> usize;
950pub fn mpsgraph_lstm_descriptor_set_cell_gate_activation(
952 handle: *mut c_void,
953 value: usize,
954 ) -> bool;
955pub fn mpsgraph_lstm_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
957pub fn mpsgraph_lstm_descriptor_set_output_gate_activation(
959 handle: *mut c_void,
960 value: usize,
961 ) -> bool;
962pub fn mpsgraph_lstm_descriptor_activation(handle: *mut c_void) -> usize;
964pub fn mpsgraph_lstm_descriptor_set_activation(handle: *mut c_void, value: usize) -> bool;
966pub fn mpsgraph_gru_descriptor_new() -> *mut c_void;
968pub fn mpsgraph_gru_descriptor_reverse(handle: *mut c_void) -> bool;
970pub fn mpsgraph_gru_descriptor_set_reverse(handle: *mut c_void, value: bool) -> bool;
972pub fn mpsgraph_gru_descriptor_bidirectional(handle: *mut c_void) -> bool;
974pub fn mpsgraph_gru_descriptor_set_bidirectional(handle: *mut c_void, value: bool) -> bool;
976pub fn mpsgraph_gru_descriptor_training(handle: *mut c_void) -> bool;
978pub fn mpsgraph_gru_descriptor_set_training(handle: *mut c_void, value: bool) -> bool;
980pub fn mpsgraph_gru_descriptor_reset_gate_first(handle: *mut c_void) -> bool;
982pub fn mpsgraph_gru_descriptor_set_reset_gate_first(handle: *mut c_void, value: bool) -> bool;
984pub fn mpsgraph_gru_descriptor_reset_after(handle: *mut c_void) -> bool;
986pub fn mpsgraph_gru_descriptor_set_reset_after(handle: *mut c_void, value: bool) -> bool;
988pub fn mpsgraph_gru_descriptor_flip_z(handle: *mut c_void) -> bool;
990pub fn mpsgraph_gru_descriptor_set_flip_z(handle: *mut c_void, value: bool) -> bool;
992pub fn mpsgraph_gru_descriptor_update_gate_activation(handle: *mut c_void) -> usize;
994pub fn mpsgraph_gru_descriptor_set_update_gate_activation(
996 handle: *mut c_void,
997 value: usize,
998 ) -> bool;
999pub fn mpsgraph_gru_descriptor_reset_gate_activation(handle: *mut c_void) -> usize;
1001pub fn mpsgraph_gru_descriptor_set_reset_gate_activation(
1003 handle: *mut c_void,
1004 value: usize,
1005 ) -> bool;
1006pub fn mpsgraph_gru_descriptor_output_gate_activation(handle: *mut c_void) -> usize;
1008pub fn mpsgraph_gru_descriptor_set_output_gate_activation(
1010 handle: *mut c_void,
1011 value: usize,
1012 ) -> bool;
1013pub fn mpsgraph_graph_single_gate_rnn(
1015 graph_handle: *mut c_void,
1016 source_handle: *mut c_void,
1017 recurrent_weight_handle: *mut c_void,
1018 input_weight_handle: *mut c_void,
1019 bias_handle: *mut c_void,
1020 init_state_handle: *mut c_void,
1021 mask_handle: *mut c_void,
1022 descriptor_handle: *mut c_void,
1023 name: *const c_char,
1024 ) -> *mut c_void;
1025pub fn mpsgraph_graph_lstm(
1027 graph_handle: *mut c_void,
1028 source_handle: *mut c_void,
1029 recurrent_weight_handle: *mut c_void,
1030 input_weight_handle: *mut c_void,
1031 bias_handle: *mut c_void,
1032 init_state_handle: *mut c_void,
1033 init_cell_handle: *mut c_void,
1034 mask_handle: *mut c_void,
1035 peephole_handle: *mut c_void,
1036 descriptor_handle: *mut c_void,
1037 name: *const c_char,
1038 ) -> *mut c_void;
1039pub fn mpsgraph_graph_gru(
1041 graph_handle: *mut c_void,
1042 source_handle: *mut c_void,
1043 recurrent_weight_handle: *mut c_void,
1044 input_weight_handle: *mut c_void,
1045 bias_handle: *mut c_void,
1046 init_state_handle: *mut c_void,
1047 mask_handle: *mut c_void,
1048 secondary_bias_handle: *mut c_void,
1049 descriptor_handle: *mut c_void,
1050 name: *const c_char,
1051 ) -> *mut c_void;
1052pub fn mpsgraph_graph_control_dependency(
1054 graph_handle: *mut c_void,
1055 operation_handles: *const *mut c_void,
1056 operation_count: usize,
1057 dependent_callback: Option<TensorArrayCallback>,
1058 dependent_context: *mut c_void,
1059 name: *const c_char,
1060 ) -> *mut c_void;
1061pub fn mpsgraph_graph_if_then_else(
1063 graph_handle: *mut c_void,
1064 predicate_handle: *mut c_void,
1065 then_callback: Option<TensorArrayCallback>,
1066 then_context: *mut c_void,
1067 else_callback: Option<TensorArrayCallback>,
1068 else_context: *mut c_void,
1069 name: *const c_char,
1070 ) -> *mut c_void;
1071pub fn mpsgraph_graph_while_loop(
1073 graph_handle: *mut c_void,
1074 input_handles: *const *mut c_void,
1075 input_count: usize,
1076 before_callback: Option<WhileBeforeCallback>,
1077 before_context: *mut c_void,
1078 after_callback: Option<TensorArrayInputCallback>,
1079 after_context: *mut c_void,
1080 name: *const c_char,
1081 ) -> *mut c_void;
1082pub fn mpsgraph_graph_for_loop(
1084 graph_handle: *mut c_void,
1085 lower_bound_handle: *mut c_void,
1086 upper_bound_handle: *mut c_void,
1087 step_handle: *mut c_void,
1088 argument_handles: *const *mut c_void,
1089 argument_count: usize,
1090 body_callback: Option<ForBodyCallback>,
1091 body_context: *mut c_void,
1092 name: *const c_char,
1093 ) -> *mut c_void;
1094pub fn mpsgraph_graph_for_loop_iterations(
1096 graph_handle: *mut c_void,
1097 number_of_iterations_handle: *mut c_void,
1098 argument_handles: *const *mut c_void,
1099 argument_count: usize,
1100 body_callback: Option<ForBodyCallback>,
1101 body_context: *mut c_void,
1102 name: *const c_char,
1103 ) -> *mut c_void;
1104}