objc2_metal_performance_shaders_graph/generated/
MPSGraphSparseOps.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7#[cfg(feature = "objc2-metal-performance-shaders")]
8use objc2_metal_performance_shaders::*;
9
10use crate::*;
11
12#[repr(transparent)]
17#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
18pub struct MPSGraphSparseStorageType(pub u64);
19impl MPSGraphSparseStorageType {
20 #[doc(alias = "MPSGraphSparseStorageCOO")]
22 pub const COO: Self = Self(0);
23 #[doc(alias = "MPSGraphSparseStorageCSC")]
25 pub const CSC: Self = Self(1);
26 #[doc(alias = "MPSGraphSparseStorageCSR")]
28 pub const CSR: Self = Self(2);
29}
30
31unsafe impl Encode for MPSGraphSparseStorageType {
32 const ENCODING: Encoding = u64::ENCODING;
33}
34
35unsafe impl RefEncode for MPSGraphSparseStorageType {
36 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
37}
38
39extern_class!(
40 #[unsafe(super(MPSGraphObject, NSObject))]
44 #[derive(Debug, PartialEq, Eq, Hash)]
45 #[cfg(feature = "MPSGraphCore")]
46 pub struct MPSGraphCreateSparseOpDescriptor;
47);
48
49#[cfg(feature = "MPSGraphCore")]
50extern_conformance!(
51 unsafe impl NSCopying for MPSGraphCreateSparseOpDescriptor {}
52);
53
54#[cfg(feature = "MPSGraphCore")]
55unsafe impl CopyingHelper for MPSGraphCreateSparseOpDescriptor {
56 type Result = Self;
57}
58
59#[cfg(feature = "MPSGraphCore")]
60extern_conformance!(
61 unsafe impl NSObjectProtocol for MPSGraphCreateSparseOpDescriptor {}
62);
63
64#[cfg(feature = "MPSGraphCore")]
65impl MPSGraphCreateSparseOpDescriptor {
66 extern_methods!(
67 #[unsafe(method(sparseStorageType))]
69 #[unsafe(method_family = none)]
70 pub unsafe fn sparseStorageType(&self) -> MPSGraphSparseStorageType;
71
72 #[unsafe(method(setSparseStorageType:))]
74 #[unsafe(method_family = none)]
75 pub unsafe fn setSparseStorageType(&self, sparse_storage_type: MPSGraphSparseStorageType);
76
77 #[cfg(feature = "objc2-metal-performance-shaders")]
78 #[unsafe(method(dataType))]
80 #[unsafe(method_family = none)]
81 pub unsafe fn dataType(&self) -> MPSDataType;
82
83 #[cfg(feature = "objc2-metal-performance-shaders")]
84 #[unsafe(method(setDataType:))]
86 #[unsafe(method_family = none)]
87 pub unsafe fn setDataType(&self, data_type: MPSDataType);
88
89 #[cfg(feature = "objc2-metal-performance-shaders")]
90 #[unsafe(method(descriptorWithStorageType:dataType:))]
97 #[unsafe(method_family = none)]
98 pub unsafe fn descriptorWithStorageType_dataType(
99 sparse_storage_type: MPSGraphSparseStorageType,
100 data_type: MPSDataType,
101 ) -> Option<Retained<Self>>;
102 );
103}
104
105#[cfg(feature = "MPSGraphCore")]
107impl MPSGraphCreateSparseOpDescriptor {
108 extern_methods!(
109 #[unsafe(method(init))]
110 #[unsafe(method_family = init)]
111 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
112
113 #[unsafe(method(new))]
114 #[unsafe(method_family = new)]
115 pub unsafe fn new() -> Retained<Self>;
116 );
117}
118
119#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
121impl MPSGraph {
122 extern_methods!(
123 #[cfg(all(
124 feature = "MPSGraphTensor",
125 feature = "objc2-metal-performance-shaders"
126 ))]
127 #[unsafe(method(sparseTensorWithType:tensors:shape:dataType:name:))]
144 #[unsafe(method_family = none)]
145 pub unsafe fn sparseTensorWithType_tensors_shape_dataType_name(
146 &self,
147 sparse_storage_type: MPSGraphSparseStorageType,
148 input_tensor_array: &NSArray<MPSGraphTensor>,
149 shape: &MPSShape,
150 data_type: MPSDataType,
151 name: Option<&NSString>,
152 ) -> Retained<MPSGraphTensor>;
153
154 #[cfg(all(
155 feature = "MPSGraphTensor",
156 feature = "objc2-metal-performance-shaders"
157 ))]
158 #[unsafe(method(sparseTensorWithDescriptor:tensors:shape:name:))]
174 #[unsafe(method_family = none)]
175 pub unsafe fn sparseTensorWithDescriptor_tensors_shape_name(
176 &self,
177 sparse_descriptor: &MPSGraphCreateSparseOpDescriptor,
178 input_tensor_array: &NSArray<MPSGraphTensor>,
179 shape: &MPSShape,
180 name: Option<&NSString>,
181 ) -> Retained<MPSGraphTensor>;
182 );
183}