objc2_metal_performance_shaders/generated/MPSNeuralNetwork/
MPSCNNDropout.rs1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_class!(
12 #[unsafe(super(MPSNNGradientState, MPSState, NSObject))]
25 #[derive(Debug, PartialEq, Eq, Hash)]
26 #[cfg(all(
27 feature = "MPSCore",
28 feature = "MPSNNGradientState",
29 feature = "MPSState"
30 ))]
31 pub struct MPSCNNDropoutGradientState;
32);
33
34#[cfg(all(
35 feature = "MPSCore",
36 feature = "MPSNNGradientState",
37 feature = "MPSState"
38))]
39extern_conformance!(
40 unsafe impl NSObjectProtocol for MPSCNNDropoutGradientState {}
41);
42
43#[cfg(all(
44 feature = "MPSCore",
45 feature = "MPSNNGradientState",
46 feature = "MPSState"
47))]
48impl MPSCNNDropoutGradientState {
49 extern_methods!(
50 #[unsafe(method(init))]
51 #[unsafe(method_family = init)]
52 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
53
54 #[unsafe(method(maskData))]
65 #[unsafe(method_family = none)]
66 pub unsafe fn maskData(&self) -> Retained<NSData>;
67 );
68}
69
70#[cfg(all(
72 feature = "MPSCore",
73 feature = "MPSNNGradientState",
74 feature = "MPSState"
75))]
76impl MPSCNNDropoutGradientState {
77 extern_methods!(
78 #[unsafe(method(temporaryStateWithCommandBuffer:bufferSize:))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn temporaryStateWithCommandBuffer_bufferSize(
86 cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
87 buffer_size: usize,
88 ) -> Retained<Self>;
89
90 #[unsafe(method(temporaryStateWithCommandBuffer:textureDescriptor:))]
96 #[unsafe(method_family = none)]
97 pub unsafe fn temporaryStateWithCommandBuffer_textureDescriptor(
98 cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
99 descriptor: &MTLTextureDescriptor,
100 ) -> Retained<Self>;
101
102 #[unsafe(method(temporaryStateWithCommandBuffer:))]
106 #[unsafe(method_family = none)]
107 pub unsafe fn temporaryStateWithCommandBuffer(
108 cmd_buf: &ProtocolObject<dyn MTLCommandBuffer>,
109 ) -> Retained<Self>;
110
111 #[unsafe(method(initWithDevice:bufferSize:))]
112 #[unsafe(method_family = init)]
113 pub unsafe fn initWithDevice_bufferSize(
114 this: Allocated<Self>,
115 device: &ProtocolObject<dyn MTLDevice>,
116 buffer_size: usize,
117 ) -> Retained<Self>;
118
119 #[unsafe(method(initWithDevice:textureDescriptor:))]
120 #[unsafe(method_family = init)]
121 pub unsafe fn initWithDevice_textureDescriptor(
122 this: Allocated<Self>,
123 device: &ProtocolObject<dyn MTLDevice>,
124 descriptor: &MTLTextureDescriptor,
125 ) -> Retained<Self>;
126
127 #[unsafe(method(initWithResource:))]
136 #[unsafe(method_family = init)]
137 pub unsafe fn initWithResource(
138 this: Allocated<Self>,
139 resource: Option<&ProtocolObject<dyn MTLResource>>,
140 ) -> Retained<Self>;
141
142 #[unsafe(method(initWithDevice:resourceList:))]
149 #[unsafe(method_family = init)]
150 pub unsafe fn initWithDevice_resourceList(
151 this: Allocated<Self>,
152 device: &ProtocolObject<dyn MTLDevice>,
153 resource_list: &MPSStateResourceList,
154 ) -> Retained<Self>;
155
156 #[unsafe(method(temporaryStateWithCommandBuffer:resourceList:))]
160 #[unsafe(method_family = none)]
161 pub unsafe fn temporaryStateWithCommandBuffer_resourceList(
162 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
163 resource_list: &MPSStateResourceList,
164 ) -> Retained<Self>;
165
166 #[unsafe(method(initWithResources:))]
178 #[unsafe(method_family = init)]
179 pub unsafe fn initWithResources(
180 this: Allocated<Self>,
181 resources: Option<&NSArray<ProtocolObject<dyn MTLResource>>>,
182 ) -> Retained<Self>;
183 );
184}
185
186#[cfg(all(
188 feature = "MPSCore",
189 feature = "MPSNNGradientState",
190 feature = "MPSState"
191))]
192impl MPSCNNDropoutGradientState {
193 extern_methods!(
194 #[unsafe(method(new))]
195 #[unsafe(method_family = new)]
196 pub unsafe fn new() -> Retained<Self>;
197 );
198}
199
200#[cfg(all(
202 feature = "MPSCore",
203 feature = "MPSNNGradientState",
204 feature = "MPSState"
205))]
206pub type MPSCNNDropoutGradientStateBatch = NSArray<MPSCNNDropoutGradientState>;
207
208extern_class!(
209 #[unsafe(super(MPSCNNKernel, MPSKernel, NSObject))]
219 #[derive(Debug, PartialEq, Eq, Hash)]
220 #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
221 pub struct MPSCNNDropout;
222);
223
224#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
225extern_conformance!(
226 unsafe impl NSCoding for MPSCNNDropout {}
227);
228
229#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
230extern_conformance!(
231 unsafe impl NSCopying for MPSCNNDropout {}
232);
233
234#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
235unsafe impl CopyingHelper for MPSCNNDropout {
236 type Result = Self;
237}
238
239#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
240extern_conformance!(
241 unsafe impl NSObjectProtocol for MPSCNNDropout {}
242);
243
244#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
245extern_conformance!(
246 unsafe impl NSSecureCoding for MPSCNNDropout {}
247);
248
249#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
250impl MPSCNNDropout {
251 extern_methods!(
252 #[unsafe(method(keepProbability))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn keepProbability(&self) -> c_float;
257
258 #[unsafe(method(seed))]
260 #[unsafe(method_family = none)]
261 pub unsafe fn seed(&self) -> NSUInteger;
262
263 #[unsafe(method(maskStrideInPixels))]
270 #[unsafe(method_family = none)]
271 pub unsafe fn maskStrideInPixels(&self) -> MTLSize;
272
273 #[unsafe(method(initWithDevice:))]
274 #[unsafe(method_family = init)]
275 pub unsafe fn initWithDevice(
276 this: Allocated<Self>,
277 device: &ProtocolObject<dyn MTLDevice>,
278 ) -> Retained<Self>;
279
280 #[unsafe(method(initWithCoder:device:))]
287 #[unsafe(method_family = init)]
288 pub unsafe fn initWithCoder_device(
289 this: Allocated<Self>,
290 a_decoder: &NSCoder,
291 device: &ProtocolObject<dyn MTLDevice>,
292 ) -> Option<Retained<Self>>;
293
294 #[unsafe(method(initWithDevice:keepProbability:seed:maskStrideInPixels:))]
311 #[unsafe(method_family = init)]
312 pub unsafe fn initWithDevice_keepProbability_seed_maskStrideInPixels(
313 this: Allocated<Self>,
314 device: &ProtocolObject<dyn MTLDevice>,
315 keep_probability: c_float,
316 seed: NSUInteger,
317 mask_stride_in_pixels: MTLSize,
318 ) -> Retained<Self>;
319
320 #[cfg(all(
321 feature = "MPSImage",
322 feature = "MPSNNGradientState",
323 feature = "MPSState"
324 ))]
325 #[unsafe(method(resultStateForSourceImage:sourceStates:destinationImage:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn resultStateForSourceImage_sourceStates_destinationImage(
328 &self,
329 source_image: &MPSImage,
330 source_states: Option<&NSArray<MPSState>>,
331 destination_image: &MPSImage,
332 ) -> Option<Retained<MPSCNNDropoutGradientState>>;
333
334 #[cfg(all(
335 feature = "MPSImage",
336 feature = "MPSNDArray",
337 feature = "MPSNNGradientState",
338 feature = "MPSState"
339 ))]
340 #[unsafe(method(resultStateBatchForSourceImage:sourceStates:destinationImage:))]
341 #[unsafe(method_family = none)]
342 pub unsafe fn resultStateBatchForSourceImage_sourceStates_destinationImage(
343 &self,
344 source_image: &MPSImageBatch,
345 source_states: Option<&NSArray<MPSStateBatch>>,
346 destination_image: &MPSImageBatch,
347 ) -> Option<Retained<MPSCNNDropoutGradientState>>;
348
349 #[cfg(all(
350 feature = "MPSImage",
351 feature = "MPSNNGradientState",
352 feature = "MPSState"
353 ))]
354 #[unsafe(method(temporaryResultStateForCommandBuffer:sourceImage:sourceStates:destinationImage:))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn temporaryResultStateForCommandBuffer_sourceImage_sourceStates_destinationImage(
357 &self,
358 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
359 source_image: &MPSImage,
360 source_states: Option<&NSArray<MPSState>>,
361 destination_image: &MPSImage,
362 ) -> Option<Retained<MPSCNNDropoutGradientState>>;
363
364 #[cfg(all(
365 feature = "MPSImage",
366 feature = "MPSNDArray",
367 feature = "MPSNNGradientState",
368 feature = "MPSState"
369 ))]
370 #[unsafe(method(temporaryResultStateBatchForCommandBuffer:sourceImage:sourceStates:destinationImage:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn temporaryResultStateBatchForCommandBuffer_sourceImage_sourceStates_destinationImage(
373 &self,
374 command_buffer: &ProtocolObject<dyn MTLCommandBuffer>,
375 source_image: &MPSImageBatch,
376 source_states: Option<&NSArray<MPSStateBatch>>,
377 destination_image: &MPSImageBatch,
378 ) -> Option<Retained<MPSCNNDropoutGradientStateBatch>>;
379 );
380}
381
382#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
384impl MPSCNNDropout {
385 extern_methods!(
386 #[unsafe(method(initWithCoder:))]
399 #[unsafe(method_family = init)]
400 pub unsafe fn initWithCoder(
401 this: Allocated<Self>,
402 a_decoder: &NSCoder,
403 ) -> Option<Retained<Self>>;
404 );
405}
406
407#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
409impl MPSCNNDropout {
410 extern_methods!(
411 #[unsafe(method(init))]
412 #[unsafe(method_family = init)]
413 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
414
415 #[unsafe(method(new))]
416 #[unsafe(method_family = new)]
417 pub unsafe fn new() -> Retained<Self>;
418 );
419}
420
421extern_class!(
422 #[unsafe(super(MPSCNNGradientKernel, MPSCNNBinaryKernel, MPSKernel, NSObject))]
433 #[derive(Debug, PartialEq, Eq, Hash)]
434 #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
435 pub struct MPSCNNDropoutGradient;
436);
437
438#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
439extern_conformance!(
440 unsafe impl NSCoding for MPSCNNDropoutGradient {}
441);
442
443#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
444extern_conformance!(
445 unsafe impl NSCopying for MPSCNNDropoutGradient {}
446);
447
448#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
449unsafe impl CopyingHelper for MPSCNNDropoutGradient {
450 type Result = Self;
451}
452
453#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
454extern_conformance!(
455 unsafe impl NSObjectProtocol for MPSCNNDropoutGradient {}
456);
457
458#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
459extern_conformance!(
460 unsafe impl NSSecureCoding for MPSCNNDropoutGradient {}
461);
462
463#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
464impl MPSCNNDropoutGradient {
465 extern_methods!(
466 #[unsafe(method(keepProbability))]
469 #[unsafe(method_family = none)]
470 pub unsafe fn keepProbability(&self) -> c_float;
471
472 #[unsafe(method(seed))]
474 #[unsafe(method_family = none)]
475 pub unsafe fn seed(&self) -> NSUInteger;
476
477 #[unsafe(method(maskStrideInPixels))]
484 #[unsafe(method_family = none)]
485 pub unsafe fn maskStrideInPixels(&self) -> MTLSize;
486
487 #[unsafe(method(initWithDevice:))]
488 #[unsafe(method_family = init)]
489 pub unsafe fn initWithDevice(
490 this: Allocated<Self>,
491 device: &ProtocolObject<dyn MTLDevice>,
492 ) -> Retained<Self>;
493
494 #[unsafe(method(initWithCoder:device:))]
501 #[unsafe(method_family = init)]
502 pub unsafe fn initWithCoder_device(
503 this: Allocated<Self>,
504 a_decoder: &NSCoder,
505 device: &ProtocolObject<dyn MTLDevice>,
506 ) -> Option<Retained<Self>>;
507
508 #[unsafe(method(initWithDevice:keepProbability:seed:maskStrideInPixels:))]
525 #[unsafe(method_family = init)]
526 pub unsafe fn initWithDevice_keepProbability_seed_maskStrideInPixels(
527 this: Allocated<Self>,
528 device: &ProtocolObject<dyn MTLDevice>,
529 keep_probability: c_float,
530 seed: NSUInteger,
531 mask_stride_in_pixels: MTLSize,
532 ) -> Retained<Self>;
533 );
534}
535
536#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
538impl MPSCNNDropoutGradient {
539 extern_methods!(
540 #[unsafe(method(initWithCoder:))]
553 #[unsafe(method_family = init)]
554 pub unsafe fn initWithCoder(
555 this: Allocated<Self>,
556 a_decoder: &NSCoder,
557 ) -> Option<Retained<Self>>;
558 );
559}
560
561#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
563impl MPSCNNDropoutGradient {
564 extern_methods!(
565 #[unsafe(method(init))]
566 #[unsafe(method_family = init)]
567 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
568
569 #[unsafe(method(new))]
570 #[unsafe(method_family = new)]
571 pub unsafe fn new() -> Retained<Self>;
572 );
573}