objc2_metal_performance_shaders_graph/generated/MPSGraphMemoryOps.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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
12extern_class!(
13 /// The class that defines the parameters for a variable.
14 ///
15 /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshadersgraph/mpsgraphvariableop?language=objc)
16 #[unsafe(super(MPSGraphOperation, MPSGraphObject, NSObject))]
17 #[derive(Debug, PartialEq, Eq, Hash)]
18 #[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
19 pub struct MPSGraphVariableOp;
20);
21
22#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
23extern_conformance!(
24 unsafe impl NSCopying for MPSGraphVariableOp {}
25);
26
27#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
28unsafe impl CopyingHelper for MPSGraphVariableOp {
29 type Result = Self;
30}
31
32#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
33extern_conformance!(
34 unsafe impl NSObjectProtocol for MPSGraphVariableOp {}
35);
36
37#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
38impl MPSGraphVariableOp {
39 extern_methods!(
40 #[cfg(feature = "objc2-metal-performance-shaders")]
41 /// The shape of the variable.
42 #[unsafe(method(shape))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn shape(&self) -> Retained<MPSShape>;
45
46 #[cfg(feature = "objc2-metal-performance-shaders")]
47 /// The data type of the variable.
48 #[unsafe(method(dataType))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn dataType(&self) -> MPSDataType;
51 );
52}
53
54/// Methods declared on superclass `MPSGraphOperation`.
55#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
56impl MPSGraphVariableOp {
57 extern_methods!(
58 /// Unavailable, please utilize graph methods to create and initialize operations.
59 #[unsafe(method(init))]
60 #[unsafe(method_family = init)]
61 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
62 );
63}
64
65/// Methods declared on superclass `NSObject`.
66#[cfg(all(feature = "MPSGraphCore", feature = "MPSGraphOperation"))]
67impl MPSGraphVariableOp {
68 extern_methods!(
69 #[unsafe(method(new))]
70 #[unsafe(method_family = new)]
71 pub unsafe fn new() -> Retained<Self>;
72 );
73}
74
75/// MemoryOps.
76#[cfg(all(feature = "MPSGraph", feature = "MPSGraphCore"))]
77impl MPSGraph {
78 extern_methods!(
79 #[cfg(all(
80 feature = "MPSGraphTensor",
81 feature = "objc2-metal-performance-shaders"
82 ))]
83 /// Creates a placeholder operation and returns the result tensor.
84 ///
85 /// - Parameters:
86 /// - shape: The shape of the output tensor. A nil shape will result in an unranked tensor.
87 /// - dataType: The dataType of the placeholder tensor.
88 /// - name: The name for the placeholder operation.
89 /// - Returns: A valid MPSGraphTensor object.
90 #[unsafe(method(placeholderWithShape:dataType:name:))]
91 #[unsafe(method_family = none)]
92 pub unsafe fn placeholderWithShape_dataType_name(
93 &self,
94 shape: Option<&MPSShape>,
95 data_type: MPSDataType,
96 name: Option<&NSString>,
97 ) -> Retained<MPSGraphTensor>;
98
99 #[cfg(all(
100 feature = "MPSGraphTensor",
101 feature = "objc2-metal-performance-shaders"
102 ))]
103 /// Creates a placeholder operation and returns the result tensor with the dataType of the placeholder tensor set to 32 bit float.
104 ///
105 /// - Parameters:
106 /// - shape: The shape of the output tensor. A nil shape will result in an unranked tensor.
107 /// - name: The name for the operation.
108 /// - Returns: A valid MPSGraphTensor object.
109 #[unsafe(method(placeholderWithShape:name:))]
110 #[unsafe(method_family = none)]
111 pub unsafe fn placeholderWithShape_name(
112 &self,
113 shape: Option<&MPSShape>,
114 name: Option<&NSString>,
115 ) -> Retained<MPSGraphTensor>;
116
117 #[cfg(all(
118 feature = "MPSGraphTensor",
119 feature = "objc2-metal-performance-shaders"
120 ))]
121 /// Creates a constant op with a given shape and data, and returns the result tensor.
122 ///
123 /// - Parameters:
124 /// - data: The data for the tensor. The number of bytes should be sizeof(dataType)numberOfElements.
125 /// - shape: The shape of the output tensor. This has to be statically shaped.
126 /// - dataType: The dataType of theconstant tensor.
127 /// - Returns: A valid MPSGraphTensor object.
128 #[unsafe(method(constantWithData:shape:dataType:))]
129 #[unsafe(method_family = none)]
130 pub unsafe fn constantWithData_shape_dataType(
131 &self,
132 data: &NSData,
133 shape: &MPSShape,
134 data_type: MPSDataType,
135 ) -> Retained<MPSGraphTensor>;
136
137 #[cfg(all(
138 feature = "MPSGraphTensor",
139 feature = "objc2-metal-performance-shaders"
140 ))]
141 /// Creates a constant operation and returns the result tensor.
142 ///
143 /// - Parameters:
144 /// - scalar: The scalar value to fill the entire tensor values with.
145 /// - dataType: The dataType of the constant tensor.
146 /// - Returns: A valid MPSGraphTensor object.
147 #[unsafe(method(constantWithScalar:dataType:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn constantWithScalar_dataType(
150 &self,
151 scalar: c_double,
152 data_type: MPSDataType,
153 ) -> Retained<MPSGraphTensor>;
154
155 #[cfg(all(
156 feature = "MPSGraphTensor",
157 feature = "objc2-metal-performance-shaders"
158 ))]
159 /// Creates a constant op with a given shape and returns the result tensor.
160 ///
161 /// - Parameters:
162 /// - scalar: The scalar value to fill the entire tensor values with.
163 /// - shape: The shape of the output tensor.
164 /// - dataType: The dataType of the constant tensor.
165 /// - Returns: A valid MPSGraphTensor object.
166 #[unsafe(method(constantWithScalar:shape:dataType:))]
167 #[unsafe(method_family = none)]
168 pub unsafe fn constantWithScalar_shape_dataType(
169 &self,
170 scalar: c_double,
171 shape: &MPSShape,
172 data_type: MPSDataType,
173 ) -> Retained<MPSGraphTensor>;
174
175 #[cfg(feature = "MPSGraphTensor")]
176 /// Creates a complex constant op with the MPSDataTypeComplexFloat32 data type and returns the result tensor.
177 ///
178 /// - Parameters:
179 /// - realPart: The real part of the complex scalar to fill the entire tensor values with.
180 /// - imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.
181 /// - dataType: The dataType of the constant tensor.
182 /// - Returns: A valid MPSGraphTensor object.
183 #[unsafe(method(constantWithRealPart:imaginaryPart:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn constantWithRealPart_imaginaryPart(
186 &self,
187 real_part: c_double,
188 imaginary_part: c_double,
189 ) -> Retained<MPSGraphTensor>;
190
191 #[cfg(all(
192 feature = "MPSGraphTensor",
193 feature = "objc2-metal-performance-shaders"
194 ))]
195 /// Creates a complex constant operation and returns the result tensor.
196 ///
197 /// - Parameters:
198 /// - realPart: The real part of the complex scalar to fill the entire tensor values with.
199 /// - imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.
200 /// - dataType: The dataType of the constant tensor.
201 /// - Returns: A valid MPSGraphTensor object.
202 #[unsafe(method(constantWithRealPart:imaginaryPart:dataType:))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn constantWithRealPart_imaginaryPart_dataType(
205 &self,
206 real_part: c_double,
207 imaginary_part: c_double,
208 data_type: MPSDataType,
209 ) -> Retained<MPSGraphTensor>;
210
211 #[cfg(all(
212 feature = "MPSGraphTensor",
213 feature = "objc2-metal-performance-shaders"
214 ))]
215 /// Creates a complex constant op with a given shape and returns the result tensor.
216 ///
217 /// - Parameters:
218 /// - realPart: The real part of the complex scalar to fill the entire tensor values with.
219 /// - imaginaryPart: The imaginary part of the complex scalar to fill the entire tensor values with.
220 /// - shape: The shape of the output tensor. This has to be statically shaped.
221 /// - dataType: The dataType of the constant tensor.
222 /// - Returns: A valid MPSGraphTensor object.
223 #[unsafe(method(constantWithRealPart:imaginaryPart:shape:dataType:))]
224 #[unsafe(method_family = none)]
225 pub unsafe fn constantWithRealPart_imaginaryPart_shape_dataType(
226 &self,
227 real_part: c_double,
228 imaginary_part: c_double,
229 shape: &MPSShape,
230 data_type: MPSDataType,
231 ) -> Retained<MPSGraphTensor>;
232
233 #[cfg(all(
234 feature = "MPSGraphTensor",
235 feature = "objc2-metal-performance-shaders"
236 ))]
237 /// Creates a variable operation and returns the result tensor.
238 ///
239 /// - Parameters:
240 /// - data: The data for the tensor. The number of bytes should be sizeof(dataType)numberOfElements.
241 /// - shape: The shape of the output tensor. This has to be statically shaped.
242 /// - dataType: The dataType of the constant tensor.
243 /// - name: The name for the operation.
244 /// - Returns: A valid MPSGraphTensor object.
245 #[unsafe(method(variableWithData:shape:dataType:name:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn variableWithData_shape_dataType_name(
248 &self,
249 data: &NSData,
250 shape: &MPSShape,
251 data_type: MPSDataType,
252 name: Option<&NSString>,
253 ) -> Retained<MPSGraphTensor>;
254
255 #[cfg(feature = "MPSGraphTensor")]
256 /// Creates a variable from an input tensor.
257 ///
258 /// - Parameters:
259 /// - tensor: The tensor from which to form the variable.
260 /// - name: The name for the operation.
261 /// - Returns: A valid MPSGraphTensor object.
262 #[unsafe(method(variableFromTensorWithTensor:name:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn variableFromTensorWithTensor_name(
265 &self,
266 tensor: &MPSGraphTensor,
267 name: Option<&NSString>,
268 ) -> Retained<MPSGraphTensor>;
269
270 #[cfg(feature = "MPSGraphTensor")]
271 /// Creates a read op which reads at this point of execution of the graph and returns the result tensor.
272 ///
273 /// - Parameters:
274 /// - variable: The variable resource tensor to read from.
275 /// - name: The name for the operation.
276 /// - Returns: A valid MPSGraphTensor object.
277 #[unsafe(method(readVariable:name:))]
278 #[unsafe(method_family = none)]
279 pub unsafe fn readVariable_name(
280 &self,
281 variable: &MPSGraphTensor,
282 name: Option<&NSString>,
283 ) -> Retained<MPSGraphTensor>;
284
285 #[cfg(all(feature = "MPSGraphOperation", feature = "MPSGraphTensor"))]
286 /// Creates an assign operation which writes at this point of execution of the graph.
287 ///
288 /// - Parameters:
289 /// - variable: The variable resource tensor to assign to.
290 /// - tensor: The tensor to assign to the variable.
291 /// - name: The name for the operation.
292 /// - Returns: A valid MPSGraphTensor object.
293 #[unsafe(method(assignVariable:withValueOfTensor:name:))]
294 #[unsafe(method_family = none)]
295 pub unsafe fn assignVariable_withValueOfTensor_name(
296 &self,
297 variable: &MPSGraphTensor,
298 tensor: &MPSGraphTensor,
299 name: Option<&NSString>,
300 ) -> Retained<MPSGraphOperation>;
301 );
302}