objc2_metal_performance_shaders/generated/MPSNeuralNetwork/
MPSNNGraphNodes.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::*;
7use objc2_metal::*;
8
9use crate::*;
10
11extern_protocol!(
12    /// MPS resource identification
13    ///
14    /// Most of the time, there is only one image and one or fewer states needed as
15    /// input to a graph, so the order of the images and states passed to
16    /// [MPSNNGraph encodeToCommandBuffer:sourceImages:] or
17    /// [MPSNNGraph encodeToCommandBuffer:sourceImages:sourceStates:intermediateImages:destinationStates:]
18    /// is clear. There is only one order. However, sometimes graphs have more than one
19    /// input image or state. What order should they appear in the NSArray passed to
20    /// these methods?
21    ///
22    /// Each MPSNNImageNode or MPSNNStateNode can be tagged with a MPSHandle. MPSNNGraph
23    /// keeps track of these. You can request that the MPSNNGraph return them to you in
24    /// an array in the same order as needed to encode the MPSNNGraph, using
25    /// MPSNNGraph.sourceImageHandles and MPSNNGraph.sourceStateHandles.
26    ///
27    /// Example:
28    ///
29    /// ```text
30    ///               @interface MyHandle : NSObject <MPSHandle>
31    ///                   // Add a method for my use to get the image needed based on the handle to it.
32    ///                   // This isn't part of the MPSHandle protocol, but we need it for MyEncodeGraph
33    ///                   // below. Since it is my code calling my object, we can add whatever we want like this.
34    ///                   -(MPSImage*__nonnull) image;    // return the MPSImage corresponding to the handle
35    ///
36    ///                   // required by MPSHandle protocol
37    ///                   -(NSString * __nullable) label;
38    ///
39    ///                   // MPSHandle implies NSSecureCoding too
40    ///                   +(BOOL) supportsSecureCoding;
41    ///                   - (void)encodeWithCoder:(NSCoder * __nonnull )aCoder;
42    ///                   - (nullable instancetype)initWithCoder:(NSCoder * __nonnull )aDecoder; // NS_DESIGNATED_INITIALIZER
43    ///               @end
44    ///
45    ///               // Encode a graph to cmdBuf using handles for images
46    ///               // Here we assume that the MPSNNImageNodes that are graph inputs (not produced
47    ///               // by the graph) are tagged with a unique instance of MyHandle that can be used
48    ///               // to get the appropriate image for that node.
49    ///               static void MyEncodeGraph( MPSNNGraph * graph, id <MTLCommandBuffer> cmdBuf )
50    ///               {
51    ///                   @autoreleasepool{
52    ///                       // prepare an array of source images, using the handles
53    ///                       NSArray<MyHandle*> * handles = graph.sourceImageHandles;
54    ///                       unsigned long count = handles.count;
55    ///                       NSMutableArray<MPSImage*> * __nonnull images = [NSMutableArray arrayWithCapacity: count];
56    ///                       for( unsigned long i = 0; i < count; i++ )
57    ///                           images[i] = handles[i].image;
58    ///
59    ///                       // encode the graph using the array
60    ///                       [ graph encodeToCommandBuffer: cmdBuf
61    ///                                        sourceImages: images ];
62    ///                   }
63    ///               }
64    /// ```
65    ///
66    /// But what is a handle?  Here MPS is giving you enough rope with which to hang
67    /// yourself. Don't panic! As long as your response is not to start tying nooses,
68    /// you should be fine. It is just rope. More precisely, it is just a pointer to a
69    /// NSObject. MPS doesn't know or care what it is or does, so long as it conforms
70    /// to the MPSHandle protocol. What it does is entirely up to you. We imagine it
71    /// will be an object that describes the data that you intend to pass later to the graph.
72    /// It could be a file reference, or an input to your own software component that wraps
73    /// the graph or even the MPSImage / MPSState that you plan to use.
74    ///
75    /// Do take note of the NSSecureCoding requirement in the MPSHandle protocol, however.
76    /// This is needed if you attempt to use NSSecureCoding to serialize the MPSNNGraph.
77    /// Normal MPSImages and MPSStates don't do that part.
78    ///
79    /// Your application should be able to use the handle to locate / create the correct
80    /// image / state or batch thereof to pass as input to the graph.  Handles are also
81    /// used to disambiguate graph intermediate images and state outputs. They aren't used
82    /// to disambiguate image results (see -[MPSNNGraph initWithDevice:resultImages:resultsAreNeeded:]
83    /// as you should already know the ordering of outputs there. It is the same as what
84    /// you asked for.
85    ///
86    /// Do take note of the NSSecureCoding requirement in the MPSHandle protocol, however.
87    /// This is needed if you attempt to use NSSecureCoding to serialize the MPSNNGraph.
88    /// Normal MPSImages and MPSStates don't do that part.
89    ///
90    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpshandle?language=objc)
91    pub unsafe trait MPSHandle: NSSecureCoding + NSObjectProtocol {
92        /// A label to be attached to associated MTLResources for this node
93        ///
94        /// Returns: A human readable string for debugging purposes
95        #[unsafe(method(label))]
96        #[unsafe(method_family = none)]
97        unsafe fn label(&self) -> Option<Retained<NSString>>;
98    }
99);
100
101extern_protocol!(
102    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnntrainablenode?language=objc)
103    pub unsafe trait MPSNNTrainableNode: NSObjectProtocol {
104        #[cfg(feature = "MPSNeuralNetworkTypes")]
105        /// Configure whether and when neural network training parameters are updated
106        ///
107        /// Default: MPSNNTrainingStyleUpdateDeviceGPU
108        #[unsafe(method(trainingStyle))]
109        #[unsafe(method_family = none)]
110        unsafe fn trainingStyle(&self) -> MPSNNTrainingStyle;
111
112        #[cfg(feature = "MPSNeuralNetworkTypes")]
113        /// Setter for [`trainingStyle`][Self::trainingStyle].
114        #[unsafe(method(setTrainingStyle:))]
115        #[unsafe(method_family = none)]
116        unsafe fn setTrainingStyle(&self, training_style: MPSNNTrainingStyle);
117    }
118);
119
120extern_class!(
121    /// A placeholder node denoting the position of a MPSImage in a graph
122    ///
123    /// MPS neural network graphs are made up of filter nodes connected by
124    /// image (or state) nodes. An image node is produced by one filter but
125    /// may be consumed by more than one filter.
126    ///
127    /// Most image nodes will be created by MPS and made available through
128    /// MPSNNFilterNode.resultImage. Image nodes that are not created by MPS
129    /// (i.e. "the graph inputs") must be created by you.
130    ///
131    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnimagenode?language=objc)
132    #[unsafe(super(NSObject))]
133    #[derive(Debug, PartialEq, Eq, Hash)]
134    pub struct MPSNNImageNode;
135);
136
137extern_conformance!(
138    unsafe impl NSObjectProtocol for MPSNNImageNode {}
139);
140
141impl MPSNNImageNode {
142    extern_methods!(
143        /// # Safety
144        ///
145        /// `handle` must implement MPSHandle.
146        #[unsafe(method(initWithHandle:))]
147        #[unsafe(method_family = init)]
148        pub unsafe fn initWithHandle(
149            this: Allocated<Self>,
150            handle: Option<&NSObject>,
151        ) -> Retained<Self>;
152
153        /// # Safety
154        ///
155        /// `handle` must implement MPSHandle.
156        #[unsafe(method(nodeWithHandle:))]
157        #[unsafe(method_family = none)]
158        pub unsafe fn nodeWithHandle(handle: Option<&NSObject>) -> Retained<Self>;
159
160        /// Create a autoreleased MPSNNImageNode with exportFromGraph = YES.
161        ///
162        /// Note: image is still temporary. See MPSNNImageNode.imageAllocator parameter.
163        ///
164        /// # Safety
165        ///
166        /// `handle` must implement MPSHandle.
167        #[unsafe(method(exportedNodeWithHandle:))]
168        #[unsafe(method_family = none)]
169        pub unsafe fn exportedNodeWithHandle(handle: Option<&NSObject>) -> Retained<Self>;
170
171        #[unsafe(method(init))]
172        #[unsafe(method_family = init)]
173        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
174
175        /// MPS resource identifier
176        ///
177        /// See MPSHandle protocol description.  Default: nil
178        #[unsafe(method(handle))]
179        #[unsafe(method_family = none)]
180        pub unsafe fn handle(&self) -> Option<Retained<ProtocolObject<dyn MPSHandle>>>;
181
182        /// Setter for [`handle`][Self::handle].
183        #[unsafe(method(setHandle:))]
184        #[unsafe(method_family = none)]
185        pub unsafe fn setHandle(&self, handle: Option<&ProtocolObject<dyn MPSHandle>>);
186
187        #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
188        /// The preferred precision for the image
189        ///
190        /// Default: MPSImageFeatureChannelFormatNone, meaning MPS should pick a format
191        /// Typically, this is 16-bit floating-point.
192        #[unsafe(method(format))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn format(&self) -> MPSImageFeatureChannelFormat;
195
196        #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
197        /// Setter for [`format`][Self::format].
198        #[unsafe(method(setFormat:))]
199        #[unsafe(method_family = none)]
200        pub unsafe fn setFormat(&self, format: MPSImageFeatureChannelFormat);
201
202        #[cfg(all(feature = "MPSCore", feature = "MPSImage"))]
203        /// Configurability for image allocation
204        ///
205        /// Allows you to influence how the image is allocated
206        /// Default: MPSTemporaryImage.defaultAllocator
207        #[unsafe(method(imageAllocator))]
208        #[unsafe(method_family = none)]
209        pub unsafe fn imageAllocator(&self) -> Retained<ProtocolObject<dyn MPSImageAllocator>>;
210
211        #[cfg(all(feature = "MPSCore", feature = "MPSImage"))]
212        /// Setter for [`imageAllocator`][Self::imageAllocator].
213        #[unsafe(method(setImageAllocator:))]
214        #[unsafe(method_family = none)]
215        pub unsafe fn setImageAllocator(
216            &self,
217            image_allocator: &ProtocolObject<dyn MPSImageAllocator>,
218        );
219
220        /// Tag a image node for view later
221        ///
222        /// Most image nodes are private to the graph. These alias memory heavily and
223        /// consequently generally have invalid state when the graph exits.  When
224        /// exportFromGraph = YES, the image is preserved and made available through
225        /// the [MPSNNGraph encode... intermediateImages:... list.
226        ///
227        /// CAUTION: exporting an image from a graph prevents MPS from
228        /// recycling memory. It will nearly always cause the
229        /// amount of memory used by the graph to increase by the size
230        /// of the image. There will probably be a performance
231        /// regression accordingly.  This feature should generally
232        /// be used only when the node is needed as an input for
233        /// further work and recomputing it is prohibitively costly.
234        ///
235        /// Default: NO
236        #[unsafe(method(exportFromGraph))]
237        #[unsafe(method_family = none)]
238        pub unsafe fn exportFromGraph(&self) -> bool;
239
240        /// Setter for [`exportFromGraph`][Self::exportFromGraph].
241        #[unsafe(method(setExportFromGraph:))]
242        #[unsafe(method_family = none)]
243        pub unsafe fn setExportFromGraph(&self, export_from_graph: bool);
244
245        /// Set to true to cause the resource to be synchronized with the CPU
246        ///
247        /// It is not needed on iOS/tvOS devices, where it does nothing.
248        #[unsafe(method(synchronizeResource))]
249        #[unsafe(method_family = none)]
250        pub unsafe fn synchronizeResource(&self) -> bool;
251
252        /// Setter for [`synchronizeResource`][Self::synchronizeResource].
253        #[unsafe(method(setSynchronizeResource:))]
254        #[unsafe(method_family = none)]
255        pub unsafe fn setSynchronizeResource(&self, synchronize_resource: bool);
256
257        /// Stop training graph automatic creation at this node.
258        ///
259        /// An inference graph of MPSNNFilterNodes, MPSNNStateNodes and MPSNNImageNodes can be automatically
260        /// converted to a training graph using -[MPSNNFilterNode trainingGraphWithSourceGradient:nodeHandler:].
261        /// Sometimes, an inference graph may contain extra nodes at start to do operations like resampling or range
262        /// adjustment that should not be part of the training graph. To prevent gradient operations for these extra
263        /// nodes from being included in the training graph, set
264        /// <undesired
265        /// node>.resultImage.stopGradient = YES.
266        /// This will prevent gradient propagation beyond this MPSNNImageNode.
267        /// Default: NO
268        #[unsafe(method(stopGradient))]
269        #[unsafe(method_family = none)]
270        pub unsafe fn stopGradient(&self) -> bool;
271
272        /// Setter for [`stopGradient`][Self::stopGradient].
273        #[unsafe(method(setStopGradient:))]
274        #[unsafe(method_family = none)]
275        pub unsafe fn setStopGradient(&self, stop_gradient: bool);
276    );
277}
278
279/// Methods declared on superclass `NSObject`.
280impl MPSNNImageNode {
281    extern_methods!(
282        #[unsafe(method(new))]
283        #[unsafe(method_family = new)]
284        pub unsafe fn new() -> Retained<Self>;
285    );
286}
287
288extern_class!(
289    /// A placeholder node denoting the position in the graph of a MPSState object
290    ///
291    /// Some filters need additional information about an image in order to function. For example
292    /// a max-pooling gradient filter needs to know which position the max result came from in the
293    /// original pooling filter in order to select the right data for gradient computation.  In other cases,
294    /// state may be moved into a MPSState object in order to keep the filter itself immutable.
295    /// The MPSState object typically encapsulates one or more MTLResource objects.
296    ///
297    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnstatenode?language=objc)
298    #[unsafe(super(NSObject))]
299    #[derive(Debug, PartialEq, Eq, Hash)]
300    pub struct MPSNNStateNode;
301);
302
303extern_conformance!(
304    unsafe impl NSObjectProtocol for MPSNNStateNode {}
305);
306
307impl MPSNNStateNode {
308    extern_methods!(
309        #[unsafe(method(init))]
310        #[unsafe(method_family = init)]
311        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
312
313        /// MPS resource identification
314        ///
315        /// See MPSHandle protocol reference.  Default: nil
316        #[unsafe(method(handle))]
317        #[unsafe(method_family = none)]
318        pub unsafe fn handle(&self) -> Option<Retained<ProtocolObject<dyn MPSHandle>>>;
319
320        /// Setter for [`handle`][Self::handle].
321        #[unsafe(method(setHandle:))]
322        #[unsafe(method_family = none)]
323        pub unsafe fn setHandle(&self, handle: Option<&ProtocolObject<dyn MPSHandle>>);
324
325        /// Tag a state node for view later
326        ///
327        /// Most state nodes are private to the graph. These alias memory heavily and
328        /// consequently generally have invalid state when the graph exits.  When
329        /// exportFromGraph = YES, the image is preserved and made available through
330        /// the [MPSNNGraph encode... resultStates:... list.
331        ///
332        /// CAUTION: exporting an state from a graph prevents MPS from
333        /// recycling memory. It will nearly always cause the
334        /// amount of memory used by the graph to increase by the size
335        /// of the state. There will probably be a performance
336        /// regression accordingly.  This feature should generally
337        /// be used only when the node is needed as an input for
338        /// further work and recomputing it is prohibitively costly.
339        ///
340        /// Default: NO
341        #[unsafe(method(exportFromGraph))]
342        #[unsafe(method_family = none)]
343        pub unsafe fn exportFromGraph(&self) -> bool;
344
345        /// Setter for [`exportFromGraph`][Self::exportFromGraph].
346        #[unsafe(method(setExportFromGraph:))]
347        #[unsafe(method_family = none)]
348        pub unsafe fn setExportFromGraph(&self, export_from_graph: bool);
349
350        /// Set to true to cause the resource to be synchronized with the CPU
351        ///
352        /// Ignored on non-MacOS.
353        #[unsafe(method(synchronizeResource))]
354        #[unsafe(method_family = none)]
355        pub unsafe fn synchronizeResource(&self) -> bool;
356
357        /// Setter for [`synchronizeResource`][Self::synchronizeResource].
358        #[unsafe(method(setSynchronizeResource:))]
359        #[unsafe(method_family = none)]
360        pub unsafe fn setSynchronizeResource(&self, synchronize_resource: bool);
361    );
362}
363
364/// Methods declared on superclass `NSObject`.
365impl MPSNNStateNode {
366    extern_methods!(
367        #[unsafe(method(new))]
368        #[unsafe(method_family = new)]
369        pub unsafe fn new() -> Retained<Self>;
370    );
371}
372
373extern_class!(
374    /// During training, each MPSNNFilterNode has a corresponding
375    /// MPSNNGradientFilterNode for the gradient computation for
376    /// trainable parameter update. The two communicate through a
377    /// MPSNNGradientStateNode or subclass which carries information
378    /// about the inference pass settings to the gradient pass.
379    /// You can avoid managing these -- there will be many! -- by
380    /// using -[MPSNNFilterNode gradientFilterWithSources:] to make
381    /// the MPSNNGradientFilterNodes. That method will append
382    /// the necessary extra information like MPSNNGradientState
383    /// nodes and inference filter source image nodes to the object as
384    /// needed.
385    ///
386    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngradientstatenode?language=objc)
387    #[unsafe(super(MPSNNStateNode, NSObject))]
388    #[derive(Debug, PartialEq, Eq, Hash)]
389    pub struct MPSNNGradientStateNode;
390);
391
392extern_conformance!(
393    unsafe impl NSObjectProtocol for MPSNNGradientStateNode {}
394);
395
396impl MPSNNGradientStateNode {
397    extern_methods!();
398}
399
400/// Methods declared on superclass `MPSNNStateNode`.
401impl MPSNNGradientStateNode {
402    extern_methods!(
403        #[unsafe(method(init))]
404        #[unsafe(method_family = init)]
405        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
406    );
407}
408
409/// Methods declared on superclass `NSObject`.
410impl MPSNNGradientStateNode {
411    extern_methods!(
412        #[unsafe(method(new))]
413        #[unsafe(method_family = new)]
414        pub unsafe fn new() -> Retained<Self>;
415    );
416}
417
418extern_class!(
419    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiongradientstatenode?language=objc)
420    #[unsafe(super(MPSNNGradientStateNode, MPSNNStateNode, NSObject))]
421    #[derive(Debug, PartialEq, Eq, Hash)]
422    pub struct MPSCNNConvolutionGradientStateNode;
423);
424
425extern_conformance!(
426    unsafe impl NSObjectProtocol for MPSCNNConvolutionGradientStateNode {}
427);
428
429impl MPSCNNConvolutionGradientStateNode {
430    extern_methods!();
431}
432
433/// Methods declared on superclass `MPSNNStateNode`.
434impl MPSCNNConvolutionGradientStateNode {
435    extern_methods!(
436        #[unsafe(method(init))]
437        #[unsafe(method_family = init)]
438        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
439    );
440}
441
442/// Methods declared on superclass `NSObject`.
443impl MPSCNNConvolutionGradientStateNode {
444    extern_methods!(
445        #[unsafe(method(new))]
446        #[unsafe(method_family = new)]
447        pub unsafe fn new() -> Retained<Self>;
448    );
449}
450
451extern_class!(
452    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposegradientstatenode?language=objc)
453    #[unsafe(super(
454        MPSCNNConvolutionGradientStateNode,
455        MPSNNGradientStateNode,
456        MPSNNStateNode,
457        NSObject
458    ))]
459    #[derive(Debug, PartialEq, Eq, Hash)]
460    pub struct MPSCNNConvolutionTransposeGradientStateNode;
461);
462
463extern_conformance!(
464    unsafe impl NSObjectProtocol for MPSCNNConvolutionTransposeGradientStateNode {}
465);
466
467impl MPSCNNConvolutionTransposeGradientStateNode {
468    extern_methods!();
469}
470
471/// Methods declared on superclass `MPSNNStateNode`.
472impl MPSCNNConvolutionTransposeGradientStateNode {
473    extern_methods!(
474        #[unsafe(method(init))]
475        #[unsafe(method_family = init)]
476        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
477    );
478}
479
480/// Methods declared on superclass `NSObject`.
481impl MPSCNNConvolutionTransposeGradientStateNode {
482    extern_methods!(
483        #[unsafe(method(new))]
484        #[unsafe(method_family = new)]
485        pub unsafe fn new() -> Retained<Self>;
486    );
487}
488
489extern_class!(
490    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnbinarygradientstatenode?language=objc)
491    #[unsafe(super(MPSNNStateNode, NSObject))]
492    #[derive(Debug, PartialEq, Eq, Hash)]
493    pub struct MPSNNBinaryGradientStateNode;
494);
495
496extern_conformance!(
497    unsafe impl NSObjectProtocol for MPSNNBinaryGradientStateNode {}
498);
499
500impl MPSNNBinaryGradientStateNode {
501    extern_methods!();
502}
503
504/// Methods declared on superclass `MPSNNStateNode`.
505impl MPSNNBinaryGradientStateNode {
506    extern_methods!(
507        #[unsafe(method(init))]
508        #[unsafe(method_family = init)]
509        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
510    );
511}
512
513/// Methods declared on superclass `NSObject`.
514impl MPSNNBinaryGradientStateNode {
515    extern_methods!(
516        #[unsafe(method(new))]
517        #[unsafe(method_family = new)]
518        pub unsafe fn new() -> Retained<Self>;
519    );
520}
521
522extern_class!(
523    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnmultiarygradientstatenode?language=objc)
524    #[unsafe(super(MPSNNStateNode, NSObject))]
525    #[derive(Debug, PartialEq, Eq, Hash)]
526    pub struct MPSNNMultiaryGradientStateNode;
527);
528
529extern_conformance!(
530    unsafe impl NSObjectProtocol for MPSNNMultiaryGradientStateNode {}
531);
532
533impl MPSNNMultiaryGradientStateNode {
534    extern_methods!();
535}
536
537/// Methods declared on superclass `MPSNNStateNode`.
538impl MPSNNMultiaryGradientStateNode {
539    extern_methods!(
540        #[unsafe(method(init))]
541        #[unsafe(method_family = init)]
542        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
543    );
544}
545
546/// Methods declared on superclass `NSObject`.
547impl MPSNNMultiaryGradientStateNode {
548    extern_methods!(
549        #[unsafe(method(new))]
550        #[unsafe(method_family = new)]
551        pub unsafe fn new() -> Retained<Self>;
552    );
553}
554
555extern_class!(
556    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnarithmeticgradientstatenode?language=objc)
557    #[unsafe(super(MPSNNBinaryGradientStateNode, MPSNNStateNode, NSObject))]
558    #[derive(Debug, PartialEq, Eq, Hash)]
559    pub struct MPSNNArithmeticGradientStateNode;
560);
561
562extern_conformance!(
563    unsafe impl NSObjectProtocol for MPSNNArithmeticGradientStateNode {}
564);
565
566impl MPSNNArithmeticGradientStateNode {
567    extern_methods!();
568}
569
570/// Methods declared on superclass `MPSNNStateNode`.
571impl MPSNNArithmeticGradientStateNode {
572    extern_methods!(
573        #[unsafe(method(init))]
574        #[unsafe(method_family = init)]
575        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
576    );
577}
578
579/// Methods declared on superclass `NSObject`.
580impl MPSNNArithmeticGradientStateNode {
581    extern_methods!(
582        #[unsafe(method(new))]
583        #[unsafe(method_family = new)]
584        pub unsafe fn new() -> Retained<Self>;
585    );
586}
587
588/// Block callback for customizing gradient nodes as they are constructed
589///
590/// Example code for copying handles from inference image nodes to corresponding gradient nodes:
591///
592/// ```text
593///               MPSNodeCustomizationBlock myCopyHandleBlock = ^( MPSNNFilterNode * __nonnull gradientNode,
594///                                                                MPSNNFilterNode * __nonnull inferenceNode,
595///                                                                MPSNNImageNode * __nonnull inferenceSource )
596///               {
597///                   gradientNode.resultImage.handle = inferenceSource.handle;
598///               }
599/// ```
600///
601///
602/// Parameter `gradientNode`: The new gradient node created to mirror inferenceNode
603///
604/// Parameter `inferenceNode`: The preexisting inference node mirrored by gradient node.
605/// If nil, an extra node was automatically inserted into the graph.
606/// An MPSNNAdditionNode may be inserted at junctions
607/// where multiple inference MPSNNFilterNodes read from the
608/// same MPSNNImageNode.
609///
610/// Parameter `inferenceSource`: The  source image argument to the inference node to which the gradient result corresponds
611///
612/// Parameter `gradientSource`: The source gradient argument to the new gradient node.
613///
614/// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsgradientnodeblock?language=objc)
615#[cfg(feature = "block2")]
616pub type MPSGradientNodeBlock = *mut block2::DynBlock<
617    dyn Fn(
618        NonNull<MPSNNFilterNode>,
619        NonNull<MPSNNFilterNode>,
620        NonNull<MPSNNImageNode>,
621        NonNull<MPSNNImageNode>,
622    ),
623>;
624
625extern_class!(
626    /// A placeholder node denoting a neural network filter stage
627    ///
628    /// There are as many MPSNNFilterNode subclasses as there are
629    /// MPS neural network filter objects. Make one of those.
630    /// This class defines an polymorphic interface for them.
631    ///
632    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnfilternode?language=objc)
633    #[unsafe(super(NSObject))]
634    #[derive(Debug, PartialEq, Eq, Hash)]
635    pub struct MPSNNFilterNode;
636);
637
638extern_conformance!(
639    unsafe impl NSObjectProtocol for MPSNNFilterNode {}
640);
641
642impl MPSNNFilterNode {
643    extern_methods!(
644        #[unsafe(method(init))]
645        #[unsafe(method_family = init)]
646        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
647
648        /// Get the node representing the image result of the filter
649        ///
650        /// Except where otherwise noted, the precision used for the
651        /// result image (see format property) is copied from the precision
652        /// from the first input image node.
653        #[unsafe(method(resultImage))]
654        #[unsafe(method_family = none)]
655        pub unsafe fn resultImage(&self) -> Retained<MPSNNImageNode>;
656
657        /// convenience method for resultStates[0]
658        ///
659        /// If resultStates is nil, returns nil
660        #[unsafe(method(resultState))]
661        #[unsafe(method_family = none)]
662        pub unsafe fn resultState(&self) -> Option<Retained<MPSNNStateNode>>;
663
664        /// Get the node representing the state result of the filter
665        ///
666        /// If more than one, see description of subclass for ordering.
667        #[unsafe(method(resultStates))]
668        #[unsafe(method_family = none)]
669        pub unsafe fn resultStates(&self) -> Option<Retained<NSArray<MPSNNStateNode>>>;
670
671        #[cfg(feature = "MPSNeuralNetworkTypes")]
672        /// The padding method used for the filter node
673        ///
674        /// The padding policy configures how the filter centers
675        /// the region of interest in the source image. It principally
676        /// is responsible for setting the MPSCNNKernel.offset and
677        /// the size of the image produced, and sometimes will also
678        /// configure .sourceFeatureChannelOffset, .sourceFeatureChannelMaxCount,
679        /// and .edgeMode.  It is permitted to set any other filter properties
680        /// as needed using a custom padding policy. The default padding
681        /// policy varies per filter to conform to consensus expectation for
682        /// the behavior of that filter.  In some cases, pre-made padding
683        /// policies are provided to match the behavior of common neural
684        /// networking frameworks with particularly complex or unexpected
685        /// behavior for specific nodes. See MPSNNDefaultPadding class methods
686        /// in MPSNeuralNetworkTypes.h for more.
687        ///
688        /// BUG: MPS doesn't provide a good way to reset the MPSKernel properties
689        /// in the context of a MPSNNGraph after the kernel is finished encoding.
690        /// These values carry on to the next time the graph is used. Consequently,
691        /// if your custom padding policy modifies the property as a function of the
692        /// previous value, e.g.:
693        ///
694        /// kernel.someProperty += 2;
695        ///
696        /// then the second time the graph runs, the property may have an inconsistent
697        /// value, leading to unexpected behavior. The default padding computation
698        /// runs before the custom padding method to provide it with a sense of
699        /// what is expected for the default configuration and will reinitialize the value
700        /// in the case of the .offset. However, that computation usually doesn't reset
701        /// other properties. In such cases, the custom padding policy may need to keep
702        /// a record of the original value to enable consistent behavior.
703        #[unsafe(method(paddingPolicy))]
704        #[unsafe(method_family = none)]
705        pub unsafe fn paddingPolicy(&self) -> Retained<ProtocolObject<dyn MPSNNPadding>>;
706
707        #[cfg(feature = "MPSNeuralNetworkTypes")]
708        /// Setter for [`paddingPolicy`][Self::paddingPolicy].
709        #[unsafe(method(setPaddingPolicy:))]
710        #[unsafe(method_family = none)]
711        pub unsafe fn setPaddingPolicy(&self, padding_policy: &ProtocolObject<dyn MPSNNPadding>);
712
713        /// A string to help identify this object.
714        #[unsafe(method(label))]
715        #[unsafe(method_family = none)]
716        pub unsafe fn label(&self) -> Option<Retained<NSString>>;
717
718        /// Setter for [`label`][Self::label].
719        ///
720        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
721        #[unsafe(method(setLabel:))]
722        #[unsafe(method_family = none)]
723        pub unsafe fn setLabel(&self, label: Option<&NSString>);
724
725        /// Return the gradient (backwards) version of this filter.
726        ///
727        /// The backwards training version of the filter will be returned.
728        /// The non-gradient image and state arguments for the filter are automatically
729        /// obtained from the target.
730        ///
731        /// Parameter `gradientImage`: The gradient images corresponding with the resultImage
732        /// of the target
733        #[unsafe(method(gradientFilterWithSource:))]
734        #[unsafe(method_family = none)]
735        pub unsafe fn gradientFilterWithSource(
736            &self,
737            gradient_image: &MPSNNImageNode,
738        ) -> Retained<MPSNNGradientFilterNode>;
739
740        /// Return the gradient (backwards) version of this filter.
741        ///
742        /// The backwards training version of the filter will be returned.
743        /// The non-gradient image and state arguments for the filter are automatically
744        /// obtained from the target.
745        ///
746        /// Parameter `gradientImages`: The gradient images corresponding with the resultImage
747        /// of the target
748        #[unsafe(method(gradientFilterWithSources:))]
749        #[unsafe(method_family = none)]
750        pub unsafe fn gradientFilterWithSources(
751            &self,
752            gradient_images: &NSArray<MPSNNImageNode>,
753        ) -> Retained<MPSNNGradientFilterNode>;
754
755        /// Return multiple gradient versions of the filter
756        ///
757        /// MPSNNFilters that consume multiple inputs generally result in
758        /// multiple conjugate filters for the gradient computation at
759        /// the end of training. For example, a single concatenation operation
760        /// that concatenates multple images will result in an array of slice
761        /// operators that carve out subsections of the input gradient image.
762        #[unsafe(method(gradientFiltersWithSources:))]
763        #[unsafe(method_family = none)]
764        pub unsafe fn gradientFiltersWithSources(
765            &self,
766            gradient_images: &NSArray<MPSNNImageNode>,
767        ) -> Retained<NSArray<MPSNNGradientFilterNode>>;
768
769        /// Return multiple gradient versions of the filter
770        ///
771        /// MPSNNFilters that consume multiple inputs generally result in
772        /// multiple conjugate filters for the gradient computation at
773        /// the end of training. For example, a single concatenation operation
774        /// that concatenates multple images will result in an array of slice
775        /// operators that carve out subsections of the input gradient image.
776        #[unsafe(method(gradientFiltersWithSource:))]
777        #[unsafe(method_family = none)]
778        pub unsafe fn gradientFiltersWithSource(
779            &self,
780            gradient_image: &MPSNNImageNode,
781        ) -> Retained<NSArray<MPSNNGradientFilterNode>>;
782
783        #[cfg(feature = "block2")]
784        /// Build training graph from inference graph
785        ///
786        /// This method will iteratively build the training portion of a graph based
787        /// on an inference graph. Self should be the last node in the
788        /// inference graph. It is typically a loss layer, but can be anything.
789        /// Typically, the "inference graph" used here is the desired inference
790        /// graph with a dropout node and a loss layer node appended.
791        ///
792        /// The nodes that are created will have default properties. In certain cases,
793        /// these may not be appropriate (e.g. if you want to do CPU based updates
794        /// of convolution weights instead of default GPU updates.) In such cases, your
795        /// application should use the nodeHandler to configure the new nodes as they are
796        /// created.
797        ///
798        /// BUG: This method can not follow links to regions of the graph that are
799        /// connected to the rest of the graph solely via MPSNNStateNodes. A gradient
800        /// image input is required to construct a MPSNNGradientFilterNode from a
801        /// inference filter node.
802        ///
803        ///
804        /// Parameter `gradientImage`: The input gradient image for the first gradient
805        /// node in the training section of the graph. If nil,
806        /// self.resultImage is used. This results in a standard monolithic
807        /// training graph. If the graph is instead divided into multiple
808        /// subgraphs (potentially to allow for your custom code to appear
809        /// inbetween MPSNNGraph segments) a new MPSImageNode*
810        /// may be substituted.
811        ///
812        /// Parameter `nodeHandler`: An optional block to allow for customization of gradient
813        /// nodes and intermediate images as the graph is constructed.
814        /// It may also be used to prune braches of the developing
815        /// training graph. If nil, the default handler is used. It builds
816        /// the full graph, and assigns any inferenceNodeSources[i].handle
817        /// to their gradient counterparts.
818        ///
819        /// Returns: The list of new MPSNNFilterNode training graph termini. These MPSNNFilterNodes
820        /// are not necessarily all MPSNNGradientFilterNodes. To build a full list of nodes
821        /// created, use a custom nodeHandler. If no nodes are created nil is returned.
822        ///
823        /// # Safety
824        ///
825        /// `node_handler` must be a valid pointer or null.
826        #[unsafe(method(trainingGraphWithSourceGradient:nodeHandler:))]
827        #[unsafe(method_family = none)]
828        pub unsafe fn trainingGraphWithSourceGradient_nodeHandler(
829            &self,
830            gradient_image: Option<&MPSNNImageNode>,
831            node_handler: MPSGradientNodeBlock,
832        ) -> Option<Retained<NSArray<MPSNNFilterNode>>>;
833    );
834}
835
836/// Methods declared on superclass `NSObject`.
837impl MPSNNFilterNode {
838    extern_methods!(
839        #[unsafe(method(new))]
840        #[unsafe(method_family = new)]
841        pub unsafe fn new() -> Retained<Self>;
842    );
843}
844
845extern_class!(
846    /// For each MPSNNFilterNode, there is a corresponding MPSNNGradientFilterNode
847    /// used for training that back propagates image gradients to refine the
848    /// various parameters in each node. Generally, it takes as input a gradient
849    /// corresponding to the result image from the MPSNNFilterNode and returns
850    /// a gradient image corresponding to the source image of the MPSNNFilterNode.
851    /// In addition, there is generally a MPSNNState produced by the MPSNNFilterNode
852    /// that is consumed by the MPSNNGradientNode and the MPSNNGradientNode generally
853    /// needs to look at the MPSNNFilterNode source image.
854    ///
855    /// If you have a simple method to traverse your inference graph backwards, then
856    /// -[MPSNNFilterNode gradientFilterWithSource:] is a simple way to construct
857    /// these.
858    ///
859    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngradientfilternode?language=objc)
860    #[unsafe(super(MPSNNFilterNode, NSObject))]
861    #[derive(Debug, PartialEq, Eq, Hash)]
862    pub struct MPSNNGradientFilterNode;
863);
864
865extern_conformance!(
866    unsafe impl NSObjectProtocol for MPSNNGradientFilterNode {}
867);
868
869impl MPSNNGradientFilterNode {
870    extern_methods!(
871        #[unsafe(method(gradientFilterWithSources:))]
872        #[unsafe(method_family = none)]
873        pub unsafe fn gradientFilterWithSources(
874            &self,
875            source_gradient: &NSArray<MPSNNImageNode>,
876        ) -> Retained<MPSNNGradientFilterNode>;
877
878        #[unsafe(method(gradientFiltersWithSources:))]
879        #[unsafe(method_family = none)]
880        pub unsafe fn gradientFiltersWithSources(
881            &self,
882            source_gradient: &NSArray<MPSNNImageNode>,
883        ) -> Retained<NSArray<MPSNNGradientFilterNode>>;
884
885        #[unsafe(method(gradientFilterWithSource:))]
886        #[unsafe(method_family = none)]
887        pub unsafe fn gradientFilterWithSource(
888            &self,
889            source_gradient: &MPSNNImageNode,
890        ) -> Retained<MPSNNGradientFilterNode>;
891
892        #[unsafe(method(gradientFiltersWithSource:))]
893        #[unsafe(method_family = none)]
894        pub unsafe fn gradientFiltersWithSource(
895            &self,
896            source_gradient: &MPSNNImageNode,
897        ) -> Retained<NSArray<MPSNNGradientFilterNode>>;
898    );
899}
900
901/// Methods declared on superclass `MPSNNFilterNode`.
902impl MPSNNGradientFilterNode {
903    extern_methods!(
904        #[unsafe(method(init))]
905        #[unsafe(method_family = init)]
906        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
907    );
908}
909
910/// Methods declared on superclass `NSObject`.
911impl MPSNNGradientFilterNode {
912    extern_methods!(
913        #[unsafe(method(new))]
914        #[unsafe(method_family = new)]
915        pub unsafe fn new() -> Retained<Self>;
916    );
917}
918
919extern_class!(
920    /// A MPSNNFilterNode representing a MPSCNNConvolution kernel
921    ///
922    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutionnode?language=objc)
923    #[unsafe(super(MPSNNFilterNode, NSObject))]
924    #[derive(Debug, PartialEq, Eq, Hash)]
925    pub struct MPSCNNConvolutionNode;
926);
927
928extern_conformance!(
929    unsafe impl MPSNNTrainableNode for MPSCNNConvolutionNode {}
930);
931
932extern_conformance!(
933    unsafe impl NSObjectProtocol for MPSCNNConvolutionNode {}
934);
935
936impl MPSCNNConvolutionNode {
937    extern_methods!(
938        #[cfg(feature = "MPSNeuralNetworkTypes")]
939        /// The training style of the forward node will be propagated to gradient nodes made from it
940        #[unsafe(method(trainingStyle))]
941        #[unsafe(method_family = none)]
942        pub unsafe fn trainingStyle(&self) -> MPSNNTrainingStyle;
943
944        #[cfg(feature = "MPSNeuralNetworkTypes")]
945        /// Setter for [`trainingStyle`][Self::trainingStyle].
946        #[unsafe(method(setTrainingStyle:))]
947        #[unsafe(method_family = none)]
948        pub unsafe fn setTrainingStyle(&self, training_style: MPSNNTrainingStyle);
949
950        #[cfg(feature = "MPSNeuralNetworkTypes")]
951        /// Set the floating-point precision used by the convolution accumulator
952        ///
953        /// Default:  MPSNNConvolutionAccumulatorPrecisionOptionFloat
954        #[unsafe(method(accumulatorPrecision))]
955        #[unsafe(method_family = none)]
956        pub unsafe fn accumulatorPrecision(&self) -> MPSNNConvolutionAccumulatorPrecisionOption;
957
958        #[cfg(feature = "MPSNeuralNetworkTypes")]
959        /// Setter for [`accumulatorPrecision`][Self::accumulatorPrecision].
960        #[unsafe(method(setAccumulatorPrecision:))]
961        #[unsafe(method_family = none)]
962        pub unsafe fn setAccumulatorPrecision(
963            &self,
964            accumulator_precision: MPSNNConvolutionAccumulatorPrecisionOption,
965        );
966
967        #[cfg(feature = "MPSCNNConvolution")]
968        /// Init an autoreleased not representing a MPSCNNConvolution kernel
969        ///
970        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
971        ///
972        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
973        /// protocol. This object is provided by you to encapsulate storage for
974        /// convolution weights and biases. If it is used for training, it may not
975        /// have a neuron embedded in the convolution descriptor.
976        ///
977        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
978        #[unsafe(method(nodeWithSource:weights:))]
979        #[unsafe(method_family = none)]
980        pub unsafe fn nodeWithSource_weights(
981            source_node: &MPSNNImageNode,
982            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
983        ) -> Retained<Self>;
984
985        #[cfg(feature = "MPSCNNConvolution")]
986        /// Init a node representing a MPSCNNConvolution kernel
987        ///
988        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
989        ///
990        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
991        /// protocol. This object is provided by you to encapsulate storage for
992        /// convolution weights and biases. If it is used for training, it may not
993        /// have a neuron embedded in the convolution descriptor.
994        ///
995        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
996        #[unsafe(method(initWithSource:weights:))]
997        #[unsafe(method_family = init)]
998        pub unsafe fn initWithSource_weights(
999            this: Allocated<Self>,
1000            source_node: &MPSNNImageNode,
1001            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1002        ) -> Retained<Self>;
1003
1004        /// A node to represent a MPSCNNConvolutionGradientState object
1005        ///
1006        /// Use this if the convolution is mirrored by a convolution transpose node
1007        /// later on in the graph to make sure that the size of the image returned
1008        /// from the convolution transpose matches the size of the image passed in
1009        /// to this node.
1010        #[unsafe(method(convolutionGradientState))]
1011        #[unsafe(method_family = none)]
1012        pub unsafe fn convolutionGradientState(
1013            &self,
1014        ) -> Option<Retained<MPSCNNConvolutionGradientStateNode>>;
1015    );
1016}
1017
1018/// Methods declared on superclass `MPSNNFilterNode`.
1019impl MPSCNNConvolutionNode {
1020    extern_methods!(
1021        #[unsafe(method(init))]
1022        #[unsafe(method_family = init)]
1023        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1024    );
1025}
1026
1027/// Methods declared on superclass `NSObject`.
1028impl MPSCNNConvolutionNode {
1029    extern_methods!(
1030        #[unsafe(method(new))]
1031        #[unsafe(method_family = new)]
1032        pub unsafe fn new() -> Retained<Self>;
1033    );
1034}
1035
1036extern_class!(
1037    /// A MPSNNFilterNode representing a MPSCNNFullyConnected kernel
1038    ///
1039    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnfullyconnectednode?language=objc)
1040    #[unsafe(super(MPSCNNConvolutionNode, MPSNNFilterNode, NSObject))]
1041    #[derive(Debug, PartialEq, Eq, Hash)]
1042    pub struct MPSCNNFullyConnectedNode;
1043);
1044
1045extern_conformance!(
1046    unsafe impl MPSNNTrainableNode for MPSCNNFullyConnectedNode {}
1047);
1048
1049extern_conformance!(
1050    unsafe impl NSObjectProtocol for MPSCNNFullyConnectedNode {}
1051);
1052
1053impl MPSCNNFullyConnectedNode {
1054    extern_methods!(
1055        #[cfg(feature = "MPSCNNConvolution")]
1056        /// Init an autoreleased not representing a MPSCNNFullyConnected kernel
1057        ///
1058        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1059        ///
1060        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1061        /// protocol. This object is provided by you to encapsulate storage for
1062        /// convolution weights and biases.
1063        ///
1064        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1065        #[unsafe(method(nodeWithSource:weights:))]
1066        #[unsafe(method_family = none)]
1067        pub unsafe fn nodeWithSource_weights(
1068            source_node: &MPSNNImageNode,
1069            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1070        ) -> Retained<Self>;
1071
1072        #[cfg(feature = "MPSCNNConvolution")]
1073        /// Init a node representing a MPSCNNFullyConnected kernel
1074        ///
1075        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1076        ///
1077        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1078        /// protocol. This object is provided by you to encapsulate storage for
1079        /// convolution weights and biases.
1080        ///
1081        /// Returns: A new MPSNNFilter node for a MPSCNNFullyConnected kernel.
1082        #[unsafe(method(initWithSource:weights:))]
1083        #[unsafe(method_family = init)]
1084        pub unsafe fn initWithSource_weights(
1085            this: Allocated<Self>,
1086            source_node: &MPSNNImageNode,
1087            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1088        ) -> Retained<Self>;
1089    );
1090}
1091
1092/// Methods declared on superclass `MPSNNFilterNode`.
1093impl MPSCNNFullyConnectedNode {
1094    extern_methods!(
1095        #[unsafe(method(init))]
1096        #[unsafe(method_family = init)]
1097        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1098    );
1099}
1100
1101/// Methods declared on superclass `NSObject`.
1102impl MPSCNNFullyConnectedNode {
1103    extern_methods!(
1104        #[unsafe(method(new))]
1105        #[unsafe(method_family = new)]
1106        pub unsafe fn new() -> Retained<Self>;
1107    );
1108}
1109
1110extern_class!(
1111    /// A MPSNNFilterNode representing a MPSCNNBinaryConvolution kernel
1112    ///
1113    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnbinaryconvolutionnode?language=objc)
1114    #[unsafe(super(MPSCNNConvolutionNode, MPSNNFilterNode, NSObject))]
1115    #[derive(Debug, PartialEq, Eq, Hash)]
1116    pub struct MPSCNNBinaryConvolutionNode;
1117);
1118
1119extern_conformance!(
1120    unsafe impl MPSNNTrainableNode for MPSCNNBinaryConvolutionNode {}
1121);
1122
1123extern_conformance!(
1124    unsafe impl NSObjectProtocol for MPSCNNBinaryConvolutionNode {}
1125);
1126
1127impl MPSCNNBinaryConvolutionNode {
1128    extern_methods!(
1129        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1130        /// Init an autoreleased node representing a MPSCNNBinaryConvolution kernel
1131        ///
1132        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1133        ///
1134        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1135        /// protocol. This object is provided by you to encapsulate storage for
1136        /// convolution weights and biases.
1137        ///
1138        /// Parameter `scaleValue`: A floating point value used to scale the entire convolution.
1139        ///
1140        /// Parameter `type`: What kind of binarization strategy is to be used.
1141        ///
1142        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1143        ///
1144        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryConvolution kernel.
1145        #[unsafe(method(nodeWithSource:weights:scaleValue:type:flags:))]
1146        #[unsafe(method_family = none)]
1147        pub unsafe fn nodeWithSource_weights_scaleValue_type_flags(
1148            source_node: &MPSNNImageNode,
1149            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1150            scale_value: c_float,
1151            r#type: MPSCNNBinaryConvolutionType,
1152            flags: MPSCNNBinaryConvolutionFlags,
1153        ) -> Retained<Self>;
1154
1155        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1156        /// Init a node representing a MPSCNNBinaryConvolution kernel
1157        ///
1158        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1159        ///
1160        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1161        /// protocol. This object is provided by you to encapsulate storage for
1162        /// convolution weights and biases.
1163        ///
1164        /// Parameter `scaleValue`: A floating point value used to scale the entire convolution.
1165        ///
1166        /// Parameter `type`: What kind of binarization strategy is to be used.
1167        ///
1168        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1169        ///
1170        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryConvolution kernel.
1171        #[unsafe(method(initWithSource:weights:scaleValue:type:flags:))]
1172        #[unsafe(method_family = init)]
1173        pub unsafe fn initWithSource_weights_scaleValue_type_flags(
1174            this: Allocated<Self>,
1175            source_node: &MPSNNImageNode,
1176            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1177            scale_value: c_float,
1178            r#type: MPSCNNBinaryConvolutionType,
1179            flags: MPSCNNBinaryConvolutionFlags,
1180        ) -> Retained<Self>;
1181
1182        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1183        /// Init an autoreleased node representing a MPSCNNBinaryConvolution kernel
1184        ///
1185        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1186        ///
1187        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1188        /// protocol. This object is provided by you to encapsulate storage for
1189        /// convolution weights and biases.
1190        ///
1191        /// Parameter `outputBiasTerms`: A pointer to bias terms to be applied to the convolution output.
1192        /// See MPSCNNBinaryConvolution for more details.
1193        ///
1194        /// Parameter `outputScaleTerms`: A pointer to scale terms to be applied to binary convolution
1195        /// results per output feature channel. See MPSCNNBinaryConvolution for more details.
1196        ///
1197        /// Parameter `inputBiasTerms`: A pointer to offset terms to be applied to the input before convolution and
1198        /// before input scaling. See MPSCNNBinaryConvolution for more details.
1199        ///
1200        /// Parameter `inputScaleTerms`: A pointer to scale terms to be applied to the input before convolution,
1201        /// but after input biasing. See MPSCNNBinaryConvolution for more details.
1202        ///
1203        /// Parameter `type`: What kind of binarization strategy is to be used.
1204        ///
1205        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1206        ///
1207        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryConvolution kernel.
1208        ///
1209        /// # Safety
1210        ///
1211        /// - `output_bias_terms` must be a valid pointer or null.
1212        /// - `output_scale_terms` must be a valid pointer or null.
1213        /// - `input_bias_terms` must be a valid pointer or null.
1214        /// - `input_scale_terms` must be a valid pointer or null.
1215        #[unsafe(method(nodeWithSource:weights:outputBiasTerms:outputScaleTerms:inputBiasTerms:inputScaleTerms:type:flags:))]
1216        #[unsafe(method_family = none)]
1217        pub unsafe fn nodeWithSource_weights_outputBiasTerms_outputScaleTerms_inputBiasTerms_inputScaleTerms_type_flags(
1218            source_node: &MPSNNImageNode,
1219            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1220            output_bias_terms: *const c_float,
1221            output_scale_terms: *const c_float,
1222            input_bias_terms: *const c_float,
1223            input_scale_terms: *const c_float,
1224            r#type: MPSCNNBinaryConvolutionType,
1225            flags: MPSCNNBinaryConvolutionFlags,
1226        ) -> Retained<Self>;
1227
1228        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1229        /// Init a node representing a MPSCNNBinaryConvolution kernel
1230        ///
1231        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1232        ///
1233        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1234        /// protocol. This object is provided by you to encapsulate storage for
1235        /// convolution weights and biases.
1236        ///
1237        /// Parameter `outputBiasTerms`: A pointer to bias terms to be applied to the convolution output.
1238        /// See MPSCNNBinaryConvolution for more details.
1239        ///
1240        /// Parameter `outputScaleTerms`: A pointer to scale terms to be applied to binary convolution
1241        /// results per output feature channel. See MPSCNNBinaryConvolution for more details.
1242        ///
1243        /// Parameter `inputBiasTerms`: A pointer to offset terms to be applied to the input before convolution and
1244        /// before input scaling. See MPSCNNBinaryConvolution for more details.
1245        ///
1246        /// Parameter `inputScaleTerms`: A pointer to scale terms to be applied to the input before convolution,
1247        /// but after input biasing. See MPSCNNBinaryConvolution for more details.
1248        ///
1249        /// Parameter `type`: What kind of binarization strategy is to be used.
1250        ///
1251        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1252        ///
1253        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryConvolution kernel.
1254        ///
1255        /// # Safety
1256        ///
1257        /// - `output_bias_terms` must be a valid pointer or null.
1258        /// - `output_scale_terms` must be a valid pointer or null.
1259        /// - `input_bias_terms` must be a valid pointer or null.
1260        /// - `input_scale_terms` must be a valid pointer or null.
1261        #[unsafe(method(initWithSource:weights:outputBiasTerms:outputScaleTerms:inputBiasTerms:inputScaleTerms:type:flags:))]
1262        #[unsafe(method_family = init)]
1263        pub unsafe fn initWithSource_weights_outputBiasTerms_outputScaleTerms_inputBiasTerms_inputScaleTerms_type_flags(
1264            this: Allocated<Self>,
1265            source_node: &MPSNNImageNode,
1266            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1267            output_bias_terms: *const c_float,
1268            output_scale_terms: *const c_float,
1269            input_bias_terms: *const c_float,
1270            input_scale_terms: *const c_float,
1271            r#type: MPSCNNBinaryConvolutionType,
1272            flags: MPSCNNBinaryConvolutionFlags,
1273        ) -> Retained<Self>;
1274
1275        /// unavailable
1276        #[unsafe(method(convolutionGradientState))]
1277        #[unsafe(method_family = none)]
1278        pub unsafe fn convolutionGradientState(
1279            &self,
1280        ) -> Option<Retained<MPSCNNConvolutionGradientStateNode>>;
1281    );
1282}
1283
1284/// Methods declared on superclass `MPSCNNConvolutionNode`.
1285impl MPSCNNBinaryConvolutionNode {
1286    extern_methods!(
1287        #[cfg(feature = "MPSCNNConvolution")]
1288        /// Init an autoreleased not representing a MPSCNNConvolution kernel
1289        ///
1290        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1291        ///
1292        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1293        /// protocol. This object is provided by you to encapsulate storage for
1294        /// convolution weights and biases. If it is used for training, it may not
1295        /// have a neuron embedded in the convolution descriptor.
1296        ///
1297        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1298        #[unsafe(method(nodeWithSource:weights:))]
1299        #[unsafe(method_family = none)]
1300        pub unsafe fn nodeWithSource_weights(
1301            source_node: &MPSNNImageNode,
1302            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1303        ) -> Retained<Self>;
1304
1305        #[cfg(feature = "MPSCNNConvolution")]
1306        /// Init a node representing a MPSCNNConvolution kernel
1307        ///
1308        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1309        ///
1310        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1311        /// protocol. This object is provided by you to encapsulate storage for
1312        /// convolution weights and biases. If it is used for training, it may not
1313        /// have a neuron embedded in the convolution descriptor.
1314        ///
1315        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1316        #[unsafe(method(initWithSource:weights:))]
1317        #[unsafe(method_family = init)]
1318        pub unsafe fn initWithSource_weights(
1319            this: Allocated<Self>,
1320            source_node: &MPSNNImageNode,
1321            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1322        ) -> Retained<Self>;
1323    );
1324}
1325
1326/// Methods declared on superclass `MPSNNFilterNode`.
1327impl MPSCNNBinaryConvolutionNode {
1328    extern_methods!(
1329        #[unsafe(method(init))]
1330        #[unsafe(method_family = init)]
1331        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1332    );
1333}
1334
1335/// Methods declared on superclass `NSObject`.
1336impl MPSCNNBinaryConvolutionNode {
1337    extern_methods!(
1338        #[unsafe(method(new))]
1339        #[unsafe(method_family = new)]
1340        pub unsafe fn new() -> Retained<Self>;
1341    );
1342}
1343
1344extern_class!(
1345    /// A MPSNNFilterNode representing a MPSCNNBinaryFullyConnected kernel
1346    ///
1347    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnbinaryfullyconnectednode?language=objc)
1348    #[unsafe(super(
1349        MPSCNNBinaryConvolutionNode,
1350        MPSCNNConvolutionNode,
1351        MPSNNFilterNode,
1352        NSObject
1353    ))]
1354    #[derive(Debug, PartialEq, Eq, Hash)]
1355    pub struct MPSCNNBinaryFullyConnectedNode;
1356);
1357
1358extern_conformance!(
1359    unsafe impl MPSNNTrainableNode for MPSCNNBinaryFullyConnectedNode {}
1360);
1361
1362extern_conformance!(
1363    unsafe impl NSObjectProtocol for MPSCNNBinaryFullyConnectedNode {}
1364);
1365
1366impl MPSCNNBinaryFullyConnectedNode {
1367    extern_methods!(
1368        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1369        /// Init an autoreleased node representing a MPSCNNBinaryFullyConnected kernel
1370        ///
1371        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1372        ///
1373        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1374        /// protocol. This object is provided by you to encapsulate storage for
1375        /// convolution weights and biases.
1376        ///
1377        /// Parameter `scaleValue`: A floating point value used to scale the entire convolution.
1378        ///
1379        /// Parameter `type`: What kind of binarization strategy is to be used.
1380        ///
1381        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1382        ///
1383        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryFullyConnected kernel.
1384        #[unsafe(method(nodeWithSource:weights:scaleValue:type:flags:))]
1385        #[unsafe(method_family = none)]
1386        pub unsafe fn nodeWithSource_weights_scaleValue_type_flags(
1387            source_node: &MPSNNImageNode,
1388            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1389            scale_value: c_float,
1390            r#type: MPSCNNBinaryConvolutionType,
1391            flags: MPSCNNBinaryConvolutionFlags,
1392        ) -> Retained<Self>;
1393
1394        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1395        /// Init a node representing a MPSCNNBinaryFullyConnected kernel
1396        ///
1397        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1398        ///
1399        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1400        /// protocol. This object is provided by you to encapsulate storage for
1401        /// convolution weights and biases.
1402        ///
1403        /// Parameter `scaleValue`: A floating point value used to scale the entire convolution.
1404        ///
1405        /// Parameter `type`: What kind of binarization strategy is to be used.
1406        ///
1407        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1408        ///
1409        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryFullyConnected kernel.
1410        #[unsafe(method(initWithSource:weights:scaleValue:type:flags:))]
1411        #[unsafe(method_family = init)]
1412        pub unsafe fn initWithSource_weights_scaleValue_type_flags(
1413            this: Allocated<Self>,
1414            source_node: &MPSNNImageNode,
1415            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1416            scale_value: c_float,
1417            r#type: MPSCNNBinaryConvolutionType,
1418            flags: MPSCNNBinaryConvolutionFlags,
1419        ) -> Retained<Self>;
1420
1421        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1422        /// Init an autoreleased node representing a MPSCNNBinaryFullyConnected kernel
1423        ///
1424        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1425        ///
1426        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1427        /// protocol. This object is provided by you to encapsulate storage for
1428        /// convolution weights and biases.
1429        ///
1430        /// Parameter `outputBiasTerms`: A pointer to bias terms to be applied to the convolution output.
1431        /// See MPSCNNBinaryConvolution for more details.
1432        ///
1433        /// Parameter `outputScaleTerms`: A pointer to scale terms to be applied to binary convolution
1434        /// results per output feature channel. See MPSCNNBinaryConvolution for more details.
1435        ///
1436        /// Parameter `inputBiasTerms`: A pointer to offset terms to be applied to the input before convolution and
1437        /// before input scaling. See MPSCNNBinaryConvolution for more details.
1438        ///
1439        /// Parameter `inputScaleTerms`: A pointer to scale terms to be applied to the input before convolution,
1440        /// but after input biasing. See MPSCNNBinaryConvolution for more details.
1441        ///
1442        /// Parameter `type`: What kind of binarization strategy is to be used.
1443        ///
1444        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1445        ///
1446        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryFullyConnected kernel.
1447        ///
1448        /// # Safety
1449        ///
1450        /// - `output_bias_terms` must be a valid pointer or null.
1451        /// - `output_scale_terms` must be a valid pointer or null.
1452        /// - `input_bias_terms` must be a valid pointer or null.
1453        /// - `input_scale_terms` must be a valid pointer or null.
1454        #[unsafe(method(nodeWithSource:weights:outputBiasTerms:outputScaleTerms:inputBiasTerms:inputScaleTerms:type:flags:))]
1455        #[unsafe(method_family = none)]
1456        pub unsafe fn nodeWithSource_weights_outputBiasTerms_outputScaleTerms_inputBiasTerms_inputScaleTerms_type_flags(
1457            source_node: &MPSNNImageNode,
1458            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1459            output_bias_terms: *const c_float,
1460            output_scale_terms: *const c_float,
1461            input_bias_terms: *const c_float,
1462            input_scale_terms: *const c_float,
1463            r#type: MPSCNNBinaryConvolutionType,
1464            flags: MPSCNNBinaryConvolutionFlags,
1465        ) -> Retained<Self>;
1466
1467        #[cfg(all(feature = "MPSCNNConvolution", feature = "MPSNeuralNetworkTypes"))]
1468        /// Init a node representing a MPSCNNBinaryFullyConnected kernel
1469        ///
1470        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1471        ///
1472        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1473        /// protocol. This object is provided by you to encapsulate storage for
1474        /// convolution weights and biases.
1475        ///
1476        /// Parameter `outputBiasTerms`: A pointer to bias terms to be applied to the convolution output.
1477        /// See MPSCNNBinaryConvolution for more details.
1478        ///
1479        /// Parameter `outputScaleTerms`: A pointer to scale terms to be applied to binary convolution
1480        /// results per output feature channel. See MPSCNNBinaryConvolution for more details.
1481        ///
1482        /// Parameter `inputBiasTerms`: A pointer to offset terms to be applied to the input before convolution and
1483        /// before input scaling. See MPSCNNBinaryConvolution for more details.
1484        ///
1485        /// Parameter `inputScaleTerms`: A pointer to scale terms to be applied to the input before convolution,
1486        /// but after input biasing. See MPSCNNBinaryConvolution for more details.
1487        ///
1488        /// Parameter `type`: What kind of binarization strategy is to be used.
1489        ///
1490        /// Parameter `flags`: See documentation of MPSCNNBinaryConvolutionFlags.
1491        ///
1492        /// Returns: A new MPSNNFilter node for a MPSCNNBinaryFullyConnected kernel.
1493        ///
1494        /// # Safety
1495        ///
1496        /// - `output_bias_terms` must be a valid pointer or null.
1497        /// - `output_scale_terms` must be a valid pointer or null.
1498        /// - `input_bias_terms` must be a valid pointer or null.
1499        /// - `input_scale_terms` must be a valid pointer or null.
1500        #[unsafe(method(initWithSource:weights:outputBiasTerms:outputScaleTerms:inputBiasTerms:inputScaleTerms:type:flags:))]
1501        #[unsafe(method_family = init)]
1502        pub unsafe fn initWithSource_weights_outputBiasTerms_outputScaleTerms_inputBiasTerms_inputScaleTerms_type_flags(
1503            this: Allocated<Self>,
1504            source_node: &MPSNNImageNode,
1505            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1506            output_bias_terms: *const c_float,
1507            output_scale_terms: *const c_float,
1508            input_bias_terms: *const c_float,
1509            input_scale_terms: *const c_float,
1510            r#type: MPSCNNBinaryConvolutionType,
1511            flags: MPSCNNBinaryConvolutionFlags,
1512        ) -> Retained<Self>;
1513    );
1514}
1515
1516/// Methods declared on superclass `MPSCNNConvolutionNode`.
1517impl MPSCNNBinaryFullyConnectedNode {
1518    extern_methods!(
1519        #[cfg(feature = "MPSCNNConvolution")]
1520        /// Init an autoreleased not representing a MPSCNNConvolution kernel
1521        ///
1522        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1523        ///
1524        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1525        /// protocol. This object is provided by you to encapsulate storage for
1526        /// convolution weights and biases. If it is used for training, it may not
1527        /// have a neuron embedded in the convolution descriptor.
1528        ///
1529        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1530        #[unsafe(method(nodeWithSource:weights:))]
1531        #[unsafe(method_family = none)]
1532        pub unsafe fn nodeWithSource_weights(
1533            source_node: &MPSNNImageNode,
1534            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1535        ) -> Retained<Self>;
1536
1537        #[cfg(feature = "MPSCNNConvolution")]
1538        /// Init a node representing a MPSCNNConvolution kernel
1539        ///
1540        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1541        ///
1542        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1543        /// protocol. This object is provided by you to encapsulate storage for
1544        /// convolution weights and biases. If it is used for training, it may not
1545        /// have a neuron embedded in the convolution descriptor.
1546        ///
1547        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1548        #[unsafe(method(initWithSource:weights:))]
1549        #[unsafe(method_family = init)]
1550        pub unsafe fn initWithSource_weights(
1551            this: Allocated<Self>,
1552            source_node: &MPSNNImageNode,
1553            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1554        ) -> Retained<Self>;
1555    );
1556}
1557
1558/// Methods declared on superclass `MPSNNFilterNode`.
1559impl MPSCNNBinaryFullyConnectedNode {
1560    extern_methods!(
1561        #[unsafe(method(init))]
1562        #[unsafe(method_family = init)]
1563        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1564    );
1565}
1566
1567/// Methods declared on superclass `NSObject`.
1568impl MPSCNNBinaryFullyConnectedNode {
1569    extern_methods!(
1570        #[unsafe(method(new))]
1571        #[unsafe(method_family = new)]
1572        pub unsafe fn new() -> Retained<Self>;
1573    );
1574}
1575
1576extern_class!(
1577    /// A MPSNNFilterNode representing a MPSCNNConvolutionTranspose kernel
1578    ///
1579    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposenode?language=objc)
1580    #[unsafe(super(MPSCNNConvolutionNode, MPSNNFilterNode, NSObject))]
1581    #[derive(Debug, PartialEq, Eq, Hash)]
1582    pub struct MPSCNNConvolutionTransposeNode;
1583);
1584
1585extern_conformance!(
1586    unsafe impl MPSNNTrainableNode for MPSCNNConvolutionTransposeNode {}
1587);
1588
1589extern_conformance!(
1590    unsafe impl NSObjectProtocol for MPSCNNConvolutionTransposeNode {}
1591);
1592
1593impl MPSCNNConvolutionTransposeNode {
1594    extern_methods!(
1595        #[cfg(feature = "MPSCNNConvolution")]
1596        /// Init an autoreleased not representing a MPSCNNConvolutionTransposeNode kernel
1597        ///
1598        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1599        ///
1600        /// Parameter `convolutionGradientState`: When the convolution transpose is used to 'undo' an earlier convolution
1601        /// in the graph, it is generally desired that the output image be the same
1602        /// size as the input image to the earlier convolution. You may optionally
1603        /// specify this size identity by passing in the MPSNNConvolutionGradientStateNode
1604        /// created by the convolution node here.
1605        ///
1606        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1607        /// protocol. This object is provided by you to encapsulate storage for
1608        /// convolution weights and biases.
1609        ///
1610        /// Returns: A new MPSNNFilter node for a MPSCNNConvolutionTransposeNode kernel.
1611        #[unsafe(method(nodeWithSource:convolutionGradientState:weights:))]
1612        #[unsafe(method_family = none)]
1613        pub unsafe fn nodeWithSource_convolutionGradientState_weights(
1614            source_node: &MPSNNImageNode,
1615            convolution_gradient_state: Option<&MPSCNNConvolutionGradientStateNode>,
1616            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1617        ) -> Retained<Self>;
1618
1619        #[cfg(feature = "MPSCNNConvolution")]
1620        /// Init a node representing a MPSCNNConvolutionTransposeNode kernel
1621        ///
1622        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1623        ///
1624        /// Parameter `convolutionGradientState`: When the convolution transpose is used to 'undo' an earlier convolution
1625        /// in the graph, it is generally desired that the output image be the same
1626        /// size as the input image to the earlier convolution. You may optionally
1627        /// specify this size identity by passing in the MPSCNNConvolutionGradientState node
1628        /// here.
1629        ///
1630        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1631        /// protocol. This object is provided by you to encapsulate storage for
1632        /// convolution weights and biases.
1633        ///
1634        /// Returns: A new MPSNNFilter node for a MPSCNNConvolutionTransposeNode kernel.
1635        #[unsafe(method(initWithSource:convolutionGradientState:weights:))]
1636        #[unsafe(method_family = init)]
1637        pub unsafe fn initWithSource_convolutionGradientState_weights(
1638            this: Allocated<Self>,
1639            source_node: &MPSNNImageNode,
1640            convolution_gradient_state: Option<&MPSCNNConvolutionGradientStateNode>,
1641            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1642        ) -> Retained<Self>;
1643
1644        /// unavailable
1645        #[unsafe(method(convolutionGradientState))]
1646        #[unsafe(method_family = none)]
1647        pub unsafe fn convolutionGradientState(
1648            &self,
1649        ) -> Option<Retained<MPSCNNConvolutionGradientStateNode>>;
1650    );
1651}
1652
1653/// Methods declared on superclass `MPSCNNConvolutionNode`.
1654impl MPSCNNConvolutionTransposeNode {
1655    extern_methods!(
1656        #[cfg(feature = "MPSCNNConvolution")]
1657        /// Init an autoreleased not representing a MPSCNNConvolution kernel
1658        ///
1659        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1660        ///
1661        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1662        /// protocol. This object is provided by you to encapsulate storage for
1663        /// convolution weights and biases. If it is used for training, it may not
1664        /// have a neuron embedded in the convolution descriptor.
1665        ///
1666        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1667        #[unsafe(method(nodeWithSource:weights:))]
1668        #[unsafe(method_family = none)]
1669        pub unsafe fn nodeWithSource_weights(
1670            source_node: &MPSNNImageNode,
1671            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1672        ) -> Retained<Self>;
1673
1674        #[cfg(feature = "MPSCNNConvolution")]
1675        /// Init a node representing a MPSCNNConvolution kernel
1676        ///
1677        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
1678        ///
1679        /// Parameter `weights`: A pointer to a valid object conforming to the MPSCNNConvolutionDataSource
1680        /// protocol. This object is provided by you to encapsulate storage for
1681        /// convolution weights and biases. If it is used for training, it may not
1682        /// have a neuron embedded in the convolution descriptor.
1683        ///
1684        /// Returns: A new MPSNNFilter node for a MPSCNNConvolution kernel.
1685        #[unsafe(method(initWithSource:weights:))]
1686        #[unsafe(method_family = init)]
1687        pub unsafe fn initWithSource_weights(
1688            this: Allocated<Self>,
1689            source_node: &MPSNNImageNode,
1690            weights: &ProtocolObject<dyn MPSCNNConvolutionDataSource>,
1691        ) -> Retained<Self>;
1692    );
1693}
1694
1695/// Methods declared on superclass `MPSNNFilterNode`.
1696impl MPSCNNConvolutionTransposeNode {
1697    extern_methods!(
1698        #[unsafe(method(init))]
1699        #[unsafe(method_family = init)]
1700        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1701    );
1702}
1703
1704/// Methods declared on superclass `NSObject`.
1705impl MPSCNNConvolutionTransposeNode {
1706    extern_methods!(
1707        #[unsafe(method(new))]
1708        #[unsafe(method_family = new)]
1709        pub unsafe fn new() -> Retained<Self>;
1710    );
1711}
1712
1713extern_class!(
1714    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiongradientnode?language=objc)
1715    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
1716    #[derive(Debug, PartialEq, Eq, Hash)]
1717    pub struct MPSCNNConvolutionGradientNode;
1718);
1719
1720extern_conformance!(
1721    unsafe impl MPSNNTrainableNode for MPSCNNConvolutionGradientNode {}
1722);
1723
1724extern_conformance!(
1725    unsafe impl NSObjectProtocol for MPSCNNConvolutionGradientNode {}
1726);
1727
1728impl MPSCNNConvolutionGradientNode {
1729    extern_methods!(
1730        #[cfg(feature = "MPSCNNConvolution")]
1731        /// A node to represent the gradient calculation for convolution training.
1732        ///
1733        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1734        /// that is a neuron gradient filter node.
1735        ///
1736        /// Parameter `sourceImage`: The input image from the forward convolution node
1737        ///
1738        /// Parameter `gradientState`: The gradient state from the forward convolution
1739        ///
1740        /// Parameter `weights`: The data source from the forward convolution. It may not contain
1741        /// an integrated neuron. Similary, any normalization should be
1742        /// broken out into a separate node. Pass nil to use the weights
1743        /// from the forward convolution pass.
1744        ///
1745        /// Returns: A MPSCNNConvolutionGradientNode
1746        #[unsafe(method(nodeWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
1747        #[unsafe(method_family = none)]
1748        pub unsafe fn nodeWithSourceGradient_sourceImage_convolutionGradientState_weights(
1749            source_gradient: &MPSNNImageNode,
1750            source_image: &MPSNNImageNode,
1751            gradient_state: &MPSCNNConvolutionGradientStateNode,
1752            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1753        ) -> Retained<Self>;
1754
1755        #[cfg(feature = "MPSCNNConvolution")]
1756        /// A node to represent the gradient calculation for convolution training.
1757        ///
1758        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1759        /// that is a neuron gradient filter node.
1760        ///
1761        /// Parameter `sourceImage`: The input image from the forward convolution node
1762        ///
1763        /// Parameter `gradientState`: The gradient state from the forward convolution
1764        ///
1765        /// Parameter `weights`: The data source from the forward convolution. It may not contain
1766        /// an integrated neuron. Similary, any normalization should be
1767        /// broken out into a separate node. Pass nil to use the weights
1768        /// from the forward convolution pass.
1769        ///
1770        /// Returns: A MPSCNNConvolutionGradientNode
1771        #[unsafe(method(initWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
1772        #[unsafe(method_family = init)]
1773        pub unsafe fn initWithSourceGradient_sourceImage_convolutionGradientState_weights(
1774            this: Allocated<Self>,
1775            source_gradient: &MPSNNImageNode,
1776            source_image: &MPSNNImageNode,
1777            gradient_state: &MPSCNNConvolutionGradientStateNode,
1778            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1779        ) -> Retained<Self>;
1780    );
1781}
1782
1783/// Methods declared on superclass `MPSNNFilterNode`.
1784impl MPSCNNConvolutionGradientNode {
1785    extern_methods!(
1786        #[unsafe(method(init))]
1787        #[unsafe(method_family = init)]
1788        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1789    );
1790}
1791
1792/// Methods declared on superclass `NSObject`.
1793impl MPSCNNConvolutionGradientNode {
1794    extern_methods!(
1795        #[unsafe(method(new))]
1796        #[unsafe(method_family = new)]
1797        pub unsafe fn new() -> Retained<Self>;
1798    );
1799}
1800
1801extern_class!(
1802    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnfullyconnectedgradientnode?language=objc)
1803    #[unsafe(super(
1804        MPSCNNConvolutionGradientNode,
1805        MPSNNGradientFilterNode,
1806        MPSNNFilterNode,
1807        NSObject
1808    ))]
1809    #[derive(Debug, PartialEq, Eq, Hash)]
1810    pub struct MPSCNNFullyConnectedGradientNode;
1811);
1812
1813extern_conformance!(
1814    unsafe impl MPSNNTrainableNode for MPSCNNFullyConnectedGradientNode {}
1815);
1816
1817extern_conformance!(
1818    unsafe impl NSObjectProtocol for MPSCNNFullyConnectedGradientNode {}
1819);
1820
1821impl MPSCNNFullyConnectedGradientNode {
1822    extern_methods!(
1823        #[cfg(feature = "MPSCNNConvolution")]
1824        /// A node to represent the gradient calculation for fully connected training.
1825        ///
1826        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1827        /// that is a neuron gradient filter node.
1828        ///
1829        /// Parameter `sourceImage`: The input image from the forward fully connected node
1830        ///
1831        /// Parameter `gradientState`: The gradient state from the forward fully connected
1832        ///
1833        /// Parameter `weights`: The data source from the forward fully connected. It may not contain
1834        /// an integrated neuron. Similary, any normalization should be
1835        /// broken out into a separate node. Pass nil to use the weights
1836        /// from the forward fully connected pass.
1837        ///
1838        /// Returns: A MPSCNNFullyConnectedGradientNode
1839        #[unsafe(method(nodeWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
1840        #[unsafe(method_family = none)]
1841        pub unsafe fn nodeWithSourceGradient_sourceImage_convolutionGradientState_weights(
1842            source_gradient: &MPSNNImageNode,
1843            source_image: &MPSNNImageNode,
1844            gradient_state: &MPSCNNConvolutionGradientStateNode,
1845            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1846        ) -> Retained<Self>;
1847
1848        #[cfg(feature = "MPSCNNConvolution")]
1849        /// A node to represent the gradient calculation for fully connectd training.
1850        ///
1851        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1852        /// that is a neuron gradient filter node.
1853        ///
1854        /// Parameter `sourceImage`: The input image from the forward fully connected node
1855        ///
1856        /// Parameter `gradientState`: The gradient state from the forward fully connected
1857        ///
1858        /// Parameter `weights`: The data source from the forward fully connected. It may not contain
1859        /// an integrated neuron. Similary, any normalization should be
1860        /// broken out into a separate node. Pass nil to use the weights
1861        /// from the forward convolution pass.
1862        ///
1863        /// Returns: A MPSCNNFullyConnectedGradientNode
1864        #[unsafe(method(initWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
1865        #[unsafe(method_family = init)]
1866        pub unsafe fn initWithSourceGradient_sourceImage_convolutionGradientState_weights(
1867            this: Allocated<Self>,
1868            source_gradient: &MPSNNImageNode,
1869            source_image: &MPSNNImageNode,
1870            gradient_state: &MPSCNNConvolutionGradientStateNode,
1871            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1872        ) -> Retained<Self>;
1873    );
1874}
1875
1876/// Methods declared on superclass `MPSNNFilterNode`.
1877impl MPSCNNFullyConnectedGradientNode {
1878    extern_methods!(
1879        #[unsafe(method(init))]
1880        #[unsafe(method_family = init)]
1881        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1882    );
1883}
1884
1885/// Methods declared on superclass `NSObject`.
1886impl MPSCNNFullyConnectedGradientNode {
1887    extern_methods!(
1888        #[unsafe(method(new))]
1889        #[unsafe(method_family = new)]
1890        pub unsafe fn new() -> Retained<Self>;
1891    );
1892}
1893
1894extern_class!(
1895    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnconvolutiontransposegradientnode?language=objc)
1896    #[unsafe(super(
1897        MPSCNNConvolutionGradientNode,
1898        MPSNNGradientFilterNode,
1899        MPSNNFilterNode,
1900        NSObject
1901    ))]
1902    #[derive(Debug, PartialEq, Eq, Hash)]
1903    pub struct MPSCNNConvolutionTransposeGradientNode;
1904);
1905
1906extern_conformance!(
1907    unsafe impl MPSNNTrainableNode for MPSCNNConvolutionTransposeGradientNode {}
1908);
1909
1910extern_conformance!(
1911    unsafe impl NSObjectProtocol for MPSCNNConvolutionTransposeGradientNode {}
1912);
1913
1914impl MPSCNNConvolutionTransposeGradientNode {
1915    extern_methods!(
1916        #[cfg(feature = "MPSCNNConvolution")]
1917        /// A node to represent the gradient calculation for convolution transpose training.
1918        ///
1919        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1920        /// that is a neuron gradient filter node.
1921        ///
1922        /// Parameter `sourceImage`: The input image from the forward convolution transpose node
1923        ///
1924        /// Parameter `gradientState`: The gradient state from the forward convolution transpose
1925        ///
1926        /// Parameter `weights`: The data source from the forward convolution transpose. It may not contain
1927        /// an integrated neuron. Similary, any normalization should be
1928        /// broken out into a separate node. Pass nil to use the weights
1929        /// from the forward convolution transpose pass.
1930        ///
1931        /// Returns: A MPSCNNConvolutionTransposeGradientNode
1932        #[unsafe(method(nodeWithSourceGradient:sourceImage:convolutionTransposeGradientState:weights:))]
1933        #[unsafe(method_family = none)]
1934        pub unsafe fn nodeWithSourceGradient_sourceImage_convolutionTransposeGradientState_weights(
1935            source_gradient: &MPSNNImageNode,
1936            source_image: &MPSNNImageNode,
1937            gradient_state: &MPSCNNConvolutionTransposeGradientStateNode,
1938            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1939        ) -> Retained<Self>;
1940
1941        #[cfg(feature = "MPSCNNConvolution")]
1942        /// A node to represent the gradient calculation for convolution transpose training.
1943        ///
1944        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1945        /// that is a neuron gradient filter node.
1946        ///
1947        /// Parameter `sourceImage`: The input image from the forward convolution transpose node
1948        ///
1949        /// Parameter `gradientState`: The gradient state from the forward convolution transpose
1950        ///
1951        /// Parameter `weights`: The data source from the forward convolution transpose. It may not contain
1952        /// an integrated neuron. Similary, any normalization should be
1953        /// broken out into a separate node. Pass nil to use the weights
1954        /// from the forward convolution transpose pass.
1955        ///
1956        /// Returns: A MPSCNNConvolutionTransposeGradientNode
1957        #[unsafe(method(initWithSourceGradient:sourceImage:convolutionTransposeGradientState:weights:))]
1958        #[unsafe(method_family = init)]
1959        pub unsafe fn initWithSourceGradient_sourceImage_convolutionTransposeGradientState_weights(
1960            this: Allocated<Self>,
1961            source_gradient: &MPSNNImageNode,
1962            source_image: &MPSNNImageNode,
1963            gradient_state: &MPSCNNConvolutionTransposeGradientStateNode,
1964            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1965        ) -> Retained<Self>;
1966    );
1967}
1968
1969/// Methods declared on superclass `MPSCNNConvolutionGradientNode`.
1970impl MPSCNNConvolutionTransposeGradientNode {
1971    extern_methods!(
1972        #[cfg(feature = "MPSCNNConvolution")]
1973        /// A node to represent the gradient calculation for convolution training.
1974        ///
1975        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
1976        /// that is a neuron gradient filter node.
1977        ///
1978        /// Parameter `sourceImage`: The input image from the forward convolution node
1979        ///
1980        /// Parameter `gradientState`: The gradient state from the forward convolution
1981        ///
1982        /// Parameter `weights`: The data source from the forward convolution. It may not contain
1983        /// an integrated neuron. Similary, any normalization should be
1984        /// broken out into a separate node. Pass nil to use the weights
1985        /// from the forward convolution pass.
1986        ///
1987        /// Returns: A MPSCNNConvolutionGradientNode
1988        #[unsafe(method(nodeWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
1989        #[unsafe(method_family = none)]
1990        pub unsafe fn nodeWithSourceGradient_sourceImage_convolutionGradientState_weights(
1991            source_gradient: &MPSNNImageNode,
1992            source_image: &MPSNNImageNode,
1993            gradient_state: &MPSCNNConvolutionGradientStateNode,
1994            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
1995        ) -> Retained<Self>;
1996
1997        #[cfg(feature = "MPSCNNConvolution")]
1998        /// A node to represent the gradient calculation for convolution training.
1999        ///
2000        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter. Often
2001        /// that is a neuron gradient filter node.
2002        ///
2003        /// Parameter `sourceImage`: The input image from the forward convolution node
2004        ///
2005        /// Parameter `gradientState`: The gradient state from the forward convolution
2006        ///
2007        /// Parameter `weights`: The data source from the forward convolution. It may not contain
2008        /// an integrated neuron. Similary, any normalization should be
2009        /// broken out into a separate node. Pass nil to use the weights
2010        /// from the forward convolution pass.
2011        ///
2012        /// Returns: A MPSCNNConvolutionGradientNode
2013        #[unsafe(method(initWithSourceGradient:sourceImage:convolutionGradientState:weights:))]
2014        #[unsafe(method_family = init)]
2015        pub unsafe fn initWithSourceGradient_sourceImage_convolutionGradientState_weights(
2016            this: Allocated<Self>,
2017            source_gradient: &MPSNNImageNode,
2018            source_image: &MPSNNImageNode,
2019            gradient_state: &MPSCNNConvolutionGradientStateNode,
2020            weights: Option<&ProtocolObject<dyn MPSCNNConvolutionDataSource>>,
2021        ) -> Retained<Self>;
2022    );
2023}
2024
2025/// Methods declared on superclass `MPSNNFilterNode`.
2026impl MPSCNNConvolutionTransposeGradientNode {
2027    extern_methods!(
2028        #[unsafe(method(init))]
2029        #[unsafe(method_family = init)]
2030        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2031    );
2032}
2033
2034/// Methods declared on superclass `NSObject`.
2035impl MPSCNNConvolutionTransposeGradientNode {
2036    extern_methods!(
2037        #[unsafe(method(new))]
2038        #[unsafe(method_family = new)]
2039        pub unsafe fn new() -> Retained<Self>;
2040    );
2041}
2042
2043extern_class!(
2044    /// virtual base class for MPSCNNNeuron nodes
2045    ///
2046    /// This is a virtual base class only. Please create a
2047    /// subclass using +newNeuronNodeWithSouce:descriptor or
2048    /// by making one of the subclasses directly. Better yet, skip
2049    /// the node entirely and specify the neuron function directly in
2050    /// your MPSCNNConvolutionDataSource.descriptor.neuronDescriptor.
2051    ///
2052    /// MPSCNNNeuronNodes are provided as a representational convenience.
2053    /// However, you are usually better off incorporating your neuron
2054    /// into the MPSCNNConvolutionDataSource when possible. The MPSNNGraph
2055    /// will attempt to optimize away the neuron pass by fusing it with a
2056    /// preceeding convolution, but it might be prevented from doing so
2057    /// if the neuron pass has a custom padding method or more than one
2058    /// node reads from the convolution result. The graph -debugDescription
2059    /// should reveal what happened.
2060    ///
2061    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronnode?language=objc)
2062    #[unsafe(super(MPSNNFilterNode, NSObject))]
2063    #[derive(Debug, PartialEq, Eq, Hash)]
2064    pub struct MPSCNNNeuronNode;
2065);
2066
2067extern_conformance!(
2068    unsafe impl NSObjectProtocol for MPSCNNNeuronNode {}
2069);
2070
2071impl MPSCNNNeuronNode {
2072    extern_methods!(
2073        #[cfg(feature = "MPSCNNNeuron")]
2074        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2075        #[unsafe(method(nodeWithSource:descriptor:))]
2076        #[unsafe(method_family = none)]
2077        pub unsafe fn nodeWithSource_descriptor(
2078            source_node: &MPSNNImageNode,
2079            descriptor: &MPSNNNeuronDescriptor,
2080        ) -> Retained<Self>;
2081
2082        /// filter parameter a
2083        #[unsafe(method(a))]
2084        #[unsafe(method_family = none)]
2085        pub unsafe fn a(&self) -> c_float;
2086
2087        /// filter parameter b
2088        #[unsafe(method(b))]
2089        #[unsafe(method_family = none)]
2090        pub unsafe fn b(&self) -> c_float;
2091
2092        /// filter parameter c
2093        #[unsafe(method(c))]
2094        #[unsafe(method_family = none)]
2095        pub unsafe fn c(&self) -> c_float;
2096
2097        #[unsafe(method(init))]
2098        #[unsafe(method_family = init)]
2099        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2100    );
2101}
2102
2103/// Methods declared on superclass `NSObject`.
2104impl MPSCNNNeuronNode {
2105    extern_methods!(
2106        #[unsafe(method(new))]
2107        #[unsafe(method_family = new)]
2108        pub unsafe fn new() -> Retained<Self>;
2109    );
2110}
2111
2112extern_class!(
2113    /// A node representing a MPSCNNNeuronAbsolute kernel
2114    ///
2115    /// For each pixel, applies the following function:
2116    ///
2117    /// ```text
2118    ///       f(x) = fabs(x)
2119    /// ```
2120    ///
2121    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronabsolutenode?language=objc)
2122    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2123    #[derive(Debug, PartialEq, Eq, Hash)]
2124    pub struct MPSCNNNeuronAbsoluteNode;
2125);
2126
2127extern_conformance!(
2128    unsafe impl NSObjectProtocol for MPSCNNNeuronAbsoluteNode {}
2129);
2130
2131impl MPSCNNNeuronAbsoluteNode {
2132    extern_methods!(
2133        /// Create an autoreleased node with default values for parameters a
2134        /// &
2135        /// b
2136        #[unsafe(method(nodeWithSource:))]
2137        #[unsafe(method_family = none)]
2138        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2139
2140        /// Init a node with default values for parameters a
2141        /// &
2142        /// b
2143        #[unsafe(method(initWithSource:))]
2144        #[unsafe(method_family = init)]
2145        pub unsafe fn initWithSource(
2146            this: Allocated<Self>,
2147            source_node: &MPSNNImageNode,
2148        ) -> Retained<Self>;
2149    );
2150}
2151
2152/// Methods declared on superclass `MPSCNNNeuronNode`.
2153impl MPSCNNNeuronAbsoluteNode {
2154    extern_methods!(
2155        #[cfg(feature = "MPSCNNNeuron")]
2156        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2157        #[unsafe(method(nodeWithSource:descriptor:))]
2158        #[unsafe(method_family = none)]
2159        pub unsafe fn nodeWithSource_descriptor(
2160            source_node: &MPSNNImageNode,
2161            descriptor: &MPSNNNeuronDescriptor,
2162        ) -> Retained<Self>;
2163
2164        #[unsafe(method(init))]
2165        #[unsafe(method_family = init)]
2166        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2167    );
2168}
2169
2170/// Methods declared on superclass `NSObject`.
2171impl MPSCNNNeuronAbsoluteNode {
2172    extern_methods!(
2173        #[unsafe(method(new))]
2174        #[unsafe(method_family = new)]
2175        pub unsafe fn new() -> Retained<Self>;
2176    );
2177}
2178
2179extern_class!(
2180    /// A node representing a MPSCNNNeuronELU kernel
2181    ///
2182    /// For each pixel, applies the following function:
2183    ///
2184    /// ```text
2185    ///       f(x) = a * exp(x) - 1, x <  0
2186    ///              x             , x >= 0
2187    /// ```
2188    ///
2189    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronelunode?language=objc)
2190    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2191    #[derive(Debug, PartialEq, Eq, Hash)]
2192    pub struct MPSCNNNeuronELUNode;
2193);
2194
2195extern_conformance!(
2196    unsafe impl NSObjectProtocol for MPSCNNNeuronELUNode {}
2197);
2198
2199impl MPSCNNNeuronELUNode {
2200    extern_methods!(
2201        #[unsafe(method(nodeWithSource:a:))]
2202        #[unsafe(method_family = none)]
2203        pub unsafe fn nodeWithSource_a(source_node: &MPSNNImageNode, a: c_float) -> Retained<Self>;
2204
2205        /// Create an autoreleased node with default values for parameters a
2206        /// &
2207        /// b
2208        #[unsafe(method(nodeWithSource:))]
2209        #[unsafe(method_family = none)]
2210        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2211
2212        /// Init a node with default values for parameters a
2213        /// &
2214        /// b
2215        #[unsafe(method(initWithSource:))]
2216        #[unsafe(method_family = init)]
2217        pub unsafe fn initWithSource(
2218            this: Allocated<Self>,
2219            source_node: &MPSNNImageNode,
2220        ) -> Retained<Self>;
2221
2222        #[unsafe(method(initWithSource:a:))]
2223        #[unsafe(method_family = init)]
2224        pub unsafe fn initWithSource_a(
2225            this: Allocated<Self>,
2226            source_node: &MPSNNImageNode,
2227            a: c_float,
2228        ) -> Retained<Self>;
2229    );
2230}
2231
2232/// Methods declared on superclass `MPSCNNNeuronNode`.
2233impl MPSCNNNeuronELUNode {
2234    extern_methods!(
2235        #[cfg(feature = "MPSCNNNeuron")]
2236        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2237        #[unsafe(method(nodeWithSource:descriptor:))]
2238        #[unsafe(method_family = none)]
2239        pub unsafe fn nodeWithSource_descriptor(
2240            source_node: &MPSNNImageNode,
2241            descriptor: &MPSNNNeuronDescriptor,
2242        ) -> Retained<Self>;
2243
2244        #[unsafe(method(init))]
2245        #[unsafe(method_family = init)]
2246        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2247    );
2248}
2249
2250/// Methods declared on superclass `NSObject`.
2251impl MPSCNNNeuronELUNode {
2252    extern_methods!(
2253        #[unsafe(method(new))]
2254        #[unsafe(method_family = new)]
2255        pub unsafe fn new() -> Retained<Self>;
2256    );
2257}
2258
2259extern_class!(
2260    /// A node representing a MPSCNNNeuronReLUN kernel
2261    ///
2262    /// For each pixel, applies the following function:
2263    ///
2264    /// ```text
2265    ///       f(x) = min((x >= 0 ? x : a * x), b)
2266    /// ```
2267    ///
2268    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronrelunnode?language=objc)
2269    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2270    #[derive(Debug, PartialEq, Eq, Hash)]
2271    pub struct MPSCNNNeuronReLUNNode;
2272);
2273
2274extern_conformance!(
2275    unsafe impl NSObjectProtocol for MPSCNNNeuronReLUNNode {}
2276);
2277
2278impl MPSCNNNeuronReLUNNode {
2279    extern_methods!(
2280        #[unsafe(method(nodeWithSource:a:b:))]
2281        #[unsafe(method_family = none)]
2282        pub unsafe fn nodeWithSource_a_b(
2283            source_node: &MPSNNImageNode,
2284            a: c_float,
2285            b: c_float,
2286        ) -> Retained<Self>;
2287
2288        #[unsafe(method(initWithSource:a:b:))]
2289        #[unsafe(method_family = init)]
2290        pub unsafe fn initWithSource_a_b(
2291            this: Allocated<Self>,
2292            source_node: &MPSNNImageNode,
2293            a: c_float,
2294            b: c_float,
2295        ) -> Retained<Self>;
2296
2297        /// Create an autoreleased node with default values for parameters a
2298        /// &
2299        /// b
2300        #[unsafe(method(nodeWithSource:))]
2301        #[unsafe(method_family = none)]
2302        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2303
2304        /// Create an autoreleased node with default values for parameters a
2305        /// &
2306        /// b
2307        #[unsafe(method(initWithSource:))]
2308        #[unsafe(method_family = init)]
2309        pub unsafe fn initWithSource(
2310            this: Allocated<Self>,
2311            source_node: &MPSNNImageNode,
2312        ) -> Retained<Self>;
2313    );
2314}
2315
2316/// Methods declared on superclass `MPSCNNNeuronNode`.
2317impl MPSCNNNeuronReLUNNode {
2318    extern_methods!(
2319        #[cfg(feature = "MPSCNNNeuron")]
2320        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2321        #[unsafe(method(nodeWithSource:descriptor:))]
2322        #[unsafe(method_family = none)]
2323        pub unsafe fn nodeWithSource_descriptor(
2324            source_node: &MPSNNImageNode,
2325            descriptor: &MPSNNNeuronDescriptor,
2326        ) -> Retained<Self>;
2327
2328        #[unsafe(method(init))]
2329        #[unsafe(method_family = init)]
2330        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2331    );
2332}
2333
2334/// Methods declared on superclass `NSObject`.
2335impl MPSCNNNeuronReLUNNode {
2336    extern_methods!(
2337        #[unsafe(method(new))]
2338        #[unsafe(method_family = new)]
2339        pub unsafe fn new() -> Retained<Self>;
2340    );
2341}
2342
2343extern_class!(
2344    /// A node representing a MPSCNNNeuronLinear kernel
2345    ///
2346    /// For each pixel, applies the following function:
2347    ///
2348    /// ```text
2349    ///       f(x) = a * x + b
2350    /// ```
2351    ///
2352    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronlinearnode?language=objc)
2353    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2354    #[derive(Debug, PartialEq, Eq, Hash)]
2355    pub struct MPSCNNNeuronLinearNode;
2356);
2357
2358extern_conformance!(
2359    unsafe impl NSObjectProtocol for MPSCNNNeuronLinearNode {}
2360);
2361
2362impl MPSCNNNeuronLinearNode {
2363    extern_methods!(
2364        #[unsafe(method(nodeWithSource:a:b:))]
2365        #[unsafe(method_family = none)]
2366        pub unsafe fn nodeWithSource_a_b(
2367            source_node: &MPSNNImageNode,
2368            a: c_float,
2369            b: c_float,
2370        ) -> Retained<Self>;
2371
2372        /// Init a node representing a MPSCNNNeuronLinear kernel
2373        ///
2374        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
2375        ///
2376        /// Parameter `a`: See discussion above.
2377        ///
2378        /// Parameter `b`: See discussion above.
2379        ///
2380        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronLinear kernel.
2381        #[unsafe(method(initWithSource:a:b:))]
2382        #[unsafe(method_family = init)]
2383        pub unsafe fn initWithSource_a_b(
2384            this: Allocated<Self>,
2385            source_node: &MPSNNImageNode,
2386            a: c_float,
2387            b: c_float,
2388        ) -> Retained<Self>;
2389
2390        /// Create an autoreleased node with default values for parameters a
2391        /// &
2392        /// b
2393        #[unsafe(method(nodeWithSource:))]
2394        #[unsafe(method_family = none)]
2395        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2396
2397        /// Init a node with default values for parameters a
2398        /// &
2399        /// b
2400        #[unsafe(method(initWithSource:))]
2401        #[unsafe(method_family = init)]
2402        pub unsafe fn initWithSource(
2403            this: Allocated<Self>,
2404            source_node: &MPSNNImageNode,
2405        ) -> Retained<Self>;
2406    );
2407}
2408
2409/// Methods declared on superclass `MPSCNNNeuronNode`.
2410impl MPSCNNNeuronLinearNode {
2411    extern_methods!(
2412        #[cfg(feature = "MPSCNNNeuron")]
2413        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2414        #[unsafe(method(nodeWithSource:descriptor:))]
2415        #[unsafe(method_family = none)]
2416        pub unsafe fn nodeWithSource_descriptor(
2417            source_node: &MPSNNImageNode,
2418            descriptor: &MPSNNNeuronDescriptor,
2419        ) -> Retained<Self>;
2420
2421        #[unsafe(method(init))]
2422        #[unsafe(method_family = init)]
2423        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2424    );
2425}
2426
2427/// Methods declared on superclass `NSObject`.
2428impl MPSCNNNeuronLinearNode {
2429    extern_methods!(
2430        #[unsafe(method(new))]
2431        #[unsafe(method_family = new)]
2432        pub unsafe fn new() -> Retained<Self>;
2433    );
2434}
2435
2436extern_class!(
2437    /// A node representing a MPSCNNNeuronReLU kernel
2438    ///
2439    /// For each pixel, applies the following function:
2440    ///
2441    /// ```text
2442    ///       f(x) = x            if x >= 0
2443    ///            = a * x        if x < 0
2444    /// ```
2445    ///
2446    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronrelunode?language=objc)
2447    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2448    #[derive(Debug, PartialEq, Eq, Hash)]
2449    pub struct MPSCNNNeuronReLUNode;
2450);
2451
2452extern_conformance!(
2453    unsafe impl NSObjectProtocol for MPSCNNNeuronReLUNode {}
2454);
2455
2456impl MPSCNNNeuronReLUNode {
2457    extern_methods!(
2458        #[unsafe(method(nodeWithSource:a:))]
2459        #[unsafe(method_family = none)]
2460        pub unsafe fn nodeWithSource_a(source_node: &MPSNNImageNode, a: c_float) -> Retained<Self>;
2461
2462        /// Create an autoreleased node with default values for parameters a
2463        /// &
2464        /// b
2465        #[unsafe(method(nodeWithSource:))]
2466        #[unsafe(method_family = none)]
2467        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2468
2469        /// Init a node with default values for parameters a
2470        /// &
2471        /// b
2472        #[unsafe(method(initWithSource:))]
2473        #[unsafe(method_family = init)]
2474        pub unsafe fn initWithSource(
2475            this: Allocated<Self>,
2476            source_node: &MPSNNImageNode,
2477        ) -> Retained<Self>;
2478
2479        /// Init a node with default values for parameters a
2480        /// &
2481        /// b
2482        #[unsafe(method(initWithSource:a:))]
2483        #[unsafe(method_family = init)]
2484        pub unsafe fn initWithSource_a(
2485            this: Allocated<Self>,
2486            source_node: &MPSNNImageNode,
2487            a: c_float,
2488        ) -> Retained<Self>;
2489    );
2490}
2491
2492/// Methods declared on superclass `MPSCNNNeuronNode`.
2493impl MPSCNNNeuronReLUNode {
2494    extern_methods!(
2495        #[cfg(feature = "MPSCNNNeuron")]
2496        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2497        #[unsafe(method(nodeWithSource:descriptor:))]
2498        #[unsafe(method_family = none)]
2499        pub unsafe fn nodeWithSource_descriptor(
2500            source_node: &MPSNNImageNode,
2501            descriptor: &MPSNNNeuronDescriptor,
2502        ) -> Retained<Self>;
2503
2504        #[unsafe(method(init))]
2505        #[unsafe(method_family = init)]
2506        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2507    );
2508}
2509
2510/// Methods declared on superclass `NSObject`.
2511impl MPSCNNNeuronReLUNode {
2512    extern_methods!(
2513        #[unsafe(method(new))]
2514        #[unsafe(method_family = new)]
2515        pub unsafe fn new() -> Retained<Self>;
2516    );
2517}
2518
2519extern_class!(
2520    /// A node representing a MPSCNNNeuronSigmoid kernel
2521    ///
2522    /// For each pixel, applies the following function:
2523    ///
2524    /// ```text
2525    ///       f(x) = 1 / (1 + e^-x)
2526    /// ```
2527    ///
2528    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsigmoidnode?language=objc)
2529    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2530    #[derive(Debug, PartialEq, Eq, Hash)]
2531    pub struct MPSCNNNeuronSigmoidNode;
2532);
2533
2534extern_conformance!(
2535    unsafe impl NSObjectProtocol for MPSCNNNeuronSigmoidNode {}
2536);
2537
2538impl MPSCNNNeuronSigmoidNode {
2539    extern_methods!(
2540        /// Create an autoreleased node with default values for parameters a
2541        /// &
2542        /// b
2543        #[unsafe(method(nodeWithSource:))]
2544        #[unsafe(method_family = none)]
2545        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2546
2547        /// Init a node with default values for parameters a
2548        /// &
2549        /// b
2550        #[unsafe(method(initWithSource:))]
2551        #[unsafe(method_family = init)]
2552        pub unsafe fn initWithSource(
2553            this: Allocated<Self>,
2554            source_node: &MPSNNImageNode,
2555        ) -> Retained<Self>;
2556    );
2557}
2558
2559/// Methods declared on superclass `MPSCNNNeuronNode`.
2560impl MPSCNNNeuronSigmoidNode {
2561    extern_methods!(
2562        #[cfg(feature = "MPSCNNNeuron")]
2563        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2564        #[unsafe(method(nodeWithSource:descriptor:))]
2565        #[unsafe(method_family = none)]
2566        pub unsafe fn nodeWithSource_descriptor(
2567            source_node: &MPSNNImageNode,
2568            descriptor: &MPSNNNeuronDescriptor,
2569        ) -> Retained<Self>;
2570
2571        #[unsafe(method(init))]
2572        #[unsafe(method_family = init)]
2573        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2574    );
2575}
2576
2577/// Methods declared on superclass `NSObject`.
2578impl MPSCNNNeuronSigmoidNode {
2579    extern_methods!(
2580        #[unsafe(method(new))]
2581        #[unsafe(method_family = new)]
2582        pub unsafe fn new() -> Retained<Self>;
2583    );
2584}
2585
2586extern_class!(
2587    /// A node representing a MPSCNNNeuronHardSigmoid kernel
2588    ///
2589    /// For each pixel, applies the following function:
2590    ///
2591    /// ```text
2592    ///       f(x) = clamp((a * x) + b, 0, 1)
2593    /// ```
2594    ///
2595    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronhardsigmoidnode?language=objc)
2596    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2597    #[derive(Debug, PartialEq, Eq, Hash)]
2598    pub struct MPSCNNNeuronHardSigmoidNode;
2599);
2600
2601extern_conformance!(
2602    unsafe impl NSObjectProtocol for MPSCNNNeuronHardSigmoidNode {}
2603);
2604
2605impl MPSCNNNeuronHardSigmoidNode {
2606    extern_methods!(
2607        #[unsafe(method(nodeWithSource:a:b:))]
2608        #[unsafe(method_family = none)]
2609        pub unsafe fn nodeWithSource_a_b(
2610            source_node: &MPSNNImageNode,
2611            a: c_float,
2612            b: c_float,
2613        ) -> Retained<Self>;
2614
2615        /// Init a node representing a MPSCNNNeuronHardSigmoid kernel
2616        ///
2617        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
2618        ///
2619        /// Parameter `a`: See discussion above.
2620        ///
2621        /// Parameter `b`: See discussion above.
2622        ///
2623        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronHardSigmoid kernel.
2624        #[unsafe(method(initWithSource:a:b:))]
2625        #[unsafe(method_family = init)]
2626        pub unsafe fn initWithSource_a_b(
2627            this: Allocated<Self>,
2628            source_node: &MPSNNImageNode,
2629            a: c_float,
2630            b: c_float,
2631        ) -> Retained<Self>;
2632
2633        /// Create an autoreleased node with default values for parameters a
2634        /// &
2635        /// b
2636        #[unsafe(method(nodeWithSource:))]
2637        #[unsafe(method_family = none)]
2638        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2639
2640        /// Init a node with default values for parameters a
2641        /// &
2642        /// b
2643        #[unsafe(method(initWithSource:))]
2644        #[unsafe(method_family = init)]
2645        pub unsafe fn initWithSource(
2646            this: Allocated<Self>,
2647            source_node: &MPSNNImageNode,
2648        ) -> Retained<Self>;
2649    );
2650}
2651
2652/// Methods declared on superclass `MPSCNNNeuronNode`.
2653impl MPSCNNNeuronHardSigmoidNode {
2654    extern_methods!(
2655        #[cfg(feature = "MPSCNNNeuron")]
2656        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2657        #[unsafe(method(nodeWithSource:descriptor:))]
2658        #[unsafe(method_family = none)]
2659        pub unsafe fn nodeWithSource_descriptor(
2660            source_node: &MPSNNImageNode,
2661            descriptor: &MPSNNNeuronDescriptor,
2662        ) -> Retained<Self>;
2663
2664        #[unsafe(method(init))]
2665        #[unsafe(method_family = init)]
2666        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2667    );
2668}
2669
2670/// Methods declared on superclass `NSObject`.
2671impl MPSCNNNeuronHardSigmoidNode {
2672    extern_methods!(
2673        #[unsafe(method(new))]
2674        #[unsafe(method_family = new)]
2675        pub unsafe fn new() -> Retained<Self>;
2676    );
2677}
2678
2679extern_class!(
2680    /// A node representing a MPSCNNNeuronSoftPlus kernel
2681    ///
2682    /// For each pixel, applies the following function:
2683    ///
2684    /// ```text
2685    ///       f(x) = a * log(1 + e^(b * x))
2686    /// ```
2687    ///
2688    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsoftplusnode?language=objc)
2689    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2690    #[derive(Debug, PartialEq, Eq, Hash)]
2691    pub struct MPSCNNNeuronSoftPlusNode;
2692);
2693
2694extern_conformance!(
2695    unsafe impl NSObjectProtocol for MPSCNNNeuronSoftPlusNode {}
2696);
2697
2698impl MPSCNNNeuronSoftPlusNode {
2699    extern_methods!(
2700        #[unsafe(method(nodeWithSource:a:b:))]
2701        #[unsafe(method_family = none)]
2702        pub unsafe fn nodeWithSource_a_b(
2703            source_node: &MPSNNImageNode,
2704            a: c_float,
2705            b: c_float,
2706        ) -> Retained<Self>;
2707
2708        /// Init a node representing a MPSCNNNeuronSoftPlus kernel
2709        ///
2710        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
2711        ///
2712        /// Parameter `a`: See discussion above.
2713        ///
2714        /// Parameter `b`: See discussion above.
2715        ///
2716        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronSoftPlus kernel.
2717        #[unsafe(method(initWithSource:a:b:))]
2718        #[unsafe(method_family = init)]
2719        pub unsafe fn initWithSource_a_b(
2720            this: Allocated<Self>,
2721            source_node: &MPSNNImageNode,
2722            a: c_float,
2723            b: c_float,
2724        ) -> Retained<Self>;
2725
2726        /// Create an autoreleased node with default values for parameters a
2727        /// &
2728        /// b
2729        #[unsafe(method(nodeWithSource:))]
2730        #[unsafe(method_family = none)]
2731        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2732
2733        /// Init a node with default values for parameters a
2734        /// &
2735        /// b
2736        #[unsafe(method(initWithSource:))]
2737        #[unsafe(method_family = init)]
2738        pub unsafe fn initWithSource(
2739            this: Allocated<Self>,
2740            source_node: &MPSNNImageNode,
2741        ) -> Retained<Self>;
2742    );
2743}
2744
2745/// Methods declared on superclass `MPSCNNNeuronNode`.
2746impl MPSCNNNeuronSoftPlusNode {
2747    extern_methods!(
2748        #[cfg(feature = "MPSCNNNeuron")]
2749        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2750        #[unsafe(method(nodeWithSource:descriptor:))]
2751        #[unsafe(method_family = none)]
2752        pub unsafe fn nodeWithSource_descriptor(
2753            source_node: &MPSNNImageNode,
2754            descriptor: &MPSNNNeuronDescriptor,
2755        ) -> Retained<Self>;
2756
2757        #[unsafe(method(init))]
2758        #[unsafe(method_family = init)]
2759        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2760    );
2761}
2762
2763/// Methods declared on superclass `NSObject`.
2764impl MPSCNNNeuronSoftPlusNode {
2765    extern_methods!(
2766        #[unsafe(method(new))]
2767        #[unsafe(method_family = new)]
2768        pub unsafe fn new() -> Retained<Self>;
2769    );
2770}
2771
2772extern_class!(
2773    /// A node representing a MPSCNNNeuronSoftSign kernel
2774    ///
2775    /// For each pixel, applies the following function:
2776    ///
2777    /// ```text
2778    ///       f(x) = x / (1 + abs(x))
2779    /// ```
2780    ///
2781    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsoftsignnode?language=objc)
2782    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2783    #[derive(Debug, PartialEq, Eq, Hash)]
2784    pub struct MPSCNNNeuronSoftSignNode;
2785);
2786
2787extern_conformance!(
2788    unsafe impl NSObjectProtocol for MPSCNNNeuronSoftSignNode {}
2789);
2790
2791impl MPSCNNNeuronSoftSignNode {
2792    extern_methods!(
2793        /// Create an autoreleased node with default values for parameters a
2794        /// &
2795        /// b
2796        #[unsafe(method(nodeWithSource:))]
2797        #[unsafe(method_family = none)]
2798        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2799
2800        /// Init a node with default values for parameters a
2801        /// &
2802        /// b
2803        #[unsafe(method(initWithSource:))]
2804        #[unsafe(method_family = init)]
2805        pub unsafe fn initWithSource(
2806            this: Allocated<Self>,
2807            source_node: &MPSNNImageNode,
2808        ) -> Retained<Self>;
2809    );
2810}
2811
2812/// Methods declared on superclass `MPSCNNNeuronNode`.
2813impl MPSCNNNeuronSoftSignNode {
2814    extern_methods!(
2815        #[cfg(feature = "MPSCNNNeuron")]
2816        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2817        #[unsafe(method(nodeWithSource:descriptor:))]
2818        #[unsafe(method_family = none)]
2819        pub unsafe fn nodeWithSource_descriptor(
2820            source_node: &MPSNNImageNode,
2821            descriptor: &MPSNNNeuronDescriptor,
2822        ) -> Retained<Self>;
2823
2824        #[unsafe(method(init))]
2825        #[unsafe(method_family = init)]
2826        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2827    );
2828}
2829
2830/// Methods declared on superclass `NSObject`.
2831impl MPSCNNNeuronSoftSignNode {
2832    extern_methods!(
2833        #[unsafe(method(new))]
2834        #[unsafe(method_family = new)]
2835        pub unsafe fn new() -> Retained<Self>;
2836    );
2837}
2838
2839extern_class!(
2840    /// A node representing a MPSCNNNeuronTanH kernel
2841    ///
2842    /// For each pixel, applies the following function:
2843    ///
2844    /// ```text
2845    ///       f(x) = a * tanh(b * x)
2846    /// ```
2847    ///
2848    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneurontanhnode?language=objc)
2849    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2850    #[derive(Debug, PartialEq, Eq, Hash)]
2851    pub struct MPSCNNNeuronTanHNode;
2852);
2853
2854extern_conformance!(
2855    unsafe impl NSObjectProtocol for MPSCNNNeuronTanHNode {}
2856);
2857
2858impl MPSCNNNeuronTanHNode {
2859    extern_methods!(
2860        #[unsafe(method(nodeWithSource:a:b:))]
2861        #[unsafe(method_family = none)]
2862        pub unsafe fn nodeWithSource_a_b(
2863            source_node: &MPSNNImageNode,
2864            a: c_float,
2865            b: c_float,
2866        ) -> Retained<Self>;
2867
2868        /// Init a node representing a MPSCNNNeuronTanH kernel
2869        ///
2870        /// For each pixel, applies the following function:
2871        ///
2872        /// ```text
2873        ///       f(x) = a * tanh(b * x)
2874        /// ```
2875        ///
2876        ///
2877        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
2878        ///
2879        /// Parameter `a`: See discussion above.
2880        ///
2881        /// Parameter `b`: See discussion above.
2882        ///
2883        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronTanH kernel.
2884        #[unsafe(method(initWithSource:a:b:))]
2885        #[unsafe(method_family = init)]
2886        pub unsafe fn initWithSource_a_b(
2887            this: Allocated<Self>,
2888            source_node: &MPSNNImageNode,
2889            a: c_float,
2890            b: c_float,
2891        ) -> Retained<Self>;
2892
2893        /// Create an autoreleased node with default values for parameters a
2894        /// &
2895        /// b
2896        #[unsafe(method(nodeWithSource:))]
2897        #[unsafe(method_family = none)]
2898        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2899
2900        /// Init a node with default values for parameters a
2901        /// &
2902        /// b
2903        #[unsafe(method(initWithSource:))]
2904        #[unsafe(method_family = init)]
2905        pub unsafe fn initWithSource(
2906            this: Allocated<Self>,
2907            source_node: &MPSNNImageNode,
2908        ) -> Retained<Self>;
2909    );
2910}
2911
2912/// Methods declared on superclass `MPSCNNNeuronNode`.
2913impl MPSCNNNeuronTanHNode {
2914    extern_methods!(
2915        #[cfg(feature = "MPSCNNNeuron")]
2916        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
2917        #[unsafe(method(nodeWithSource:descriptor:))]
2918        #[unsafe(method_family = none)]
2919        pub unsafe fn nodeWithSource_descriptor(
2920            source_node: &MPSNNImageNode,
2921            descriptor: &MPSNNNeuronDescriptor,
2922        ) -> Retained<Self>;
2923
2924        #[unsafe(method(init))]
2925        #[unsafe(method_family = init)]
2926        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2927    );
2928}
2929
2930/// Methods declared on superclass `NSObject`.
2931impl MPSCNNNeuronTanHNode {
2932    extern_methods!(
2933        #[unsafe(method(new))]
2934        #[unsafe(method_family = new)]
2935        pub unsafe fn new() -> Retained<Self>;
2936    );
2937}
2938
2939extern_class!(
2940    /// A ReLU node with parameter a provided independently for each feature channel
2941    ///
2942    /// For each pixel, applies the following function:
2943    ///
2944    /// ```text
2945    ///       f(x) = x                if x >= 0
2946    ///            = aData[i] * x     if x < 0,  i is the index of the feature channel
2947    ///   @param      sourceNode              The MPSNNImageNode representing the source MPSImage for the filter
2948    ///   @param      aData                   An array of single precision floating-point alpha values to use
2949    /// ```
2950    ///
2951    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronprelunode?language=objc)
2952    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
2953    #[derive(Debug, PartialEq, Eq, Hash)]
2954    pub struct MPSCNNNeuronPReLUNode;
2955);
2956
2957extern_conformance!(
2958    unsafe impl NSObjectProtocol for MPSCNNNeuronPReLUNode {}
2959);
2960
2961impl MPSCNNNeuronPReLUNode {
2962    extern_methods!(
2963        #[unsafe(method(nodeWithSource:aData:))]
2964        #[unsafe(method_family = none)]
2965        pub unsafe fn nodeWithSource_aData(
2966            source_node: &MPSNNImageNode,
2967            a_data: &NSData,
2968        ) -> Retained<Self>;
2969
2970        /// Init a node representing a MPSCNNNeuronTanH kernel
2971        ///
2972        /// For each pixel, applies the following function:
2973        ///
2974        /// ```text
2975        ///       f(x) = x                if x >= 0
2976        ///            = aData[i] * x     if x < 0,  i is the index of the feature channel
2977        /// ```
2978        ///
2979        ///
2980        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
2981        ///
2982        /// Parameter `aData`: An array of single precision floating-point alpha values to use
2983        ///
2984        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronTanH kernel.
2985        #[unsafe(method(initWithSource:aData:))]
2986        #[unsafe(method_family = init)]
2987        pub unsafe fn initWithSource_aData(
2988            this: Allocated<Self>,
2989            source_node: &MPSNNImageNode,
2990            a_data: &NSData,
2991        ) -> Retained<Self>;
2992
2993        #[unsafe(method(nodeWithSource:))]
2994        #[unsafe(method_family = none)]
2995        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
2996
2997        #[unsafe(method(initWithSource:))]
2998        #[unsafe(method_family = init)]
2999        pub unsafe fn initWithSource(
3000            this: Allocated<Self>,
3001            source_node: &MPSNNImageNode,
3002        ) -> Retained<Self>;
3003    );
3004}
3005
3006/// Methods declared on superclass `MPSCNNNeuronNode`.
3007impl MPSCNNNeuronPReLUNode {
3008    extern_methods!(
3009        #[cfg(feature = "MPSCNNNeuron")]
3010        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
3011        #[unsafe(method(nodeWithSource:descriptor:))]
3012        #[unsafe(method_family = none)]
3013        pub unsafe fn nodeWithSource_descriptor(
3014            source_node: &MPSNNImageNode,
3015            descriptor: &MPSNNNeuronDescriptor,
3016        ) -> Retained<Self>;
3017
3018        #[unsafe(method(init))]
3019        #[unsafe(method_family = init)]
3020        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3021    );
3022}
3023
3024/// Methods declared on superclass `NSObject`.
3025impl MPSCNNNeuronPReLUNode {
3026    extern_methods!(
3027        #[unsafe(method(new))]
3028        #[unsafe(method_family = new)]
3029        pub unsafe fn new() -> Retained<Self>;
3030    );
3031}
3032
3033extern_class!(
3034    /// A node representing a MPSCNNNeuronPower kernel
3035    ///
3036    /// For each pixel, applies the following function:
3037    ///
3038    /// ```text
3039    ///       f(x) = (a * x + b) ^ c
3040    /// ```
3041    ///
3042    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronpowernode?language=objc)
3043    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
3044    #[derive(Debug, PartialEq, Eq, Hash)]
3045    pub struct MPSCNNNeuronPowerNode;
3046);
3047
3048extern_conformance!(
3049    unsafe impl NSObjectProtocol for MPSCNNNeuronPowerNode {}
3050);
3051
3052impl MPSCNNNeuronPowerNode {
3053    extern_methods!(
3054        #[unsafe(method(nodeWithSource:a:b:c:))]
3055        #[unsafe(method_family = none)]
3056        pub unsafe fn nodeWithSource_a_b_c(
3057            source_node: &MPSNNImageNode,
3058            a: c_float,
3059            b: c_float,
3060            c: c_float,
3061        ) -> Retained<Self>;
3062
3063        /// Init a node representing a MPSCNNNeuronPower kernel
3064        ///
3065        /// For each pixel, applies the following function:
3066        ///
3067        /// ```text
3068        ///       f(x) = (a * x + b) ^ c
3069        /// ```
3070        ///
3071        ///
3072        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3073        ///
3074        /// Parameter `a`: See discussion above.
3075        ///
3076        /// Parameter `b`: See discussion above.
3077        ///
3078        /// Parameter `c`: See discussion above.
3079        ///
3080        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronPower kernel.
3081        #[unsafe(method(initWithSource:a:b:c:))]
3082        #[unsafe(method_family = init)]
3083        pub unsafe fn initWithSource_a_b_c(
3084            this: Allocated<Self>,
3085            source_node: &MPSNNImageNode,
3086            a: c_float,
3087            b: c_float,
3088            c: c_float,
3089        ) -> Retained<Self>;
3090
3091        /// Create an autoreleased node with default values for parameters a, b, and c
3092        #[unsafe(method(nodeWithSource:))]
3093        #[unsafe(method_family = none)]
3094        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3095
3096        /// Init a node with default values for parameters a, b, and c
3097        #[unsafe(method(initWithSource:))]
3098        #[unsafe(method_family = init)]
3099        pub unsafe fn initWithSource(
3100            this: Allocated<Self>,
3101            source_node: &MPSNNImageNode,
3102        ) -> Retained<Self>;
3103    );
3104}
3105
3106/// Methods declared on superclass `MPSCNNNeuronNode`.
3107impl MPSCNNNeuronPowerNode {
3108    extern_methods!(
3109        #[cfg(feature = "MPSCNNNeuron")]
3110        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
3111        #[unsafe(method(nodeWithSource:descriptor:))]
3112        #[unsafe(method_family = none)]
3113        pub unsafe fn nodeWithSource_descriptor(
3114            source_node: &MPSNNImageNode,
3115            descriptor: &MPSNNNeuronDescriptor,
3116        ) -> Retained<Self>;
3117
3118        #[unsafe(method(init))]
3119        #[unsafe(method_family = init)]
3120        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3121    );
3122}
3123
3124/// Methods declared on superclass `NSObject`.
3125impl MPSCNNNeuronPowerNode {
3126    extern_methods!(
3127        #[unsafe(method(new))]
3128        #[unsafe(method_family = new)]
3129        pub unsafe fn new() -> Retained<Self>;
3130    );
3131}
3132
3133extern_class!(
3134    /// A node representing a MPSCNNNeuronExponential kernel
3135    ///
3136    /// For each pixel, applies the following function:
3137    ///
3138    /// ```text
3139    ///       f(x) = c ^ (a * x + b)
3140    /// ```
3141    ///
3142    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronexponentialnode?language=objc)
3143    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
3144    #[derive(Debug, PartialEq, Eq, Hash)]
3145    pub struct MPSCNNNeuronExponentialNode;
3146);
3147
3148extern_conformance!(
3149    unsafe impl NSObjectProtocol for MPSCNNNeuronExponentialNode {}
3150);
3151
3152impl MPSCNNNeuronExponentialNode {
3153    extern_methods!(
3154        #[unsafe(method(nodeWithSource:a:b:c:))]
3155        #[unsafe(method_family = none)]
3156        pub unsafe fn nodeWithSource_a_b_c(
3157            source_node: &MPSNNImageNode,
3158            a: c_float,
3159            b: c_float,
3160            c: c_float,
3161        ) -> Retained<Self>;
3162
3163        /// Init a node representing a MPSCNNNeuronExponential kernel
3164        ///
3165        /// For each pixel, applies the following function:
3166        ///
3167        /// ```text
3168        ///       f(x) = c ^ (a * x + b)
3169        /// ```
3170        ///
3171        ///
3172        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3173        ///
3174        /// Parameter `a`: See discussion above.
3175        ///
3176        /// Parameter `b`: See discussion above.
3177        ///
3178        /// Parameter `c`: See discussion above.
3179        ///
3180        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronExponential kernel.
3181        #[unsafe(method(initWithSource:a:b:c:))]
3182        #[unsafe(method_family = init)]
3183        pub unsafe fn initWithSource_a_b_c(
3184            this: Allocated<Self>,
3185            source_node: &MPSNNImageNode,
3186            a: c_float,
3187            b: c_float,
3188            c: c_float,
3189        ) -> Retained<Self>;
3190
3191        /// Create an autoreleased node with default values for parameters a, b, and c
3192        #[unsafe(method(nodeWithSource:))]
3193        #[unsafe(method_family = none)]
3194        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3195
3196        /// Init a node with default values for parameters a, b, and c
3197        #[unsafe(method(initWithSource:))]
3198        #[unsafe(method_family = init)]
3199        pub unsafe fn initWithSource(
3200            this: Allocated<Self>,
3201            source_node: &MPSNNImageNode,
3202        ) -> Retained<Self>;
3203    );
3204}
3205
3206/// Methods declared on superclass `MPSCNNNeuronNode`.
3207impl MPSCNNNeuronExponentialNode {
3208    extern_methods!(
3209        #[cfg(feature = "MPSCNNNeuron")]
3210        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
3211        #[unsafe(method(nodeWithSource:descriptor:))]
3212        #[unsafe(method_family = none)]
3213        pub unsafe fn nodeWithSource_descriptor(
3214            source_node: &MPSNNImageNode,
3215            descriptor: &MPSNNNeuronDescriptor,
3216        ) -> Retained<Self>;
3217
3218        #[unsafe(method(init))]
3219        #[unsafe(method_family = init)]
3220        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3221    );
3222}
3223
3224/// Methods declared on superclass `NSObject`.
3225impl MPSCNNNeuronExponentialNode {
3226    extern_methods!(
3227        #[unsafe(method(new))]
3228        #[unsafe(method_family = new)]
3229        pub unsafe fn new() -> Retained<Self>;
3230    );
3231}
3232
3233extern_class!(
3234    /// A node representing a MPSCNNNeuronLogarithm kernel
3235    ///
3236    /// For each pixel, applies the following function:
3237    ///
3238    /// ```text
3239    ///       f(x) = log_c(a * x + b)
3240    /// ```
3241    ///
3242    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronlogarithmnode?language=objc)
3243    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
3244    #[derive(Debug, PartialEq, Eq, Hash)]
3245    pub struct MPSCNNNeuronLogarithmNode;
3246);
3247
3248extern_conformance!(
3249    unsafe impl NSObjectProtocol for MPSCNNNeuronLogarithmNode {}
3250);
3251
3252impl MPSCNNNeuronLogarithmNode {
3253    extern_methods!(
3254        #[unsafe(method(nodeWithSource:a:b:c:))]
3255        #[unsafe(method_family = none)]
3256        pub unsafe fn nodeWithSource_a_b_c(
3257            source_node: &MPSNNImageNode,
3258            a: c_float,
3259            b: c_float,
3260            c: c_float,
3261        ) -> Retained<Self>;
3262
3263        /// Init a node representing a MPSCNNNeuronLogarithm kernel
3264        ///
3265        /// For each pixel, applies the following function:
3266        ///
3267        /// ```text
3268        ///       f(x) = log_c(a * x + b)
3269        /// ```
3270        ///
3271        ///
3272        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3273        ///
3274        /// Parameter `a`: See discussion above.
3275        ///
3276        /// Parameter `b`: See discussion above.
3277        ///
3278        /// Parameter `c`: See discussion above.
3279        ///
3280        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronLogarithm kernel.
3281        #[unsafe(method(initWithSource:a:b:c:))]
3282        #[unsafe(method_family = init)]
3283        pub unsafe fn initWithSource_a_b_c(
3284            this: Allocated<Self>,
3285            source_node: &MPSNNImageNode,
3286            a: c_float,
3287            b: c_float,
3288            c: c_float,
3289        ) -> Retained<Self>;
3290
3291        /// Create an autoreleased node with default values for parameters a, b, and c
3292        #[unsafe(method(nodeWithSource:))]
3293        #[unsafe(method_family = none)]
3294        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3295
3296        /// Init a node with default values for parameters a, b, and c
3297        #[unsafe(method(initWithSource:))]
3298        #[unsafe(method_family = init)]
3299        pub unsafe fn initWithSource(
3300            this: Allocated<Self>,
3301            source_node: &MPSNNImageNode,
3302        ) -> Retained<Self>;
3303    );
3304}
3305
3306/// Methods declared on superclass `MPSCNNNeuronNode`.
3307impl MPSCNNNeuronLogarithmNode {
3308    extern_methods!(
3309        #[cfg(feature = "MPSCNNNeuron")]
3310        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
3311        #[unsafe(method(nodeWithSource:descriptor:))]
3312        #[unsafe(method_family = none)]
3313        pub unsafe fn nodeWithSource_descriptor(
3314            source_node: &MPSNNImageNode,
3315            descriptor: &MPSNNNeuronDescriptor,
3316        ) -> Retained<Self>;
3317
3318        #[unsafe(method(init))]
3319        #[unsafe(method_family = init)]
3320        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3321    );
3322}
3323
3324/// Methods declared on superclass `NSObject`.
3325impl MPSCNNNeuronLogarithmNode {
3326    extern_methods!(
3327        #[unsafe(method(new))]
3328        #[unsafe(method_family = new)]
3329        pub unsafe fn new() -> Retained<Self>;
3330    );
3331}
3332
3333extern_class!(
3334    /// A node representing a MPSCNNNeuronGeLU kernel
3335    ///
3336    /// For each pixel, applies the following function:
3337    ///
3338    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneurongelunode?language=objc)
3339    #[unsafe(super(MPSCNNNeuronNode, MPSNNFilterNode, NSObject))]
3340    #[derive(Debug, PartialEq, Eq, Hash)]
3341    pub struct MPSCNNNeuronGeLUNode;
3342);
3343
3344extern_conformance!(
3345    unsafe impl NSObjectProtocol for MPSCNNNeuronGeLUNode {}
3346);
3347
3348impl MPSCNNNeuronGeLUNode {
3349    extern_methods!(
3350        /// Init a node representing a MPSCNNNeuronGeLU kernel
3351        ///
3352        /// For each pixel, applies the following function:
3353        ///
3354        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3355        ///
3356        /// Returns: A new MPSNNFilter node for a MPSCNNNeuronLogarithm kernel.
3357        #[unsafe(method(initWithSource:))]
3358        #[unsafe(method_family = init)]
3359        pub unsafe fn initWithSource(
3360            this: Allocated<Self>,
3361            source_node: &MPSNNImageNode,
3362        ) -> Retained<Self>;
3363
3364        /// Create an autoreleased node
3365        #[unsafe(method(nodeWithSource:))]
3366        #[unsafe(method_family = none)]
3367        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3368    );
3369}
3370
3371/// Methods declared on superclass `MPSCNNNeuronNode`.
3372impl MPSCNNNeuronGeLUNode {
3373    extern_methods!(
3374        #[cfg(feature = "MPSCNNNeuron")]
3375        /// Create a neuron node of the appropriate type with a MPSNNNeuronDescriptor
3376        #[unsafe(method(nodeWithSource:descriptor:))]
3377        #[unsafe(method_family = none)]
3378        pub unsafe fn nodeWithSource_descriptor(
3379            source_node: &MPSNNImageNode,
3380            descriptor: &MPSNNNeuronDescriptor,
3381        ) -> Retained<Self>;
3382
3383        #[unsafe(method(init))]
3384        #[unsafe(method_family = init)]
3385        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3386    );
3387}
3388
3389/// Methods declared on superclass `NSObject`.
3390impl MPSCNNNeuronGeLUNode {
3391    extern_methods!(
3392        #[unsafe(method(new))]
3393        #[unsafe(method_family = new)]
3394        pub unsafe fn new() -> Retained<Self>;
3395    );
3396}
3397
3398extern_class!(
3399    /// A node representing a MPSCNNNeuronGradient
3400    ///
3401    /// We use one generic neuron gradient node
3402    /// instead of having dozens of subclasses.
3403    ///
3404    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneurongradientnode?language=objc)
3405    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
3406    #[derive(Debug, PartialEq, Eq, Hash)]
3407    pub struct MPSCNNNeuronGradientNode;
3408);
3409
3410extern_conformance!(
3411    unsafe impl NSObjectProtocol for MPSCNNNeuronGradientNode {}
3412);
3413
3414impl MPSCNNNeuronGradientNode {
3415    extern_methods!(
3416        #[cfg(feature = "MPSCNNNeuron")]
3417        /// create a new neuron gradient node
3418        ///
3419        /// See also -[MPSCNNNeuronNode gradientFilterNodeWithSources:]
3420        /// for an easier way to do this
3421        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:descriptor:))]
3422        #[unsafe(method_family = none)]
3423        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_descriptor(
3424            source_gradient: &MPSNNImageNode,
3425            source_image: &MPSNNImageNode,
3426            gradient_state: &MPSNNGradientStateNode,
3427            descriptor: &MPSNNNeuronDescriptor,
3428        ) -> Retained<Self>;
3429
3430        #[cfg(feature = "MPSCNNNeuron")]
3431        /// create a new neuron gradient node
3432        ///
3433        /// See also -[MPSCNNNeuronNode gradientFilterNodeWithSources:]
3434        /// for an easier way to do this
3435        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:descriptor:))]
3436        #[unsafe(method_family = init)]
3437        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_descriptor(
3438            this: Allocated<Self>,
3439            source_gradient: &MPSNNImageNode,
3440            source_image: &MPSNNImageNode,
3441            gradient_state: &MPSNNGradientStateNode,
3442            descriptor: &MPSNNNeuronDescriptor,
3443        ) -> Retained<Self>;
3444
3445        #[cfg(feature = "MPSCNNNeuron")]
3446        /// The neuron descriptor
3447        #[unsafe(method(descriptor))]
3448        #[unsafe(method_family = none)]
3449        pub unsafe fn descriptor(&self) -> Retained<MPSNNNeuronDescriptor>;
3450
3451        #[unsafe(method(init))]
3452        #[unsafe(method_family = init)]
3453        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3454    );
3455}
3456
3457/// Methods declared on superclass `NSObject`.
3458impl MPSCNNNeuronGradientNode {
3459    extern_methods!(
3460        #[unsafe(method(new))]
3461        #[unsafe(method_family = new)]
3462        pub unsafe fn new() -> Retained<Self>;
3463    );
3464}
3465
3466extern_class!(
3467    /// A node for a unary MPSNNReduce node.
3468    ///
3469    /// This is an abstract base class that does not correspond with any
3470    /// particular MPSCNNKernel. Please make one of the MPSNNReduction
3471    /// subclasses instead.
3472    ///
3473    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnunaryreductionnode?language=objc)
3474    #[unsafe(super(MPSNNFilterNode, NSObject))]
3475    #[derive(Debug, PartialEq, Eq, Hash)]
3476    pub struct MPSNNUnaryReductionNode;
3477);
3478
3479extern_conformance!(
3480    unsafe impl NSObjectProtocol for MPSNNUnaryReductionNode {}
3481);
3482
3483impl MPSNNUnaryReductionNode {
3484    extern_methods!(
3485        /// The clip rectangle to apply to the source image.
3486        #[unsafe(method(clipRectSource))]
3487        #[unsafe(method_family = none)]
3488        pub unsafe fn clipRectSource(&self) -> MTLRegion;
3489
3490        /// Setter for [`clipRectSource`][Self::clipRectSource].
3491        #[unsafe(method(setClipRectSource:))]
3492        #[unsafe(method_family = none)]
3493        pub unsafe fn setClipRectSource(&self, clip_rect_source: MTLRegion);
3494
3495        /// Create an autoreleased node representing an MPS reduction kernel.
3496        ///
3497        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3498        ///
3499        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3500        #[unsafe(method(nodeWithSource:))]
3501        #[unsafe(method_family = none)]
3502        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3503
3504        /// Init a node representing an MPS reduction kernel.
3505        ///
3506        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3507        ///
3508        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3509        #[unsafe(method(initWithSource:))]
3510        #[unsafe(method_family = init)]
3511        pub unsafe fn initWithSource(
3512            this: Allocated<Self>,
3513            source_node: &MPSNNImageNode,
3514        ) -> Retained<Self>;
3515    );
3516}
3517
3518/// Methods declared on superclass `MPSNNFilterNode`.
3519impl MPSNNUnaryReductionNode {
3520    extern_methods!(
3521        #[unsafe(method(init))]
3522        #[unsafe(method_family = init)]
3523        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3524    );
3525}
3526
3527/// Methods declared on superclass `NSObject`.
3528impl MPSNNUnaryReductionNode {
3529    extern_methods!(
3530        #[unsafe(method(new))]
3531        #[unsafe(method_family = new)]
3532        pub unsafe fn new() -> Retained<Self>;
3533    );
3534}
3535
3536extern_class!(
3537    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionrowminnode?language=objc)
3538    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3539    #[derive(Debug, PartialEq, Eq, Hash)]
3540    pub struct MPSNNReductionRowMinNode;
3541);
3542
3543extern_conformance!(
3544    unsafe impl NSObjectProtocol for MPSNNReductionRowMinNode {}
3545);
3546
3547impl MPSNNReductionRowMinNode {
3548    extern_methods!();
3549}
3550
3551/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3552impl MPSNNReductionRowMinNode {
3553    extern_methods!(
3554        /// Create an autoreleased node representing an MPS reduction kernel.
3555        ///
3556        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3557        ///
3558        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3559        #[unsafe(method(nodeWithSource:))]
3560        #[unsafe(method_family = none)]
3561        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3562
3563        /// Init a node representing an MPS reduction kernel.
3564        ///
3565        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3566        ///
3567        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3568        #[unsafe(method(initWithSource:))]
3569        #[unsafe(method_family = init)]
3570        pub unsafe fn initWithSource(
3571            this: Allocated<Self>,
3572            source_node: &MPSNNImageNode,
3573        ) -> Retained<Self>;
3574    );
3575}
3576
3577/// Methods declared on superclass `MPSNNFilterNode`.
3578impl MPSNNReductionRowMinNode {
3579    extern_methods!(
3580        #[unsafe(method(init))]
3581        #[unsafe(method_family = init)]
3582        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3583    );
3584}
3585
3586/// Methods declared on superclass `NSObject`.
3587impl MPSNNReductionRowMinNode {
3588    extern_methods!(
3589        #[unsafe(method(new))]
3590        #[unsafe(method_family = new)]
3591        pub unsafe fn new() -> Retained<Self>;
3592    );
3593}
3594
3595extern_class!(
3596    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductioncolumnminnode?language=objc)
3597    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3598    #[derive(Debug, PartialEq, Eq, Hash)]
3599    pub struct MPSNNReductionColumnMinNode;
3600);
3601
3602extern_conformance!(
3603    unsafe impl NSObjectProtocol for MPSNNReductionColumnMinNode {}
3604);
3605
3606impl MPSNNReductionColumnMinNode {
3607    extern_methods!();
3608}
3609
3610/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3611impl MPSNNReductionColumnMinNode {
3612    extern_methods!(
3613        /// Create an autoreleased node representing an MPS reduction kernel.
3614        ///
3615        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3616        ///
3617        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3618        #[unsafe(method(nodeWithSource:))]
3619        #[unsafe(method_family = none)]
3620        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3621
3622        /// Init a node representing an MPS reduction kernel.
3623        ///
3624        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3625        ///
3626        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3627        #[unsafe(method(initWithSource:))]
3628        #[unsafe(method_family = init)]
3629        pub unsafe fn initWithSource(
3630            this: Allocated<Self>,
3631            source_node: &MPSNNImageNode,
3632        ) -> Retained<Self>;
3633    );
3634}
3635
3636/// Methods declared on superclass `MPSNNFilterNode`.
3637impl MPSNNReductionColumnMinNode {
3638    extern_methods!(
3639        #[unsafe(method(init))]
3640        #[unsafe(method_family = init)]
3641        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3642    );
3643}
3644
3645/// Methods declared on superclass `NSObject`.
3646impl MPSNNReductionColumnMinNode {
3647    extern_methods!(
3648        #[unsafe(method(new))]
3649        #[unsafe(method_family = new)]
3650        pub unsafe fn new() -> Retained<Self>;
3651    );
3652}
3653
3654extern_class!(
3655    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelsminnode?language=objc)
3656    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3657    #[derive(Debug, PartialEq, Eq, Hash)]
3658    pub struct MPSNNReductionFeatureChannelsMinNode;
3659);
3660
3661extern_conformance!(
3662    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsMinNode {}
3663);
3664
3665impl MPSNNReductionFeatureChannelsMinNode {
3666    extern_methods!();
3667}
3668
3669/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3670impl MPSNNReductionFeatureChannelsMinNode {
3671    extern_methods!(
3672        /// Create an autoreleased node representing an MPS reduction kernel.
3673        ///
3674        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3675        ///
3676        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3677        #[unsafe(method(nodeWithSource:))]
3678        #[unsafe(method_family = none)]
3679        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3680
3681        /// Init a node representing an MPS reduction kernel.
3682        ///
3683        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3684        ///
3685        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3686        #[unsafe(method(initWithSource:))]
3687        #[unsafe(method_family = init)]
3688        pub unsafe fn initWithSource(
3689            this: Allocated<Self>,
3690            source_node: &MPSNNImageNode,
3691        ) -> Retained<Self>;
3692    );
3693}
3694
3695/// Methods declared on superclass `MPSNNFilterNode`.
3696impl MPSNNReductionFeatureChannelsMinNode {
3697    extern_methods!(
3698        #[unsafe(method(init))]
3699        #[unsafe(method_family = init)]
3700        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3701    );
3702}
3703
3704/// Methods declared on superclass `NSObject`.
3705impl MPSNNReductionFeatureChannelsMinNode {
3706    extern_methods!(
3707        #[unsafe(method(new))]
3708        #[unsafe(method_family = new)]
3709        pub unsafe fn new() -> Retained<Self>;
3710    );
3711}
3712
3713extern_class!(
3714    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelsargumentminnode?language=objc)
3715    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3716    #[derive(Debug, PartialEq, Eq, Hash)]
3717    pub struct MPSNNReductionFeatureChannelsArgumentMinNode;
3718);
3719
3720extern_conformance!(
3721    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsArgumentMinNode {}
3722);
3723
3724impl MPSNNReductionFeatureChannelsArgumentMinNode {
3725    extern_methods!();
3726}
3727
3728/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3729impl MPSNNReductionFeatureChannelsArgumentMinNode {
3730    extern_methods!(
3731        /// Create an autoreleased node representing an MPS reduction kernel.
3732        ///
3733        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3734        ///
3735        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3736        #[unsafe(method(nodeWithSource:))]
3737        #[unsafe(method_family = none)]
3738        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3739
3740        /// Init a node representing an MPS reduction kernel.
3741        ///
3742        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3743        ///
3744        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3745        #[unsafe(method(initWithSource:))]
3746        #[unsafe(method_family = init)]
3747        pub unsafe fn initWithSource(
3748            this: Allocated<Self>,
3749            source_node: &MPSNNImageNode,
3750        ) -> Retained<Self>;
3751    );
3752}
3753
3754/// Methods declared on superclass `MPSNNFilterNode`.
3755impl MPSNNReductionFeatureChannelsArgumentMinNode {
3756    extern_methods!(
3757        #[unsafe(method(init))]
3758        #[unsafe(method_family = init)]
3759        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3760    );
3761}
3762
3763/// Methods declared on superclass `NSObject`.
3764impl MPSNNReductionFeatureChannelsArgumentMinNode {
3765    extern_methods!(
3766        #[unsafe(method(new))]
3767        #[unsafe(method_family = new)]
3768        pub unsafe fn new() -> Retained<Self>;
3769    );
3770}
3771
3772extern_class!(
3773    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionrowmaxnode?language=objc)
3774    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3775    #[derive(Debug, PartialEq, Eq, Hash)]
3776    pub struct MPSNNReductionRowMaxNode;
3777);
3778
3779extern_conformance!(
3780    unsafe impl NSObjectProtocol for MPSNNReductionRowMaxNode {}
3781);
3782
3783impl MPSNNReductionRowMaxNode {
3784    extern_methods!();
3785}
3786
3787/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3788impl MPSNNReductionRowMaxNode {
3789    extern_methods!(
3790        /// Create an autoreleased node representing an MPS reduction kernel.
3791        ///
3792        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3793        ///
3794        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3795        #[unsafe(method(nodeWithSource:))]
3796        #[unsafe(method_family = none)]
3797        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3798
3799        /// Init a node representing an MPS reduction kernel.
3800        ///
3801        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3802        ///
3803        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3804        #[unsafe(method(initWithSource:))]
3805        #[unsafe(method_family = init)]
3806        pub unsafe fn initWithSource(
3807            this: Allocated<Self>,
3808            source_node: &MPSNNImageNode,
3809        ) -> Retained<Self>;
3810    );
3811}
3812
3813/// Methods declared on superclass `MPSNNFilterNode`.
3814impl MPSNNReductionRowMaxNode {
3815    extern_methods!(
3816        #[unsafe(method(init))]
3817        #[unsafe(method_family = init)]
3818        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3819    );
3820}
3821
3822/// Methods declared on superclass `NSObject`.
3823impl MPSNNReductionRowMaxNode {
3824    extern_methods!(
3825        #[unsafe(method(new))]
3826        #[unsafe(method_family = new)]
3827        pub unsafe fn new() -> Retained<Self>;
3828    );
3829}
3830
3831extern_class!(
3832    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductioncolumnmaxnode?language=objc)
3833    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3834    #[derive(Debug, PartialEq, Eq, Hash)]
3835    pub struct MPSNNReductionColumnMaxNode;
3836);
3837
3838extern_conformance!(
3839    unsafe impl NSObjectProtocol for MPSNNReductionColumnMaxNode {}
3840);
3841
3842impl MPSNNReductionColumnMaxNode {
3843    extern_methods!();
3844}
3845
3846/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3847impl MPSNNReductionColumnMaxNode {
3848    extern_methods!(
3849        /// Create an autoreleased node representing an MPS reduction kernel.
3850        ///
3851        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3852        ///
3853        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3854        #[unsafe(method(nodeWithSource:))]
3855        #[unsafe(method_family = none)]
3856        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3857
3858        /// Init a node representing an MPS reduction kernel.
3859        ///
3860        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3861        ///
3862        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3863        #[unsafe(method(initWithSource:))]
3864        #[unsafe(method_family = init)]
3865        pub unsafe fn initWithSource(
3866            this: Allocated<Self>,
3867            source_node: &MPSNNImageNode,
3868        ) -> Retained<Self>;
3869    );
3870}
3871
3872/// Methods declared on superclass `MPSNNFilterNode`.
3873impl MPSNNReductionColumnMaxNode {
3874    extern_methods!(
3875        #[unsafe(method(init))]
3876        #[unsafe(method_family = init)]
3877        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3878    );
3879}
3880
3881/// Methods declared on superclass `NSObject`.
3882impl MPSNNReductionColumnMaxNode {
3883    extern_methods!(
3884        #[unsafe(method(new))]
3885        #[unsafe(method_family = new)]
3886        pub unsafe fn new() -> Retained<Self>;
3887    );
3888}
3889
3890extern_class!(
3891    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelsmaxnode?language=objc)
3892    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3893    #[derive(Debug, PartialEq, Eq, Hash)]
3894    pub struct MPSNNReductionFeatureChannelsMaxNode;
3895);
3896
3897extern_conformance!(
3898    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsMaxNode {}
3899);
3900
3901impl MPSNNReductionFeatureChannelsMaxNode {
3902    extern_methods!();
3903}
3904
3905/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3906impl MPSNNReductionFeatureChannelsMaxNode {
3907    extern_methods!(
3908        /// Create an autoreleased node representing an MPS reduction kernel.
3909        ///
3910        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3911        ///
3912        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3913        #[unsafe(method(nodeWithSource:))]
3914        #[unsafe(method_family = none)]
3915        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3916
3917        /// Init a node representing an MPS reduction kernel.
3918        ///
3919        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3920        ///
3921        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3922        #[unsafe(method(initWithSource:))]
3923        #[unsafe(method_family = init)]
3924        pub unsafe fn initWithSource(
3925            this: Allocated<Self>,
3926            source_node: &MPSNNImageNode,
3927        ) -> Retained<Self>;
3928    );
3929}
3930
3931/// Methods declared on superclass `MPSNNFilterNode`.
3932impl MPSNNReductionFeatureChannelsMaxNode {
3933    extern_methods!(
3934        #[unsafe(method(init))]
3935        #[unsafe(method_family = init)]
3936        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3937    );
3938}
3939
3940/// Methods declared on superclass `NSObject`.
3941impl MPSNNReductionFeatureChannelsMaxNode {
3942    extern_methods!(
3943        #[unsafe(method(new))]
3944        #[unsafe(method_family = new)]
3945        pub unsafe fn new() -> Retained<Self>;
3946    );
3947}
3948
3949extern_class!(
3950    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelsargumentmaxnode?language=objc)
3951    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
3952    #[derive(Debug, PartialEq, Eq, Hash)]
3953    pub struct MPSNNReductionFeatureChannelsArgumentMaxNode;
3954);
3955
3956extern_conformance!(
3957    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsArgumentMaxNode {}
3958);
3959
3960impl MPSNNReductionFeatureChannelsArgumentMaxNode {
3961    extern_methods!();
3962}
3963
3964/// Methods declared on superclass `MPSNNUnaryReductionNode`.
3965impl MPSNNReductionFeatureChannelsArgumentMaxNode {
3966    extern_methods!(
3967        /// Create an autoreleased node representing an MPS reduction kernel.
3968        ///
3969        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3970        ///
3971        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3972        #[unsafe(method(nodeWithSource:))]
3973        #[unsafe(method_family = none)]
3974        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
3975
3976        /// Init a node representing an MPS reduction kernel.
3977        ///
3978        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
3979        ///
3980        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
3981        #[unsafe(method(initWithSource:))]
3982        #[unsafe(method_family = init)]
3983        pub unsafe fn initWithSource(
3984            this: Allocated<Self>,
3985            source_node: &MPSNNImageNode,
3986        ) -> Retained<Self>;
3987    );
3988}
3989
3990/// Methods declared on superclass `MPSNNFilterNode`.
3991impl MPSNNReductionFeatureChannelsArgumentMaxNode {
3992    extern_methods!(
3993        #[unsafe(method(init))]
3994        #[unsafe(method_family = init)]
3995        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
3996    );
3997}
3998
3999/// Methods declared on superclass `NSObject`.
4000impl MPSNNReductionFeatureChannelsArgumentMaxNode {
4001    extern_methods!(
4002        #[unsafe(method(new))]
4003        #[unsafe(method_family = new)]
4004        pub unsafe fn new() -> Retained<Self>;
4005    );
4006}
4007
4008extern_class!(
4009    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionrowmeannode?language=objc)
4010    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4011    #[derive(Debug, PartialEq, Eq, Hash)]
4012    pub struct MPSNNReductionRowMeanNode;
4013);
4014
4015extern_conformance!(
4016    unsafe impl NSObjectProtocol for MPSNNReductionRowMeanNode {}
4017);
4018
4019impl MPSNNReductionRowMeanNode {
4020    extern_methods!();
4021}
4022
4023/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4024impl MPSNNReductionRowMeanNode {
4025    extern_methods!(
4026        /// Create an autoreleased node representing an MPS reduction kernel.
4027        ///
4028        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4029        ///
4030        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4031        #[unsafe(method(nodeWithSource:))]
4032        #[unsafe(method_family = none)]
4033        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4034
4035        /// Init a node representing an MPS reduction kernel.
4036        ///
4037        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4038        ///
4039        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4040        #[unsafe(method(initWithSource:))]
4041        #[unsafe(method_family = init)]
4042        pub unsafe fn initWithSource(
4043            this: Allocated<Self>,
4044            source_node: &MPSNNImageNode,
4045        ) -> Retained<Self>;
4046    );
4047}
4048
4049/// Methods declared on superclass `MPSNNFilterNode`.
4050impl MPSNNReductionRowMeanNode {
4051    extern_methods!(
4052        #[unsafe(method(init))]
4053        #[unsafe(method_family = init)]
4054        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4055    );
4056}
4057
4058/// Methods declared on superclass `NSObject`.
4059impl MPSNNReductionRowMeanNode {
4060    extern_methods!(
4061        #[unsafe(method(new))]
4062        #[unsafe(method_family = new)]
4063        pub unsafe fn new() -> Retained<Self>;
4064    );
4065}
4066
4067extern_class!(
4068    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductioncolumnmeannode?language=objc)
4069    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4070    #[derive(Debug, PartialEq, Eq, Hash)]
4071    pub struct MPSNNReductionColumnMeanNode;
4072);
4073
4074extern_conformance!(
4075    unsafe impl NSObjectProtocol for MPSNNReductionColumnMeanNode {}
4076);
4077
4078impl MPSNNReductionColumnMeanNode {
4079    extern_methods!();
4080}
4081
4082/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4083impl MPSNNReductionColumnMeanNode {
4084    extern_methods!(
4085        /// Create an autoreleased node representing an MPS reduction kernel.
4086        ///
4087        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4088        ///
4089        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4090        #[unsafe(method(nodeWithSource:))]
4091        #[unsafe(method_family = none)]
4092        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4093
4094        /// Init a node representing an MPS reduction kernel.
4095        ///
4096        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4097        ///
4098        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4099        #[unsafe(method(initWithSource:))]
4100        #[unsafe(method_family = init)]
4101        pub unsafe fn initWithSource(
4102            this: Allocated<Self>,
4103            source_node: &MPSNNImageNode,
4104        ) -> Retained<Self>;
4105    );
4106}
4107
4108/// Methods declared on superclass `MPSNNFilterNode`.
4109impl MPSNNReductionColumnMeanNode {
4110    extern_methods!(
4111        #[unsafe(method(init))]
4112        #[unsafe(method_family = init)]
4113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4114    );
4115}
4116
4117/// Methods declared on superclass `NSObject`.
4118impl MPSNNReductionColumnMeanNode {
4119    extern_methods!(
4120        #[unsafe(method(new))]
4121        #[unsafe(method_family = new)]
4122        pub unsafe fn new() -> Retained<Self>;
4123    );
4124}
4125
4126extern_class!(
4127    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelsmeannode?language=objc)
4128    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4129    #[derive(Debug, PartialEq, Eq, Hash)]
4130    pub struct MPSNNReductionFeatureChannelsMeanNode;
4131);
4132
4133extern_conformance!(
4134    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsMeanNode {}
4135);
4136
4137impl MPSNNReductionFeatureChannelsMeanNode {
4138    extern_methods!();
4139}
4140
4141/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4142impl MPSNNReductionFeatureChannelsMeanNode {
4143    extern_methods!(
4144        /// Create an autoreleased node representing an MPS reduction kernel.
4145        ///
4146        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4147        ///
4148        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4149        #[unsafe(method(nodeWithSource:))]
4150        #[unsafe(method_family = none)]
4151        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4152
4153        /// Init a node representing an MPS reduction kernel.
4154        ///
4155        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4156        ///
4157        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4158        #[unsafe(method(initWithSource:))]
4159        #[unsafe(method_family = init)]
4160        pub unsafe fn initWithSource(
4161            this: Allocated<Self>,
4162            source_node: &MPSNNImageNode,
4163        ) -> Retained<Self>;
4164    );
4165}
4166
4167/// Methods declared on superclass `MPSNNFilterNode`.
4168impl MPSNNReductionFeatureChannelsMeanNode {
4169    extern_methods!(
4170        #[unsafe(method(init))]
4171        #[unsafe(method_family = init)]
4172        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4173    );
4174}
4175
4176/// Methods declared on superclass `NSObject`.
4177impl MPSNNReductionFeatureChannelsMeanNode {
4178    extern_methods!(
4179        #[unsafe(method(new))]
4180        #[unsafe(method_family = new)]
4181        pub unsafe fn new() -> Retained<Self>;
4182    );
4183}
4184
4185extern_class!(
4186    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionspatialmeannode?language=objc)
4187    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4188    #[derive(Debug, PartialEq, Eq, Hash)]
4189    pub struct MPSNNReductionSpatialMeanNode;
4190);
4191
4192extern_conformance!(
4193    unsafe impl NSObjectProtocol for MPSNNReductionSpatialMeanNode {}
4194);
4195
4196impl MPSNNReductionSpatialMeanNode {
4197    extern_methods!();
4198}
4199
4200/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4201impl MPSNNReductionSpatialMeanNode {
4202    extern_methods!(
4203        /// Create an autoreleased node representing an MPS reduction kernel.
4204        ///
4205        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4206        ///
4207        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4208        #[unsafe(method(nodeWithSource:))]
4209        #[unsafe(method_family = none)]
4210        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4211
4212        /// Init a node representing an MPS reduction kernel.
4213        ///
4214        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4215        ///
4216        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4217        #[unsafe(method(initWithSource:))]
4218        #[unsafe(method_family = init)]
4219        pub unsafe fn initWithSource(
4220            this: Allocated<Self>,
4221            source_node: &MPSNNImageNode,
4222        ) -> Retained<Self>;
4223    );
4224}
4225
4226/// Methods declared on superclass `MPSNNFilterNode`.
4227impl MPSNNReductionSpatialMeanNode {
4228    extern_methods!(
4229        #[unsafe(method(init))]
4230        #[unsafe(method_family = init)]
4231        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4232    );
4233}
4234
4235/// Methods declared on superclass `NSObject`.
4236impl MPSNNReductionSpatialMeanNode {
4237    extern_methods!(
4238        #[unsafe(method(new))]
4239        #[unsafe(method_family = new)]
4240        pub unsafe fn new() -> Retained<Self>;
4241    );
4242}
4243
4244extern_class!(
4245    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionrowsumnode?language=objc)
4246    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4247    #[derive(Debug, PartialEq, Eq, Hash)]
4248    pub struct MPSNNReductionRowSumNode;
4249);
4250
4251extern_conformance!(
4252    unsafe impl NSObjectProtocol for MPSNNReductionRowSumNode {}
4253);
4254
4255impl MPSNNReductionRowSumNode {
4256    extern_methods!();
4257}
4258
4259/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4260impl MPSNNReductionRowSumNode {
4261    extern_methods!(
4262        /// Create an autoreleased node representing an MPS reduction kernel.
4263        ///
4264        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4265        ///
4266        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4267        #[unsafe(method(nodeWithSource:))]
4268        #[unsafe(method_family = none)]
4269        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4270
4271        /// Init a node representing an MPS reduction kernel.
4272        ///
4273        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4274        ///
4275        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4276        #[unsafe(method(initWithSource:))]
4277        #[unsafe(method_family = init)]
4278        pub unsafe fn initWithSource(
4279            this: Allocated<Self>,
4280            source_node: &MPSNNImageNode,
4281        ) -> Retained<Self>;
4282    );
4283}
4284
4285/// Methods declared on superclass `MPSNNFilterNode`.
4286impl MPSNNReductionRowSumNode {
4287    extern_methods!(
4288        #[unsafe(method(init))]
4289        #[unsafe(method_family = init)]
4290        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4291    );
4292}
4293
4294/// Methods declared on superclass `NSObject`.
4295impl MPSNNReductionRowSumNode {
4296    extern_methods!(
4297        #[unsafe(method(new))]
4298        #[unsafe(method_family = new)]
4299        pub unsafe fn new() -> Retained<Self>;
4300    );
4301}
4302
4303extern_class!(
4304    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductioncolumnsumnode?language=objc)
4305    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4306    #[derive(Debug, PartialEq, Eq, Hash)]
4307    pub struct MPSNNReductionColumnSumNode;
4308);
4309
4310extern_conformance!(
4311    unsafe impl NSObjectProtocol for MPSNNReductionColumnSumNode {}
4312);
4313
4314impl MPSNNReductionColumnSumNode {
4315    extern_methods!();
4316}
4317
4318/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4319impl MPSNNReductionColumnSumNode {
4320    extern_methods!(
4321        /// Create an autoreleased node representing an MPS reduction kernel.
4322        ///
4323        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4324        ///
4325        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4326        #[unsafe(method(nodeWithSource:))]
4327        #[unsafe(method_family = none)]
4328        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4329
4330        /// Init a node representing an MPS reduction kernel.
4331        ///
4332        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4333        ///
4334        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4335        #[unsafe(method(initWithSource:))]
4336        #[unsafe(method_family = init)]
4337        pub unsafe fn initWithSource(
4338            this: Allocated<Self>,
4339            source_node: &MPSNNImageNode,
4340        ) -> Retained<Self>;
4341    );
4342}
4343
4344/// Methods declared on superclass `MPSNNFilterNode`.
4345impl MPSNNReductionColumnSumNode {
4346    extern_methods!(
4347        #[unsafe(method(init))]
4348        #[unsafe(method_family = init)]
4349        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4350    );
4351}
4352
4353/// Methods declared on superclass `NSObject`.
4354impl MPSNNReductionColumnSumNode {
4355    extern_methods!(
4356        #[unsafe(method(new))]
4357        #[unsafe(method_family = new)]
4358        pub unsafe fn new() -> Retained<Self>;
4359    );
4360}
4361
4362extern_class!(
4363    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionfeaturechannelssumnode?language=objc)
4364    #[unsafe(super(MPSNNUnaryReductionNode, MPSNNFilterNode, NSObject))]
4365    #[derive(Debug, PartialEq, Eq, Hash)]
4366    pub struct MPSNNReductionFeatureChannelsSumNode;
4367);
4368
4369extern_conformance!(
4370    unsafe impl NSObjectProtocol for MPSNNReductionFeatureChannelsSumNode {}
4371);
4372
4373impl MPSNNReductionFeatureChannelsSumNode {
4374    extern_methods!(
4375        /// A scale factor to apply to each feature channel sum.
4376        #[unsafe(method(weight))]
4377        #[unsafe(method_family = none)]
4378        pub unsafe fn weight(&self) -> c_float;
4379
4380        /// Setter for [`weight`][Self::weight].
4381        #[unsafe(method(setWeight:))]
4382        #[unsafe(method_family = none)]
4383        pub unsafe fn setWeight(&self, weight: c_float);
4384    );
4385}
4386
4387/// Methods declared on superclass `MPSNNUnaryReductionNode`.
4388impl MPSNNReductionFeatureChannelsSumNode {
4389    extern_methods!(
4390        /// Create an autoreleased node representing an MPS reduction kernel.
4391        ///
4392        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4393        ///
4394        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4395        #[unsafe(method(nodeWithSource:))]
4396        #[unsafe(method_family = none)]
4397        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
4398
4399        /// Init a node representing an MPS reduction kernel.
4400        ///
4401        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4402        ///
4403        /// Returns: A new MPSNNFilter node for an MPS reduction kernel.
4404        #[unsafe(method(initWithSource:))]
4405        #[unsafe(method_family = init)]
4406        pub unsafe fn initWithSource(
4407            this: Allocated<Self>,
4408            source_node: &MPSNNImageNode,
4409        ) -> Retained<Self>;
4410    );
4411}
4412
4413/// Methods declared on superclass `MPSNNFilterNode`.
4414impl MPSNNReductionFeatureChannelsSumNode {
4415    extern_methods!(
4416        #[unsafe(method(init))]
4417        #[unsafe(method_family = init)]
4418        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4419    );
4420}
4421
4422/// Methods declared on superclass `NSObject`.
4423impl MPSNNReductionFeatureChannelsSumNode {
4424    extern_methods!(
4425        #[unsafe(method(new))]
4426        #[unsafe(method_family = new)]
4427        pub unsafe fn new() -> Retained<Self>;
4428    );
4429}
4430
4431extern_class!(
4432    /// A node for a MPSCNNPooling kernel
4433    ///
4434    /// This is an abstract base class that does not correspond with any
4435    /// particular MPSCNNKernel. Please make one of the MPSCNNPooling
4436    /// subclasses instead.
4437    ///
4438    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingnode?language=objc)
4439    #[unsafe(super(MPSNNFilterNode, NSObject))]
4440    #[derive(Debug, PartialEq, Eq, Hash)]
4441    pub struct MPSCNNPoolingNode;
4442);
4443
4444extern_conformance!(
4445    unsafe impl NSObjectProtocol for MPSCNNPoolingNode {}
4446);
4447
4448impl MPSCNNPoolingNode {
4449    extern_methods!(
4450        #[unsafe(method(kernelWidth))]
4451        #[unsafe(method_family = none)]
4452        pub unsafe fn kernelWidth(&self) -> NSUInteger;
4453
4454        #[unsafe(method(kernelHeight))]
4455        #[unsafe(method_family = none)]
4456        pub unsafe fn kernelHeight(&self) -> NSUInteger;
4457
4458        #[unsafe(method(strideInPixelsX))]
4459        #[unsafe(method_family = none)]
4460        pub unsafe fn strideInPixelsX(&self) -> NSUInteger;
4461
4462        #[unsafe(method(strideInPixelsY))]
4463        #[unsafe(method_family = none)]
4464        pub unsafe fn strideInPixelsY(&self) -> NSUInteger;
4465
4466        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4467        ///
4468        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4469        ///
4470        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4471        ///
4472        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4473        #[unsafe(method(nodeWithSource:filterSize:))]
4474        #[unsafe(method_family = none)]
4475        pub unsafe fn nodeWithSource_filterSize(
4476            source_node: &MPSNNImageNode,
4477            size: NSUInteger,
4478        ) -> Retained<Self>;
4479
4480        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels and a different stride
4481        ///
4482        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4483        ///
4484        /// Parameter `size`: kernelWidth = kernelHeight = size
4485        ///
4486        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4487        ///
4488        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4489        #[unsafe(method(nodeWithSource:filterSize:stride:))]
4490        #[unsafe(method_family = none)]
4491        pub unsafe fn nodeWithSource_filterSize_stride(
4492            source_node: &MPSNNImageNode,
4493            size: NSUInteger,
4494            stride: NSUInteger,
4495        ) -> Retained<Self>;
4496
4497        /// Init a node representing a MPSCNNPooling kernel
4498        ///
4499        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4500        ///
4501        /// Parameter `kernelWidth`: The width of the max filter window
4502        ///
4503        /// Parameter `kernelHeight`: The height of the max filter window
4504        ///
4505        /// Parameter `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
4506        ///
4507        /// Parameter `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.
4508        ///
4509        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4510        #[unsafe(method(initWithSource:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:))]
4511        #[unsafe(method_family = init)]
4512        pub unsafe fn initWithSource_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY(
4513            this: Allocated<Self>,
4514            source_node: &MPSNNImageNode,
4515            kernel_width: NSUInteger,
4516            kernel_height: NSUInteger,
4517            stride_in_pixels_x: NSUInteger,
4518            stride_in_pixels_y: NSUInteger,
4519        ) -> Retained<Self>;
4520
4521        /// Convenience initializer for MPSCNNPooling nodes with square kernels
4522        ///
4523        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4524        ///
4525        /// Parameter `size`: kernelWidth = kernelHeight = size
4526        ///
4527        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4528        ///
4529        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4530        #[unsafe(method(initWithSource:filterSize:stride:))]
4531        #[unsafe(method_family = init)]
4532        pub unsafe fn initWithSource_filterSize_stride(
4533            this: Allocated<Self>,
4534            source_node: &MPSNNImageNode,
4535            size: NSUInteger,
4536            stride: NSUInteger,
4537        ) -> Retained<Self>;
4538
4539        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4540        ///
4541        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4542        ///
4543        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4544        ///
4545        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4546        #[unsafe(method(initWithSource:filterSize:))]
4547        #[unsafe(method_family = init)]
4548        pub unsafe fn initWithSource_filterSize(
4549            this: Allocated<Self>,
4550            source_node: &MPSNNImageNode,
4551            size: NSUInteger,
4552        ) -> Retained<Self>;
4553    );
4554}
4555
4556/// Methods declared on superclass `MPSNNFilterNode`.
4557impl MPSCNNPoolingNode {
4558    extern_methods!(
4559        #[unsafe(method(init))]
4560        #[unsafe(method_family = init)]
4561        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4562    );
4563}
4564
4565/// Methods declared on superclass `NSObject`.
4566impl MPSCNNPoolingNode {
4567    extern_methods!(
4568        #[unsafe(method(new))]
4569        #[unsafe(method_family = new)]
4570        pub unsafe fn new() -> Retained<Self>;
4571    );
4572}
4573
4574extern_class!(
4575    /// A node representing a MPSCNNPoolingAverage kernel
4576    ///
4577    /// The default edge mode is MPSImageEdgeModeClamp
4578    ///
4579    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingaveragenode?language=objc)
4580    #[unsafe(super(MPSCNNPoolingNode, MPSNNFilterNode, NSObject))]
4581    #[derive(Debug, PartialEq, Eq, Hash)]
4582    pub struct MPSCNNPoolingAverageNode;
4583);
4584
4585extern_conformance!(
4586    unsafe impl NSObjectProtocol for MPSCNNPoolingAverageNode {}
4587);
4588
4589impl MPSCNNPoolingAverageNode {
4590    extern_methods!();
4591}
4592
4593/// Methods declared on superclass `MPSCNNPoolingNode`.
4594impl MPSCNNPoolingAverageNode {
4595    extern_methods!(
4596        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4597        ///
4598        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4599        ///
4600        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4601        ///
4602        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4603        #[unsafe(method(nodeWithSource:filterSize:))]
4604        #[unsafe(method_family = none)]
4605        pub unsafe fn nodeWithSource_filterSize(
4606            source_node: &MPSNNImageNode,
4607            size: NSUInteger,
4608        ) -> Retained<Self>;
4609
4610        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels and a different stride
4611        ///
4612        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4613        ///
4614        /// Parameter `size`: kernelWidth = kernelHeight = size
4615        ///
4616        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4617        ///
4618        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4619        #[unsafe(method(nodeWithSource:filterSize:stride:))]
4620        #[unsafe(method_family = none)]
4621        pub unsafe fn nodeWithSource_filterSize_stride(
4622            source_node: &MPSNNImageNode,
4623            size: NSUInteger,
4624            stride: NSUInteger,
4625        ) -> Retained<Self>;
4626
4627        /// Init a node representing a MPSCNNPooling kernel
4628        ///
4629        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4630        ///
4631        /// Parameter `kernelWidth`: The width of the max filter window
4632        ///
4633        /// Parameter `kernelHeight`: The height of the max filter window
4634        ///
4635        /// Parameter `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
4636        ///
4637        /// Parameter `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.
4638        ///
4639        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4640        #[unsafe(method(initWithSource:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:))]
4641        #[unsafe(method_family = init)]
4642        pub unsafe fn initWithSource_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY(
4643            this: Allocated<Self>,
4644            source_node: &MPSNNImageNode,
4645            kernel_width: NSUInteger,
4646            kernel_height: NSUInteger,
4647            stride_in_pixels_x: NSUInteger,
4648            stride_in_pixels_y: NSUInteger,
4649        ) -> Retained<Self>;
4650
4651        /// Convenience initializer for MPSCNNPooling nodes with square kernels
4652        ///
4653        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4654        ///
4655        /// Parameter `size`: kernelWidth = kernelHeight = size
4656        ///
4657        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4658        ///
4659        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4660        #[unsafe(method(initWithSource:filterSize:stride:))]
4661        #[unsafe(method_family = init)]
4662        pub unsafe fn initWithSource_filterSize_stride(
4663            this: Allocated<Self>,
4664            source_node: &MPSNNImageNode,
4665            size: NSUInteger,
4666            stride: NSUInteger,
4667        ) -> Retained<Self>;
4668
4669        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4670        ///
4671        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4672        ///
4673        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4674        ///
4675        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4676        #[unsafe(method(initWithSource:filterSize:))]
4677        #[unsafe(method_family = init)]
4678        pub unsafe fn initWithSource_filterSize(
4679            this: Allocated<Self>,
4680            source_node: &MPSNNImageNode,
4681            size: NSUInteger,
4682        ) -> Retained<Self>;
4683    );
4684}
4685
4686/// Methods declared on superclass `MPSNNFilterNode`.
4687impl MPSCNNPoolingAverageNode {
4688    extern_methods!(
4689        #[unsafe(method(init))]
4690        #[unsafe(method_family = init)]
4691        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4692    );
4693}
4694
4695/// Methods declared on superclass `NSObject`.
4696impl MPSCNNPoolingAverageNode {
4697    extern_methods!(
4698        #[unsafe(method(new))]
4699        #[unsafe(method_family = new)]
4700        pub unsafe fn new() -> Retained<Self>;
4701    );
4702}
4703
4704extern_class!(
4705    /// A node representing a MPSCNNPoolingL2Norm kernel
4706    ///
4707    /// The default edge mode is MPSImageEdgeModeClamp
4708    ///
4709    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingl2normnode?language=objc)
4710    #[unsafe(super(MPSCNNPoolingNode, MPSNNFilterNode, NSObject))]
4711    #[derive(Debug, PartialEq, Eq, Hash)]
4712    pub struct MPSCNNPoolingL2NormNode;
4713);
4714
4715extern_conformance!(
4716    unsafe impl NSObjectProtocol for MPSCNNPoolingL2NormNode {}
4717);
4718
4719impl MPSCNNPoolingL2NormNode {
4720    extern_methods!();
4721}
4722
4723/// Methods declared on superclass `MPSCNNPoolingNode`.
4724impl MPSCNNPoolingL2NormNode {
4725    extern_methods!(
4726        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4727        ///
4728        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4729        ///
4730        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4731        ///
4732        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4733        #[unsafe(method(nodeWithSource:filterSize:))]
4734        #[unsafe(method_family = none)]
4735        pub unsafe fn nodeWithSource_filterSize(
4736            source_node: &MPSNNImageNode,
4737            size: NSUInteger,
4738        ) -> Retained<Self>;
4739
4740        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels and a different stride
4741        ///
4742        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4743        ///
4744        /// Parameter `size`: kernelWidth = kernelHeight = size
4745        ///
4746        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4747        ///
4748        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4749        #[unsafe(method(nodeWithSource:filterSize:stride:))]
4750        #[unsafe(method_family = none)]
4751        pub unsafe fn nodeWithSource_filterSize_stride(
4752            source_node: &MPSNNImageNode,
4753            size: NSUInteger,
4754            stride: NSUInteger,
4755        ) -> Retained<Self>;
4756
4757        /// Init a node representing a MPSCNNPooling kernel
4758        ///
4759        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4760        ///
4761        /// Parameter `kernelWidth`: The width of the max filter window
4762        ///
4763        /// Parameter `kernelHeight`: The height of the max filter window
4764        ///
4765        /// Parameter `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
4766        ///
4767        /// Parameter `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.
4768        ///
4769        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4770        #[unsafe(method(initWithSource:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:))]
4771        #[unsafe(method_family = init)]
4772        pub unsafe fn initWithSource_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY(
4773            this: Allocated<Self>,
4774            source_node: &MPSNNImageNode,
4775            kernel_width: NSUInteger,
4776            kernel_height: NSUInteger,
4777            stride_in_pixels_x: NSUInteger,
4778            stride_in_pixels_y: NSUInteger,
4779        ) -> Retained<Self>;
4780
4781        /// Convenience initializer for MPSCNNPooling nodes with square kernels
4782        ///
4783        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4784        ///
4785        /// Parameter `size`: kernelWidth = kernelHeight = size
4786        ///
4787        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4788        ///
4789        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4790        #[unsafe(method(initWithSource:filterSize:stride:))]
4791        #[unsafe(method_family = init)]
4792        pub unsafe fn initWithSource_filterSize_stride(
4793            this: Allocated<Self>,
4794            source_node: &MPSNNImageNode,
4795            size: NSUInteger,
4796            stride: NSUInteger,
4797        ) -> Retained<Self>;
4798
4799        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4800        ///
4801        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4802        ///
4803        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4804        ///
4805        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4806        #[unsafe(method(initWithSource:filterSize:))]
4807        #[unsafe(method_family = init)]
4808        pub unsafe fn initWithSource_filterSize(
4809            this: Allocated<Self>,
4810            source_node: &MPSNNImageNode,
4811            size: NSUInteger,
4812        ) -> Retained<Self>;
4813    );
4814}
4815
4816/// Methods declared on superclass `MPSNNFilterNode`.
4817impl MPSCNNPoolingL2NormNode {
4818    extern_methods!(
4819        #[unsafe(method(init))]
4820        #[unsafe(method_family = init)]
4821        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4822    );
4823}
4824
4825/// Methods declared on superclass `NSObject`.
4826impl MPSCNNPoolingL2NormNode {
4827    extern_methods!(
4828        #[unsafe(method(new))]
4829        #[unsafe(method_family = new)]
4830        pub unsafe fn new() -> Retained<Self>;
4831    );
4832}
4833
4834extern_class!(
4835    /// A node representing a MPSCNNPoolingMax kernel
4836    ///
4837    /// The default edge mode is MPSImageEdgeModeClamp
4838    ///
4839    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingmaxnode?language=objc)
4840    #[unsafe(super(MPSCNNPoolingNode, MPSNNFilterNode, NSObject))]
4841    #[derive(Debug, PartialEq, Eq, Hash)]
4842    pub struct MPSCNNPoolingMaxNode;
4843);
4844
4845extern_conformance!(
4846    unsafe impl NSObjectProtocol for MPSCNNPoolingMaxNode {}
4847);
4848
4849impl MPSCNNPoolingMaxNode {
4850    extern_methods!();
4851}
4852
4853/// Methods declared on superclass `MPSCNNPoolingNode`.
4854impl MPSCNNPoolingMaxNode {
4855    extern_methods!(
4856        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4857        ///
4858        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4859        ///
4860        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4861        ///
4862        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4863        #[unsafe(method(nodeWithSource:filterSize:))]
4864        #[unsafe(method_family = none)]
4865        pub unsafe fn nodeWithSource_filterSize(
4866            source_node: &MPSNNImageNode,
4867            size: NSUInteger,
4868        ) -> Retained<Self>;
4869
4870        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels and a different stride
4871        ///
4872        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4873        ///
4874        /// Parameter `size`: kernelWidth = kernelHeight = size
4875        ///
4876        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4877        ///
4878        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4879        #[unsafe(method(nodeWithSource:filterSize:stride:))]
4880        #[unsafe(method_family = none)]
4881        pub unsafe fn nodeWithSource_filterSize_stride(
4882            source_node: &MPSNNImageNode,
4883            size: NSUInteger,
4884            stride: NSUInteger,
4885        ) -> Retained<Self>;
4886
4887        /// Init a node representing a MPSCNNPooling kernel
4888        ///
4889        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4890        ///
4891        /// Parameter `kernelWidth`: The width of the max filter window
4892        ///
4893        /// Parameter `kernelHeight`: The height of the max filter window
4894        ///
4895        /// Parameter `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
4896        ///
4897        /// Parameter `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.
4898        ///
4899        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4900        #[unsafe(method(initWithSource:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:))]
4901        #[unsafe(method_family = init)]
4902        pub unsafe fn initWithSource_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY(
4903            this: Allocated<Self>,
4904            source_node: &MPSNNImageNode,
4905            kernel_width: NSUInteger,
4906            kernel_height: NSUInteger,
4907            stride_in_pixels_x: NSUInteger,
4908            stride_in_pixels_y: NSUInteger,
4909        ) -> Retained<Self>;
4910
4911        /// Convenience initializer for MPSCNNPooling nodes with square kernels
4912        ///
4913        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4914        ///
4915        /// Parameter `size`: kernelWidth = kernelHeight = size
4916        ///
4917        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
4918        ///
4919        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4920        #[unsafe(method(initWithSource:filterSize:stride:))]
4921        #[unsafe(method_family = init)]
4922        pub unsafe fn initWithSource_filterSize_stride(
4923            this: Allocated<Self>,
4924            source_node: &MPSNNImageNode,
4925            size: NSUInteger,
4926            stride: NSUInteger,
4927        ) -> Retained<Self>;
4928
4929        /// Convenience initializer for MPSCNNPooling nodes with square non-overlapping kernels
4930        ///
4931        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4932        ///
4933        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = size
4934        ///
4935        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
4936        #[unsafe(method(initWithSource:filterSize:))]
4937        #[unsafe(method_family = init)]
4938        pub unsafe fn initWithSource_filterSize(
4939            this: Allocated<Self>,
4940            source_node: &MPSNNImageNode,
4941            size: NSUInteger,
4942        ) -> Retained<Self>;
4943    );
4944}
4945
4946/// Methods declared on superclass `MPSNNFilterNode`.
4947impl MPSCNNPoolingMaxNode {
4948    extern_methods!(
4949        #[unsafe(method(init))]
4950        #[unsafe(method_family = init)]
4951        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
4952    );
4953}
4954
4955/// Methods declared on superclass `NSObject`.
4956impl MPSCNNPoolingMaxNode {
4957    extern_methods!(
4958        #[unsafe(method(new))]
4959        #[unsafe(method_family = new)]
4960        pub unsafe fn new() -> Retained<Self>;
4961    );
4962}
4963
4964extern_class!(
4965    /// A node for a MPSCNNDilatedPooling kernel
4966    ///
4967    /// This class corresponds to the MPSCNNDilatedPooling class.
4968    ///
4969    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnndilatedpoolingmaxnode?language=objc)
4970    #[unsafe(super(MPSNNFilterNode, NSObject))]
4971    #[derive(Debug, PartialEq, Eq, Hash)]
4972    pub struct MPSCNNDilatedPoolingMaxNode;
4973);
4974
4975extern_conformance!(
4976    unsafe impl NSObjectProtocol for MPSCNNDilatedPoolingMaxNode {}
4977);
4978
4979impl MPSCNNDilatedPoolingMaxNode {
4980    extern_methods!(
4981        #[unsafe(method(dilationRateX))]
4982        #[unsafe(method_family = none)]
4983        pub unsafe fn dilationRateX(&self) -> NSUInteger;
4984
4985        #[unsafe(method(dilationRateY))]
4986        #[unsafe(method_family = none)]
4987        pub unsafe fn dilationRateY(&self) -> NSUInteger;
4988
4989        /// Convenience initializer for MPSCNNDilatedPooling nodes with square non-overlapping kernels
4990        ///
4991        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
4992        ///
4993        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = dilationRateX = dilationRateY = size
4994        ///
4995        /// Returns: A new MPSNNFilter node for a MPSCNNDilatedPooling kernel.
4996        #[unsafe(method(nodeWithSource:filterSize:))]
4997        #[unsafe(method_family = none)]
4998        pub unsafe fn nodeWithSource_filterSize(
4999            source_node: &MPSNNImageNode,
5000            size: NSUInteger,
5001        ) -> Retained<Self>;
5002
5003        /// Convenience initializer for MPSCNNDilatedPooling nodes with square kernels and equal dilation factors
5004        ///
5005        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
5006        ///
5007        /// Parameter `size`: kernelWidth = kernelHeight = size
5008        ///
5009        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
5010        ///
5011        /// Parameter `dilationRate`: dilationRateX = dilationRateY = stride
5012        ///
5013        /// Returns: A new MPSNNFilter node for a MPSCNNDilatedPooling kernel.
5014        #[unsafe(method(nodeWithSource:filterSize:stride:dilationRate:))]
5015        #[unsafe(method_family = none)]
5016        pub unsafe fn nodeWithSource_filterSize_stride_dilationRate(
5017            source_node: &MPSNNImageNode,
5018            size: NSUInteger,
5019            stride: NSUInteger,
5020            dilation_rate: NSUInteger,
5021        ) -> Retained<Self>;
5022
5023        /// Init a node representing a MPSCNNPooling kernel
5024        ///
5025        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
5026        ///
5027        /// Parameter `kernelWidth`: The width of the max filter window
5028        ///
5029        /// Parameter `kernelHeight`: The height of the max filter window
5030        ///
5031        /// Parameter `strideInPixelsX`: The output stride (downsampling factor) in the x dimension.
5032        ///
5033        /// Parameter `strideInPixelsY`: The output stride (downsampling factor) in the y dimension.
5034        ///
5035        /// Parameter `dilationRateX`: The dilation factor in the x dimension.
5036        ///
5037        /// Parameter `dilationRateY`: The dilation factor in the y dimension.
5038        ///
5039        /// Returns: A new MPSNNFilter node for a MPSCNNPooling kernel.
5040        #[unsafe(method(initWithSource:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:dilationRateX:dilationRateY:))]
5041        #[unsafe(method_family = init)]
5042        pub unsafe fn initWithSource_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_dilationRateX_dilationRateY(
5043            this: Allocated<Self>,
5044            source_node: &MPSNNImageNode,
5045            kernel_width: NSUInteger,
5046            kernel_height: NSUInteger,
5047            stride_in_pixels_x: NSUInteger,
5048            stride_in_pixels_y: NSUInteger,
5049            dilation_rate_x: NSUInteger,
5050            dilation_rate_y: NSUInteger,
5051        ) -> Retained<Self>;
5052
5053        /// Convenience initializer for MPSCNNDilatedPooling nodes with square kernels and equal dilation factors
5054        ///
5055        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
5056        ///
5057        /// Parameter `size`: kernelWidth = kernelHeight = size
5058        ///
5059        /// Parameter `stride`: strideInPixelsX = strideInPixelsY = stride
5060        ///
5061        /// Parameter `dilationRate`: dilationRateX = dilationRateY = stride
5062        ///
5063        /// Returns: A new MPSNNFilter node for a MPSCNNDilatedPooling kernel.
5064        #[unsafe(method(initWithSource:filterSize:stride:dilationRate:))]
5065        #[unsafe(method_family = init)]
5066        pub unsafe fn initWithSource_filterSize_stride_dilationRate(
5067            this: Allocated<Self>,
5068            source_node: &MPSNNImageNode,
5069            size: NSUInteger,
5070            stride: NSUInteger,
5071            dilation_rate: NSUInteger,
5072        ) -> Retained<Self>;
5073
5074        /// Convenience initializer for MPSCNNDilatedPooling nodes with square non-overlapping kernels
5075        ///
5076        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
5077        ///
5078        /// Parameter `size`: kernelWidth = kernelHeight = strideInPixelsX = strideInPixelsY = dilationRateX = dilationRateY = size
5079        ///
5080        /// Returns: A new MPSNNFilter node for a MPSCNNDilatedPooling kernel.
5081        #[unsafe(method(initWithSource:filterSize:))]
5082        #[unsafe(method_family = init)]
5083        pub unsafe fn initWithSource_filterSize(
5084            this: Allocated<Self>,
5085            source_node: &MPSNNImageNode,
5086            size: NSUInteger,
5087        ) -> Retained<Self>;
5088    );
5089}
5090
5091/// Methods declared on superclass `MPSNNFilterNode`.
5092impl MPSCNNDilatedPoolingMaxNode {
5093    extern_methods!(
5094        #[unsafe(method(init))]
5095        #[unsafe(method_family = init)]
5096        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5097    );
5098}
5099
5100/// Methods declared on superclass `NSObject`.
5101impl MPSCNNDilatedPoolingMaxNode {
5102    extern_methods!(
5103        #[unsafe(method(new))]
5104        #[unsafe(method_family = new)]
5105        pub unsafe fn new() -> Retained<Self>;
5106    );
5107}
5108
5109extern_class!(
5110    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolinggradientnode?language=objc)
5111    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
5112    #[derive(Debug, PartialEq, Eq, Hash)]
5113    pub struct MPSCNNPoolingGradientNode;
5114);
5115
5116extern_conformance!(
5117    unsafe impl NSObjectProtocol for MPSCNNPoolingGradientNode {}
5118);
5119
5120impl MPSCNNPoolingGradientNode {
5121    extern_methods!(
5122        #[cfg(feature = "MPSNeuralNetworkTypes")]
5123        /// make a pooling gradient node
5124        ///
5125        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5126        ///
5127        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5128        ///
5129        /// Parameter `sourceImage`: The input image to the inference pooling filter
5130        ///
5131        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5132        ///
5133        /// Parameter `kernelWidth`: The kernel width of the inference filter
5134        ///
5135        /// Parameter `kernelHeight`: The kernel height of the inference filter
5136        ///
5137        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5138        ///
5139        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5140        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5141        #[unsafe(method_family = none)]
5142        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5143            source_gradient: &MPSNNImageNode,
5144            source_image: &MPSNNImageNode,
5145            gradient_state: &MPSNNGradientStateNode,
5146            kernel_width: NSUInteger,
5147            kernel_height: NSUInteger,
5148            stride_in_pixels_x: NSUInteger,
5149            stride_in_pixels_y: NSUInteger,
5150            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5151        ) -> Retained<Self>;
5152
5153        #[cfg(feature = "MPSNeuralNetworkTypes")]
5154        /// make a pooling gradient node
5155        ///
5156        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5157        ///
5158        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5159        ///
5160        /// Parameter `sourceImage`: The input image to the inference pooling filter
5161        ///
5162        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5163        ///
5164        /// Parameter `kernelWidth`: The kernel width of the inference filter
5165        ///
5166        /// Parameter `kernelHeight`: The kernel height of the inference filter
5167        ///
5168        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5169        ///
5170        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5171        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5172        #[unsafe(method_family = init)]
5173        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5174            this: Allocated<Self>,
5175            source_gradient: &MPSNNImageNode,
5176            source_image: &MPSNNImageNode,
5177            gradient_state: &MPSNNGradientStateNode,
5178            kernel_width: NSUInteger,
5179            kernel_height: NSUInteger,
5180            stride_in_pixels_x: NSUInteger,
5181            stride_in_pixels_y: NSUInteger,
5182            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5183        ) -> Retained<Self>;
5184
5185        #[unsafe(method(kernelWidth))]
5186        #[unsafe(method_family = none)]
5187        pub unsafe fn kernelWidth(&self) -> NSUInteger;
5188
5189        #[unsafe(method(kernelHeight))]
5190        #[unsafe(method_family = none)]
5191        pub unsafe fn kernelHeight(&self) -> NSUInteger;
5192
5193        #[unsafe(method(strideInPixelsX))]
5194        #[unsafe(method_family = none)]
5195        pub unsafe fn strideInPixelsX(&self) -> NSUInteger;
5196
5197        #[unsafe(method(strideInPixelsY))]
5198        #[unsafe(method_family = none)]
5199        pub unsafe fn strideInPixelsY(&self) -> NSUInteger;
5200    );
5201}
5202
5203/// Methods declared on superclass `MPSNNFilterNode`.
5204impl MPSCNNPoolingGradientNode {
5205    extern_methods!(
5206        #[unsafe(method(init))]
5207        #[unsafe(method_family = init)]
5208        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5209    );
5210}
5211
5212/// Methods declared on superclass `NSObject`.
5213impl MPSCNNPoolingGradientNode {
5214    extern_methods!(
5215        #[unsafe(method(new))]
5216        #[unsafe(method_family = new)]
5217        pub unsafe fn new() -> Retained<Self>;
5218    );
5219}
5220
5221extern_class!(
5222    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingmaxgradientnode?language=objc)
5223    #[unsafe(super(
5224        MPSCNNPoolingGradientNode,
5225        MPSNNGradientFilterNode,
5226        MPSNNFilterNode,
5227        NSObject
5228    ))]
5229    #[derive(Debug, PartialEq, Eq, Hash)]
5230    pub struct MPSCNNPoolingMaxGradientNode;
5231);
5232
5233extern_conformance!(
5234    unsafe impl NSObjectProtocol for MPSCNNPoolingMaxGradientNode {}
5235);
5236
5237impl MPSCNNPoolingMaxGradientNode {
5238    extern_methods!();
5239}
5240
5241/// Methods declared on superclass `MPSCNNPoolingGradientNode`.
5242impl MPSCNNPoolingMaxGradientNode {
5243    extern_methods!(
5244        #[cfg(feature = "MPSNeuralNetworkTypes")]
5245        /// make a pooling gradient node
5246        ///
5247        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5248        ///
5249        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5250        ///
5251        /// Parameter `sourceImage`: The input image to the inference pooling filter
5252        ///
5253        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5254        ///
5255        /// Parameter `kernelWidth`: The kernel width of the inference filter
5256        ///
5257        /// Parameter `kernelHeight`: The kernel height of the inference filter
5258        ///
5259        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5260        ///
5261        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5262        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5263        #[unsafe(method_family = none)]
5264        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5265            source_gradient: &MPSNNImageNode,
5266            source_image: &MPSNNImageNode,
5267            gradient_state: &MPSNNGradientStateNode,
5268            kernel_width: NSUInteger,
5269            kernel_height: NSUInteger,
5270            stride_in_pixels_x: NSUInteger,
5271            stride_in_pixels_y: NSUInteger,
5272            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5273        ) -> Retained<Self>;
5274
5275        #[cfg(feature = "MPSNeuralNetworkTypes")]
5276        /// make a pooling gradient node
5277        ///
5278        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5279        ///
5280        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5281        ///
5282        /// Parameter `sourceImage`: The input image to the inference pooling filter
5283        ///
5284        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5285        ///
5286        /// Parameter `kernelWidth`: The kernel width of the inference filter
5287        ///
5288        /// Parameter `kernelHeight`: The kernel height of the inference filter
5289        ///
5290        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5291        ///
5292        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5293        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5294        #[unsafe(method_family = init)]
5295        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5296            this: Allocated<Self>,
5297            source_gradient: &MPSNNImageNode,
5298            source_image: &MPSNNImageNode,
5299            gradient_state: &MPSNNGradientStateNode,
5300            kernel_width: NSUInteger,
5301            kernel_height: NSUInteger,
5302            stride_in_pixels_x: NSUInteger,
5303            stride_in_pixels_y: NSUInteger,
5304            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5305        ) -> Retained<Self>;
5306    );
5307}
5308
5309/// Methods declared on superclass `MPSNNFilterNode`.
5310impl MPSCNNPoolingMaxGradientNode {
5311    extern_methods!(
5312        #[unsafe(method(init))]
5313        #[unsafe(method_family = init)]
5314        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5315    );
5316}
5317
5318/// Methods declared on superclass `NSObject`.
5319impl MPSCNNPoolingMaxGradientNode {
5320    extern_methods!(
5321        #[unsafe(method(new))]
5322        #[unsafe(method_family = new)]
5323        pub unsafe fn new() -> Retained<Self>;
5324    );
5325}
5326
5327extern_class!(
5328    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingaveragegradientnode?language=objc)
5329    #[unsafe(super(
5330        MPSCNNPoolingGradientNode,
5331        MPSNNGradientFilterNode,
5332        MPSNNFilterNode,
5333        NSObject
5334    ))]
5335    #[derive(Debug, PartialEq, Eq, Hash)]
5336    pub struct MPSCNNPoolingAverageGradientNode;
5337);
5338
5339extern_conformance!(
5340    unsafe impl NSObjectProtocol for MPSCNNPoolingAverageGradientNode {}
5341);
5342
5343impl MPSCNNPoolingAverageGradientNode {
5344    extern_methods!();
5345}
5346
5347/// Methods declared on superclass `MPSCNNPoolingGradientNode`.
5348impl MPSCNNPoolingAverageGradientNode {
5349    extern_methods!(
5350        #[cfg(feature = "MPSNeuralNetworkTypes")]
5351        /// make a pooling gradient node
5352        ///
5353        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5354        ///
5355        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5356        ///
5357        /// Parameter `sourceImage`: The input image to the inference pooling filter
5358        ///
5359        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5360        ///
5361        /// Parameter `kernelWidth`: The kernel width of the inference filter
5362        ///
5363        /// Parameter `kernelHeight`: The kernel height of the inference filter
5364        ///
5365        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5366        ///
5367        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5368        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5369        #[unsafe(method_family = none)]
5370        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5371            source_gradient: &MPSNNImageNode,
5372            source_image: &MPSNNImageNode,
5373            gradient_state: &MPSNNGradientStateNode,
5374            kernel_width: NSUInteger,
5375            kernel_height: NSUInteger,
5376            stride_in_pixels_x: NSUInteger,
5377            stride_in_pixels_y: NSUInteger,
5378            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5379        ) -> Retained<Self>;
5380
5381        #[cfg(feature = "MPSNeuralNetworkTypes")]
5382        /// make a pooling gradient node
5383        ///
5384        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5385        ///
5386        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5387        ///
5388        /// Parameter `sourceImage`: The input image to the inference pooling filter
5389        ///
5390        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5391        ///
5392        /// Parameter `kernelWidth`: The kernel width of the inference filter
5393        ///
5394        /// Parameter `kernelHeight`: The kernel height of the inference filter
5395        ///
5396        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5397        ///
5398        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5399        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5400        #[unsafe(method_family = init)]
5401        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5402            this: Allocated<Self>,
5403            source_gradient: &MPSNNImageNode,
5404            source_image: &MPSNNImageNode,
5405            gradient_state: &MPSNNGradientStateNode,
5406            kernel_width: NSUInteger,
5407            kernel_height: NSUInteger,
5408            stride_in_pixels_x: NSUInteger,
5409            stride_in_pixels_y: NSUInteger,
5410            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5411        ) -> Retained<Self>;
5412    );
5413}
5414
5415/// Methods declared on superclass `MPSNNFilterNode`.
5416impl MPSCNNPoolingAverageGradientNode {
5417    extern_methods!(
5418        #[unsafe(method(init))]
5419        #[unsafe(method_family = init)]
5420        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5421    );
5422}
5423
5424/// Methods declared on superclass `NSObject`.
5425impl MPSCNNPoolingAverageGradientNode {
5426    extern_methods!(
5427        #[unsafe(method(new))]
5428        #[unsafe(method_family = new)]
5429        pub unsafe fn new() -> Retained<Self>;
5430    );
5431}
5432
5433extern_class!(
5434    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnpoolingl2normgradientnode?language=objc)
5435    #[unsafe(super(
5436        MPSCNNPoolingGradientNode,
5437        MPSNNGradientFilterNode,
5438        MPSNNFilterNode,
5439        NSObject
5440    ))]
5441    #[derive(Debug, PartialEq, Eq, Hash)]
5442    pub struct MPSCNNPoolingL2NormGradientNode;
5443);
5444
5445extern_conformance!(
5446    unsafe impl NSObjectProtocol for MPSCNNPoolingL2NormGradientNode {}
5447);
5448
5449impl MPSCNNPoolingL2NormGradientNode {
5450    extern_methods!();
5451}
5452
5453/// Methods declared on superclass `MPSCNNPoolingGradientNode`.
5454impl MPSCNNPoolingL2NormGradientNode {
5455    extern_methods!(
5456        #[cfg(feature = "MPSNeuralNetworkTypes")]
5457        /// make a pooling gradient node
5458        ///
5459        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5460        ///
5461        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5462        ///
5463        /// Parameter `sourceImage`: The input image to the inference pooling filter
5464        ///
5465        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5466        ///
5467        /// Parameter `kernelWidth`: The kernel width of the inference filter
5468        ///
5469        /// Parameter `kernelHeight`: The kernel height of the inference filter
5470        ///
5471        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5472        ///
5473        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5474        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5475        #[unsafe(method_family = none)]
5476        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5477            source_gradient: &MPSNNImageNode,
5478            source_image: &MPSNNImageNode,
5479            gradient_state: &MPSNNGradientStateNode,
5480            kernel_width: NSUInteger,
5481            kernel_height: NSUInteger,
5482            stride_in_pixels_x: NSUInteger,
5483            stride_in_pixels_y: NSUInteger,
5484            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5485        ) -> Retained<Self>;
5486
5487        #[cfg(feature = "MPSNeuralNetworkTypes")]
5488        /// make a pooling gradient node
5489        ///
5490        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5491        ///
5492        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5493        ///
5494        /// Parameter `sourceImage`: The input image to the inference pooling filter
5495        ///
5496        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5497        ///
5498        /// Parameter `kernelWidth`: The kernel width of the inference filter
5499        ///
5500        /// Parameter `kernelHeight`: The kernel height of the inference filter
5501        ///
5502        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5503        ///
5504        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5505        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5506        #[unsafe(method_family = init)]
5507        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5508            this: Allocated<Self>,
5509            source_gradient: &MPSNNImageNode,
5510            source_image: &MPSNNImageNode,
5511            gradient_state: &MPSNNGradientStateNode,
5512            kernel_width: NSUInteger,
5513            kernel_height: NSUInteger,
5514            stride_in_pixels_x: NSUInteger,
5515            stride_in_pixels_y: NSUInteger,
5516            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5517        ) -> Retained<Self>;
5518    );
5519}
5520
5521/// Methods declared on superclass `MPSNNFilterNode`.
5522impl MPSCNNPoolingL2NormGradientNode {
5523    extern_methods!(
5524        #[unsafe(method(init))]
5525        #[unsafe(method_family = init)]
5526        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5527    );
5528}
5529
5530/// Methods declared on superclass `NSObject`.
5531impl MPSCNNPoolingL2NormGradientNode {
5532    extern_methods!(
5533        #[unsafe(method(new))]
5534        #[unsafe(method_family = new)]
5535        pub unsafe fn new() -> Retained<Self>;
5536    );
5537}
5538
5539extern_class!(
5540    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnndilatedpoolingmaxgradientnode?language=objc)
5541    #[unsafe(super(
5542        MPSCNNPoolingGradientNode,
5543        MPSNNGradientFilterNode,
5544        MPSNNFilterNode,
5545        NSObject
5546    ))]
5547    #[derive(Debug, PartialEq, Eq, Hash)]
5548    pub struct MPSCNNDilatedPoolingMaxGradientNode;
5549);
5550
5551extern_conformance!(
5552    unsafe impl NSObjectProtocol for MPSCNNDilatedPoolingMaxGradientNode {}
5553);
5554
5555impl MPSCNNDilatedPoolingMaxGradientNode {
5556    extern_methods!(
5557        /// make a pooling gradient node
5558        ///
5559        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5560        ///
5561        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5562        ///
5563        /// Parameter `sourceImage`: The input image to the inference pooling filter
5564        ///
5565        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5566        ///
5567        /// Parameter `kernelWidth`: The kernel width of the inference filter
5568        ///
5569        /// Parameter `kernelHeight`: The kernel height of the inference filter
5570        ///
5571        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5572        ///
5573        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5574        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:dilationRateX:dilationRateY:))]
5575        #[unsafe(method_family = none)]
5576        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_dilationRateX_dilationRateY(
5577            source_gradient: &MPSNNImageNode,
5578            source_image: &MPSNNImageNode,
5579            gradient_state: &MPSNNGradientStateNode,
5580            kernel_width: NSUInteger,
5581            kernel_height: NSUInteger,
5582            stride_in_pixels_x: NSUInteger,
5583            stride_in_pixels_y: NSUInteger,
5584            dilation_rate_x: NSUInteger,
5585            dilation_rate_y: NSUInteger,
5586        ) -> Retained<Self>;
5587
5588        /// make a pooling gradient node
5589        ///
5590        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5591        ///
5592        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5593        ///
5594        /// Parameter `sourceImage`: The input image to the inference pooling filter
5595        ///
5596        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5597        ///
5598        /// Parameter `kernelWidth`: The kernel width of the inference filter
5599        ///
5600        /// Parameter `kernelHeight`: The kernel height of the inference filter
5601        ///
5602        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5603        ///
5604        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5605        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:dilationRateX:dilationRateY:))]
5606        #[unsafe(method_family = init)]
5607        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_dilationRateX_dilationRateY(
5608            this: Allocated<Self>,
5609            source_gradient: &MPSNNImageNode,
5610            source_image: &MPSNNImageNode,
5611            gradient_state: &MPSNNGradientStateNode,
5612            kernel_width: NSUInteger,
5613            kernel_height: NSUInteger,
5614            stride_in_pixels_x: NSUInteger,
5615            stride_in_pixels_y: NSUInteger,
5616            dilation_rate_x: NSUInteger,
5617            dilation_rate_y: NSUInteger,
5618        ) -> Retained<Self>;
5619
5620        #[unsafe(method(dilationRateX))]
5621        #[unsafe(method_family = none)]
5622        pub unsafe fn dilationRateX(&self) -> NSUInteger;
5623
5624        #[unsafe(method(dilationRateY))]
5625        #[unsafe(method_family = none)]
5626        pub unsafe fn dilationRateY(&self) -> NSUInteger;
5627    );
5628}
5629
5630/// Methods declared on superclass `MPSCNNPoolingGradientNode`.
5631impl MPSCNNDilatedPoolingMaxGradientNode {
5632    extern_methods!(
5633        #[cfg(feature = "MPSNeuralNetworkTypes")]
5634        /// make a pooling gradient node
5635        ///
5636        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5637        ///
5638        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5639        ///
5640        /// Parameter `sourceImage`: The input image to the inference pooling filter
5641        ///
5642        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5643        ///
5644        /// Parameter `kernelWidth`: The kernel width of the inference filter
5645        ///
5646        /// Parameter `kernelHeight`: The kernel height of the inference filter
5647        ///
5648        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5649        ///
5650        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5651        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5652        #[unsafe(method_family = none)]
5653        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5654            source_gradient: &MPSNNImageNode,
5655            source_image: &MPSNNImageNode,
5656            gradient_state: &MPSNNGradientStateNode,
5657            kernel_width: NSUInteger,
5658            kernel_height: NSUInteger,
5659            stride_in_pixels_x: NSUInteger,
5660            stride_in_pixels_y: NSUInteger,
5661            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5662        ) -> Retained<Self>;
5663
5664        #[cfg(feature = "MPSNeuralNetworkTypes")]
5665        /// make a pooling gradient node
5666        ///
5667        /// It would be much easier to use [inferencePoolingNode gradientNodeForSourceGradient:] instead.
5668        ///
5669        /// Parameter `sourceGradient`: The gradient from the downstream gradient filter.
5670        ///
5671        /// Parameter `sourceImage`: The input image to the inference pooling filter
5672        ///
5673        /// Parameter `gradientState`: The gradient state produced by the inference poolin filter
5674        ///
5675        /// Parameter `kernelWidth`: The kernel width of the inference filter
5676        ///
5677        /// Parameter `kernelHeight`: The kernel height of the inference filter
5678        ///
5679        /// Parameter `strideInPixelsX`: The X stride from the inference filter
5680        ///
5681        /// Parameter `strideInPixelsY`: The Y stride from the inference filter
5682        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:strideInPixelsX:strideInPixelsY:paddingPolicy:))]
5683        #[unsafe(method_family = init)]
5684        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight_strideInPixelsX_strideInPixelsY_paddingPolicy(
5685            this: Allocated<Self>,
5686            source_gradient: &MPSNNImageNode,
5687            source_image: &MPSNNImageNode,
5688            gradient_state: &MPSNNGradientStateNode,
5689            kernel_width: NSUInteger,
5690            kernel_height: NSUInteger,
5691            stride_in_pixels_x: NSUInteger,
5692            stride_in_pixels_y: NSUInteger,
5693            padding_policy: Option<&ProtocolObject<dyn MPSNNPadding>>,
5694        ) -> Retained<Self>;
5695    );
5696}
5697
5698/// Methods declared on superclass `MPSNNFilterNode`.
5699impl MPSCNNDilatedPoolingMaxGradientNode {
5700    extern_methods!(
5701        #[unsafe(method(init))]
5702        #[unsafe(method_family = init)]
5703        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5704    );
5705}
5706
5707/// Methods declared on superclass `NSObject`.
5708impl MPSCNNDilatedPoolingMaxGradientNode {
5709    extern_methods!(
5710        #[unsafe(method(new))]
5711        #[unsafe(method_family = new)]
5712        pub unsafe fn new() -> Retained<Self>;
5713    );
5714}
5715
5716extern_class!(
5717    /// virtual base class for CNN normalization nodes
5718    ///
5719    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnnormalizationnode?language=objc)
5720    #[unsafe(super(MPSNNFilterNode, NSObject))]
5721    #[derive(Debug, PartialEq, Eq, Hash)]
5722    pub struct MPSCNNNormalizationNode;
5723);
5724
5725extern_conformance!(
5726    unsafe impl NSObjectProtocol for MPSCNNNormalizationNode {}
5727);
5728
5729impl MPSCNNNormalizationNode {
5730    extern_methods!(
5731        /// The value of alpha.  Default is 1.0. Must be non-negative.
5732        #[unsafe(method(alpha))]
5733        #[unsafe(method_family = none)]
5734        pub unsafe fn alpha(&self) -> c_float;
5735
5736        /// Setter for [`alpha`][Self::alpha].
5737        #[unsafe(method(setAlpha:))]
5738        #[unsafe(method_family = none)]
5739        pub unsafe fn setAlpha(&self, alpha: c_float);
5740
5741        /// The value of beta.  Default is 5.0
5742        #[unsafe(method(beta))]
5743        #[unsafe(method_family = none)]
5744        pub unsafe fn beta(&self) -> c_float;
5745
5746        /// Setter for [`beta`][Self::beta].
5747        #[unsafe(method(setBeta:))]
5748        #[unsafe(method_family = none)]
5749        pub unsafe fn setBeta(&self, beta: c_float);
5750
5751        /// The value of delta.  Default is 1.0
5752        #[unsafe(method(delta))]
5753        #[unsafe(method_family = none)]
5754        pub unsafe fn delta(&self) -> c_float;
5755
5756        /// Setter for [`delta`][Self::delta].
5757        #[unsafe(method(setDelta:))]
5758        #[unsafe(method_family = none)]
5759        pub unsafe fn setDelta(&self, delta: c_float);
5760
5761        #[unsafe(method(nodeWithSource:))]
5762        #[unsafe(method_family = none)]
5763        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
5764
5765        #[unsafe(method(initWithSource:))]
5766        #[unsafe(method_family = init)]
5767        pub unsafe fn initWithSource(
5768            this: Allocated<Self>,
5769            source_node: &MPSNNImageNode,
5770        ) -> Retained<Self>;
5771    );
5772}
5773
5774/// Methods declared on superclass `MPSNNFilterNode`.
5775impl MPSCNNNormalizationNode {
5776    extern_methods!(
5777        #[unsafe(method(init))]
5778        #[unsafe(method_family = init)]
5779        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5780    );
5781}
5782
5783/// Methods declared on superclass `NSObject`.
5784impl MPSCNNNormalizationNode {
5785    extern_methods!(
5786        #[unsafe(method(new))]
5787        #[unsafe(method_family = new)]
5788        pub unsafe fn new() -> Retained<Self>;
5789    );
5790}
5791
5792extern_class!(
5793    /// Node representing MPSCNNSpatialNormalization
5794    ///
5795    /// For each feature channel, the function computes the sum of squares of X inside each rectangle, N2(i,j).
5796    /// It then divides each element of X as follows:
5797    /// Y(i,j) = X(i,j) / (delta + alpha/(kw*kh) * N2(i,j))^beta,
5798    /// where kw and kh are the kernelWidth and the kernelHeight.
5799    ///
5800    ///
5801    /// ```text
5802    ///         Defaults:
5803    ///              alpha = 1.0f
5804    ///              beta  = 5.0f
5805    ///              delta = 1.0f
5806    ///              kernelHeight = kernelWidth = kernelSize
5807    /// ```
5808    ///
5809    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnspatialnormalizationnode?language=objc)
5810    #[unsafe(super(MPSCNNNormalizationNode, MPSNNFilterNode, NSObject))]
5811    #[derive(Debug, PartialEq, Eq, Hash)]
5812    pub struct MPSCNNSpatialNormalizationNode;
5813);
5814
5815extern_conformance!(
5816    unsafe impl NSObjectProtocol for MPSCNNSpatialNormalizationNode {}
5817);
5818
5819impl MPSCNNSpatialNormalizationNode {
5820    extern_methods!(
5821        #[unsafe(method(kernelWidth))]
5822        #[unsafe(method_family = none)]
5823        pub unsafe fn kernelWidth(&self) -> NSUInteger;
5824
5825        /// Setter for [`kernelWidth`][Self::kernelWidth].
5826        #[unsafe(method(setKernelWidth:))]
5827        #[unsafe(method_family = none)]
5828        pub unsafe fn setKernelWidth(&self, kernel_width: NSUInteger);
5829
5830        #[unsafe(method(kernelHeight))]
5831        #[unsafe(method_family = none)]
5832        pub unsafe fn kernelHeight(&self) -> NSUInteger;
5833
5834        /// Setter for [`kernelHeight`][Self::kernelHeight].
5835        #[unsafe(method(setKernelHeight:))]
5836        #[unsafe(method_family = none)]
5837        pub unsafe fn setKernelHeight(&self, kernel_height: NSUInteger);
5838
5839        #[unsafe(method(nodeWithSource:kernelSize:))]
5840        #[unsafe(method_family = none)]
5841        pub unsafe fn nodeWithSource_kernelSize(
5842            source_node: &MPSNNImageNode,
5843            kernel_size: NSUInteger,
5844        ) -> Retained<Self>;
5845
5846        #[unsafe(method(initWithSource:kernelSize:))]
5847        #[unsafe(method_family = init)]
5848        pub unsafe fn initWithSource_kernelSize(
5849            this: Allocated<Self>,
5850            source_node: &MPSNNImageNode,
5851            kernel_size: NSUInteger,
5852        ) -> Retained<Self>;
5853
5854        #[unsafe(method(initWithSource:))]
5855        #[unsafe(method_family = init)]
5856        pub unsafe fn initWithSource(
5857            this: Allocated<Self>,
5858            source_node: &MPSNNImageNode,
5859        ) -> Retained<Self>;
5860    );
5861}
5862
5863/// Methods declared on superclass `MPSCNNNormalizationNode`.
5864impl MPSCNNSpatialNormalizationNode {
5865    extern_methods!(
5866        #[unsafe(method(nodeWithSource:))]
5867        #[unsafe(method_family = none)]
5868        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
5869    );
5870}
5871
5872/// Methods declared on superclass `MPSNNFilterNode`.
5873impl MPSCNNSpatialNormalizationNode {
5874    extern_methods!(
5875        #[unsafe(method(init))]
5876        #[unsafe(method_family = init)]
5877        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5878    );
5879}
5880
5881/// Methods declared on superclass `NSObject`.
5882impl MPSCNNSpatialNormalizationNode {
5883    extern_methods!(
5884        #[unsafe(method(new))]
5885        #[unsafe(method_family = new)]
5886        pub unsafe fn new() -> Retained<Self>;
5887    );
5888}
5889
5890extern_class!(
5891    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnspatialnormalizationgradientnode?language=objc)
5892    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
5893    #[derive(Debug, PartialEq, Eq, Hash)]
5894    pub struct MPSCNNSpatialNormalizationGradientNode;
5895);
5896
5897extern_conformance!(
5898    unsafe impl NSObjectProtocol for MPSCNNSpatialNormalizationGradientNode {}
5899);
5900
5901impl MPSCNNSpatialNormalizationGradientNode {
5902    extern_methods!(
5903        #[unsafe(method(kernelWidth))]
5904        #[unsafe(method_family = none)]
5905        pub unsafe fn kernelWidth(&self) -> NSUInteger;
5906
5907        /// Setter for [`kernelWidth`][Self::kernelWidth].
5908        #[unsafe(method(setKernelWidth:))]
5909        #[unsafe(method_family = none)]
5910        pub unsafe fn setKernelWidth(&self, kernel_width: NSUInteger);
5911
5912        #[unsafe(method(kernelHeight))]
5913        #[unsafe(method_family = none)]
5914        pub unsafe fn kernelHeight(&self) -> NSUInteger;
5915
5916        /// Setter for [`kernelHeight`][Self::kernelHeight].
5917        #[unsafe(method(setKernelHeight:))]
5918        #[unsafe(method_family = none)]
5919        pub unsafe fn setKernelHeight(&self, kernel_height: NSUInteger);
5920
5921        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelSize:))]
5922        #[unsafe(method_family = none)]
5923        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelSize(
5924            source_gradient: &MPSNNImageNode,
5925            source_image: &MPSNNImageNode,
5926            gradient_state: &MPSNNGradientStateNode,
5927            kernel_size: NSUInteger,
5928        ) -> Retained<Self>;
5929
5930        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelSize:))]
5931        #[unsafe(method_family = init)]
5932        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelSize(
5933            this: Allocated<Self>,
5934            source_gradient: &MPSNNImageNode,
5935            source_image: &MPSNNImageNode,
5936            gradient_state: &MPSNNGradientStateNode,
5937            kernel_size: NSUInteger,
5938        ) -> Retained<Self>;
5939
5940        /// The value of alpha.  Default is 1.0. Must be non-negative.
5941        #[unsafe(method(alpha))]
5942        #[unsafe(method_family = none)]
5943        pub unsafe fn alpha(&self) -> c_float;
5944
5945        /// Setter for [`alpha`][Self::alpha].
5946        #[unsafe(method(setAlpha:))]
5947        #[unsafe(method_family = none)]
5948        pub unsafe fn setAlpha(&self, alpha: c_float);
5949
5950        /// The value of beta.  Default is 5.0
5951        #[unsafe(method(beta))]
5952        #[unsafe(method_family = none)]
5953        pub unsafe fn beta(&self) -> c_float;
5954
5955        /// Setter for [`beta`][Self::beta].
5956        #[unsafe(method(setBeta:))]
5957        #[unsafe(method_family = none)]
5958        pub unsafe fn setBeta(&self, beta: c_float);
5959
5960        /// The value of delta.  Default is 1.0
5961        #[unsafe(method(delta))]
5962        #[unsafe(method_family = none)]
5963        pub unsafe fn delta(&self) -> c_float;
5964
5965        /// Setter for [`delta`][Self::delta].
5966        #[unsafe(method(setDelta:))]
5967        #[unsafe(method_family = none)]
5968        pub unsafe fn setDelta(&self, delta: c_float);
5969    );
5970}
5971
5972/// Methods declared on superclass `MPSNNFilterNode`.
5973impl MPSCNNSpatialNormalizationGradientNode {
5974    extern_methods!(
5975        #[unsafe(method(init))]
5976        #[unsafe(method_family = init)]
5977        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
5978    );
5979}
5980
5981/// Methods declared on superclass `NSObject`.
5982impl MPSCNNSpatialNormalizationGradientNode {
5983    extern_methods!(
5984        #[unsafe(method(new))]
5985        #[unsafe(method_family = new)]
5986        pub unsafe fn new() -> Retained<Self>;
5987    );
5988}
5989
5990extern_class!(
5991    /// Node representing MPSCNNLocalContrastNormalization
5992    ///
5993    /// The result is computed for each element of X as follows:
5994    ///
5995    /// Y(i,j) = pm + ps * ( X(i,j) - p0 * M(i,j)) / pow((delta + alpha * variance(i,j)), beta),
5996    ///
5997    /// where kw and kh are the kernelWidth and the kernelHeight and pm, ps and p0 are parameters that
5998    /// can be used to offset and scale the result in various ways. *
5999    ///
6000    /// ```text
6001    ///         Defaults:
6002    ///              alpha = 1.0f
6003    ///              beta  = 0.5f
6004    ///              delta = 2^-10
6005    ///              pm = 0
6006    ///              ps = 1
6007    ///              p0 = 1
6008    ///              kernelHeight = kernelWidth = kernelSize
6009    /// ```
6010    ///
6011    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnlocalcontrastnormalizationnode?language=objc)
6012    #[unsafe(super(MPSCNNNormalizationNode, MPSNNFilterNode, NSObject))]
6013    #[derive(Debug, PartialEq, Eq, Hash)]
6014    pub struct MPSCNNLocalContrastNormalizationNode;
6015);
6016
6017extern_conformance!(
6018    unsafe impl NSObjectProtocol for MPSCNNLocalContrastNormalizationNode {}
6019);
6020
6021impl MPSCNNLocalContrastNormalizationNode {
6022    extern_methods!(
6023        #[unsafe(method(pm))]
6024        #[unsafe(method_family = none)]
6025        pub unsafe fn pm(&self) -> c_float;
6026
6027        /// Setter for [`pm`][Self::pm].
6028        #[unsafe(method(setPm:))]
6029        #[unsafe(method_family = none)]
6030        pub unsafe fn setPm(&self, pm: c_float);
6031
6032        #[unsafe(method(ps))]
6033        #[unsafe(method_family = none)]
6034        pub unsafe fn ps(&self) -> c_float;
6035
6036        /// Setter for [`ps`][Self::ps].
6037        #[unsafe(method(setPs:))]
6038        #[unsafe(method_family = none)]
6039        pub unsafe fn setPs(&self, ps: c_float);
6040
6041        #[unsafe(method(p0))]
6042        #[unsafe(method_family = none)]
6043        pub unsafe fn p0(&self) -> c_float;
6044
6045        /// Setter for [`p0`][Self::p0].
6046        #[unsafe(method(setP0:))]
6047        #[unsafe(method_family = none)]
6048        pub unsafe fn setP0(&self, p0: c_float);
6049
6050        #[unsafe(method(kernelWidth))]
6051        #[unsafe(method_family = none)]
6052        pub unsafe fn kernelWidth(&self) -> NSUInteger;
6053
6054        /// Setter for [`kernelWidth`][Self::kernelWidth].
6055        #[unsafe(method(setKernelWidth:))]
6056        #[unsafe(method_family = none)]
6057        pub unsafe fn setKernelWidth(&self, kernel_width: NSUInteger);
6058
6059        #[unsafe(method(kernelHeight))]
6060        #[unsafe(method_family = none)]
6061        pub unsafe fn kernelHeight(&self) -> NSUInteger;
6062
6063        /// Setter for [`kernelHeight`][Self::kernelHeight].
6064        #[unsafe(method(setKernelHeight:))]
6065        #[unsafe(method_family = none)]
6066        pub unsafe fn setKernelHeight(&self, kernel_height: NSUInteger);
6067
6068        #[unsafe(method(nodeWithSource:kernelSize:))]
6069        #[unsafe(method_family = none)]
6070        pub unsafe fn nodeWithSource_kernelSize(
6071            source_node: &MPSNNImageNode,
6072            kernel_size: NSUInteger,
6073        ) -> Retained<Self>;
6074
6075        #[unsafe(method(initWithSource:kernelSize:))]
6076        #[unsafe(method_family = init)]
6077        pub unsafe fn initWithSource_kernelSize(
6078            this: Allocated<Self>,
6079            source_node: &MPSNNImageNode,
6080            kernel_size: NSUInteger,
6081        ) -> Retained<Self>;
6082
6083        #[unsafe(method(initWithSource:))]
6084        #[unsafe(method_family = init)]
6085        pub unsafe fn initWithSource(
6086            this: Allocated<Self>,
6087            source_node: &MPSNNImageNode,
6088        ) -> Retained<Self>;
6089    );
6090}
6091
6092/// Methods declared on superclass `MPSCNNNormalizationNode`.
6093impl MPSCNNLocalContrastNormalizationNode {
6094    extern_methods!(
6095        #[unsafe(method(nodeWithSource:))]
6096        #[unsafe(method_family = none)]
6097        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
6098    );
6099}
6100
6101/// Methods declared on superclass `MPSNNFilterNode`.
6102impl MPSCNNLocalContrastNormalizationNode {
6103    extern_methods!(
6104        #[unsafe(method(init))]
6105        #[unsafe(method_family = init)]
6106        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6107    );
6108}
6109
6110/// Methods declared on superclass `NSObject`.
6111impl MPSCNNLocalContrastNormalizationNode {
6112    extern_methods!(
6113        #[unsafe(method(new))]
6114        #[unsafe(method_family = new)]
6115        pub unsafe fn new() -> Retained<Self>;
6116    );
6117}
6118
6119extern_class!(
6120    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnlocalcontrastnormalizationgradientnode?language=objc)
6121    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
6122    #[derive(Debug, PartialEq, Eq, Hash)]
6123    pub struct MPSCNNLocalContrastNormalizationGradientNode;
6124);
6125
6126extern_conformance!(
6127    unsafe impl NSObjectProtocol for MPSCNNLocalContrastNormalizationGradientNode {}
6128);
6129
6130impl MPSCNNLocalContrastNormalizationGradientNode {
6131    extern_methods!(
6132        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:))]
6133        #[unsafe(method_family = none)]
6134        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight(
6135            source_gradient: &MPSNNImageNode,
6136            source_image: &MPSNNImageNode,
6137            gradient_state: &MPSNNGradientStateNode,
6138            kernel_width: NSUInteger,
6139            kernel_height: NSUInteger,
6140        ) -> Retained<Self>;
6141
6142        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelWidth:kernelHeight:))]
6143        #[unsafe(method_family = init)]
6144        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelWidth_kernelHeight(
6145            this: Allocated<Self>,
6146            source_gradient: &MPSNNImageNode,
6147            source_image: &MPSNNImageNode,
6148            gradient_state: &MPSNNGradientStateNode,
6149            kernel_width: NSUInteger,
6150            kernel_height: NSUInteger,
6151        ) -> Retained<Self>;
6152
6153        /// The value of alpha.  Default is 0.0
6154        ///
6155        /// The default value 0.0 is not recommended and is
6156        /// preserved for backwards compatibility. With alpha 0,
6157        /// it performs a local mean subtraction. The
6158        /// MPSCNNLocalContrastNormalizationNode used with
6159        /// the MPSNNGraph uses 1.0 as a default.
6160        #[unsafe(method(alpha))]
6161        #[unsafe(method_family = none)]
6162        pub unsafe fn alpha(&self) -> c_float;
6163
6164        /// Setter for [`alpha`][Self::alpha].
6165        #[unsafe(method(setAlpha:))]
6166        #[unsafe(method_family = none)]
6167        pub unsafe fn setAlpha(&self, alpha: c_float);
6168
6169        /// The value of beta.  Default is 0.5
6170        #[unsafe(method(beta))]
6171        #[unsafe(method_family = none)]
6172        pub unsafe fn beta(&self) -> c_float;
6173
6174        /// Setter for [`beta`][Self::beta].
6175        #[unsafe(method(setBeta:))]
6176        #[unsafe(method_family = none)]
6177        pub unsafe fn setBeta(&self, beta: c_float);
6178
6179        /// The value of delta.  Default is 1/1024
6180        #[unsafe(method(delta))]
6181        #[unsafe(method_family = none)]
6182        pub unsafe fn delta(&self) -> c_float;
6183
6184        /// Setter for [`delta`][Self::delta].
6185        #[unsafe(method(setDelta:))]
6186        #[unsafe(method_family = none)]
6187        pub unsafe fn setDelta(&self, delta: c_float);
6188
6189        /// The value of p0.  Default is 1.0
6190        #[unsafe(method(p0))]
6191        #[unsafe(method_family = none)]
6192        pub unsafe fn p0(&self) -> c_float;
6193
6194        /// Setter for [`p0`][Self::p0].
6195        #[unsafe(method(setP0:))]
6196        #[unsafe(method_family = none)]
6197        pub unsafe fn setP0(&self, p0: c_float);
6198
6199        /// The value of pm.  Default is 0.0
6200        #[unsafe(method(pm))]
6201        #[unsafe(method_family = none)]
6202        pub unsafe fn pm(&self) -> c_float;
6203
6204        /// Setter for [`pm`][Self::pm].
6205        #[unsafe(method(setPm:))]
6206        #[unsafe(method_family = none)]
6207        pub unsafe fn setPm(&self, pm: c_float);
6208
6209        /// The value of ps.  Default is 1.0
6210        #[unsafe(method(ps))]
6211        #[unsafe(method_family = none)]
6212        pub unsafe fn ps(&self) -> c_float;
6213
6214        /// Setter for [`ps`][Self::ps].
6215        #[unsafe(method(setPs:))]
6216        #[unsafe(method_family = none)]
6217        pub unsafe fn setPs(&self, ps: c_float);
6218
6219        #[unsafe(method(kernelWidth))]
6220        #[unsafe(method_family = none)]
6221        pub unsafe fn kernelWidth(&self) -> NSUInteger;
6222
6223        #[unsafe(method(kernelHeight))]
6224        #[unsafe(method_family = none)]
6225        pub unsafe fn kernelHeight(&self) -> NSUInteger;
6226    );
6227}
6228
6229/// Methods declared on superclass `MPSNNFilterNode`.
6230impl MPSCNNLocalContrastNormalizationGradientNode {
6231    extern_methods!(
6232        #[unsafe(method(init))]
6233        #[unsafe(method_family = init)]
6234        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6235    );
6236}
6237
6238/// Methods declared on superclass `NSObject`.
6239impl MPSCNNLocalContrastNormalizationGradientNode {
6240    extern_methods!(
6241        #[unsafe(method(new))]
6242        #[unsafe(method_family = new)]
6243        pub unsafe fn new() -> Retained<Self>;
6244    );
6245}
6246
6247extern_class!(
6248    /// Node representing MPSCNNCrossChannelNormalization
6249    ///
6250    /// The normalized output is given by:
6251    /// Y(i,j,k) = X(i,j,k) / L(i,j,k)^beta,
6252    /// where the normalizing factor is:
6253    /// L(i,j,k) = delta + alpha/N * (sum_{q in Q(k)} X(i,j,q)^2, where
6254    /// N is the kernel size. The window Q(k) itself is defined as:
6255    /// Q(k) = [max(0, k-floor(N/2)), min(D-1, k+floor((N-1)/2)], where
6256    ///
6257    /// k is the feature channel index (running from 0 to D-1) and
6258    /// D is the number of feature channels, and alpha, beta and delta are paremeters.
6259    ///
6260    /// ```text
6261    ///         Defaults:
6262    ///              alpha = 1.0f
6263    ///              beta  = 5.0f
6264    ///              delta = 1.0f
6265    ///              kernelHeight = kernelWidth = kernelSize
6266    /// ```
6267    ///
6268    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnncrosschannelnormalizationnode?language=objc)
6269    #[unsafe(super(MPSCNNNormalizationNode, MPSNNFilterNode, NSObject))]
6270    #[derive(Debug, PartialEq, Eq, Hash)]
6271    pub struct MPSCNNCrossChannelNormalizationNode;
6272);
6273
6274extern_conformance!(
6275    unsafe impl NSObjectProtocol for MPSCNNCrossChannelNormalizationNode {}
6276);
6277
6278impl MPSCNNCrossChannelNormalizationNode {
6279    extern_methods!(
6280        #[unsafe(method(kernelSizeInFeatureChannels))]
6281        #[unsafe(method_family = none)]
6282        pub unsafe fn kernelSizeInFeatureChannels(&self) -> NSUInteger;
6283
6284        /// Setter for [`kernelSizeInFeatureChannels`][Self::kernelSizeInFeatureChannels].
6285        #[unsafe(method(setKernelSizeInFeatureChannels:))]
6286        #[unsafe(method_family = none)]
6287        pub unsafe fn setKernelSizeInFeatureChannels(
6288            &self,
6289            kernel_size_in_feature_channels: NSUInteger,
6290        );
6291
6292        #[unsafe(method(nodeWithSource:kernelSize:))]
6293        #[unsafe(method_family = none)]
6294        pub unsafe fn nodeWithSource_kernelSize(
6295            source_node: &MPSNNImageNode,
6296            kernel_size: NSUInteger,
6297        ) -> Retained<Self>;
6298
6299        #[unsafe(method(initWithSource:kernelSize:))]
6300        #[unsafe(method_family = init)]
6301        pub unsafe fn initWithSource_kernelSize(
6302            this: Allocated<Self>,
6303            source_node: &MPSNNImageNode,
6304            kernel_size: NSUInteger,
6305        ) -> Retained<Self>;
6306
6307        #[unsafe(method(initWithSource:))]
6308        #[unsafe(method_family = init)]
6309        pub unsafe fn initWithSource(
6310            this: Allocated<Self>,
6311            source_node: &MPSNNImageNode,
6312        ) -> Retained<Self>;
6313    );
6314}
6315
6316/// Methods declared on superclass `MPSCNNNormalizationNode`.
6317impl MPSCNNCrossChannelNormalizationNode {
6318    extern_methods!(
6319        #[unsafe(method(nodeWithSource:))]
6320        #[unsafe(method_family = none)]
6321        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
6322    );
6323}
6324
6325/// Methods declared on superclass `MPSNNFilterNode`.
6326impl MPSCNNCrossChannelNormalizationNode {
6327    extern_methods!(
6328        #[unsafe(method(init))]
6329        #[unsafe(method_family = init)]
6330        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6331    );
6332}
6333
6334/// Methods declared on superclass `NSObject`.
6335impl MPSCNNCrossChannelNormalizationNode {
6336    extern_methods!(
6337        #[unsafe(method(new))]
6338        #[unsafe(method_family = new)]
6339        pub unsafe fn new() -> Retained<Self>;
6340    );
6341}
6342
6343extern_class!(
6344    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnncrosschannelnormalizationgradientnode?language=objc)
6345    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
6346    #[derive(Debug, PartialEq, Eq, Hash)]
6347    pub struct MPSCNNCrossChannelNormalizationGradientNode;
6348);
6349
6350extern_conformance!(
6351    unsafe impl NSObjectProtocol for MPSCNNCrossChannelNormalizationGradientNode {}
6352);
6353
6354impl MPSCNNCrossChannelNormalizationGradientNode {
6355    extern_methods!(
6356        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:kernelSize:))]
6357        #[unsafe(method_family = none)]
6358        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_kernelSize(
6359            source_gradient: &MPSNNImageNode,
6360            source_image: &MPSNNImageNode,
6361            gradient_state: &MPSNNGradientStateNode,
6362            kernel_size: NSUInteger,
6363        ) -> Retained<Self>;
6364
6365        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:kernelSize:))]
6366        #[unsafe(method_family = init)]
6367        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_kernelSize(
6368            this: Allocated<Self>,
6369            source_gradient: &MPSNNImageNode,
6370            source_image: &MPSNNImageNode,
6371            gradient_state: &MPSNNGradientStateNode,
6372            kernel_size: NSUInteger,
6373        ) -> Retained<Self>;
6374
6375        #[unsafe(method(kernelSize))]
6376        #[unsafe(method_family = none)]
6377        pub unsafe fn kernelSize(&self) -> NSUInteger;
6378    );
6379}
6380
6381/// Methods declared on superclass `MPSNNFilterNode`.
6382impl MPSCNNCrossChannelNormalizationGradientNode {
6383    extern_methods!(
6384        #[unsafe(method(init))]
6385        #[unsafe(method_family = init)]
6386        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6387    );
6388}
6389
6390/// Methods declared on superclass `NSObject`.
6391impl MPSCNNCrossChannelNormalizationGradientNode {
6392    extern_methods!(
6393        #[unsafe(method(new))]
6394        #[unsafe(method_family = new)]
6395        pub unsafe fn new() -> Retained<Self>;
6396    );
6397}
6398
6399extern_class!(
6400    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnninstancenormalizationnode?language=objc)
6401    #[unsafe(super(MPSNNFilterNode, NSObject))]
6402    #[derive(Debug, PartialEq, Eq, Hash)]
6403    pub struct MPSCNNInstanceNormalizationNode;
6404);
6405
6406extern_conformance!(
6407    unsafe impl MPSNNTrainableNode for MPSCNNInstanceNormalizationNode {}
6408);
6409
6410extern_conformance!(
6411    unsafe impl NSObjectProtocol for MPSCNNInstanceNormalizationNode {}
6412);
6413
6414impl MPSCNNInstanceNormalizationNode {
6415    extern_methods!(
6416        #[cfg(feature = "MPSNeuralNetworkTypes")]
6417        /// The training style of the forward node will be propagated to gradient nodes made from it
6418        #[unsafe(method(trainingStyle))]
6419        #[unsafe(method_family = none)]
6420        pub unsafe fn trainingStyle(&self) -> MPSNNTrainingStyle;
6421
6422        #[cfg(feature = "MPSNeuralNetworkTypes")]
6423        /// Setter for [`trainingStyle`][Self::trainingStyle].
6424        #[unsafe(method(setTrainingStyle:))]
6425        #[unsafe(method_family = none)]
6426        pub unsafe fn setTrainingStyle(&self, training_style: MPSNNTrainingStyle);
6427
6428        #[cfg(feature = "MPSCNNInstanceNormalization")]
6429        #[unsafe(method(nodeWithSource:dataSource:))]
6430        #[unsafe(method_family = none)]
6431        pub unsafe fn nodeWithSource_dataSource(
6432            source: &MPSNNImageNode,
6433            data_source: &ProtocolObject<dyn MPSCNNInstanceNormalizationDataSource>,
6434        ) -> Retained<Self>;
6435
6436        #[cfg(feature = "MPSCNNInstanceNormalization")]
6437        #[unsafe(method(initWithSource:dataSource:))]
6438        #[unsafe(method_family = init)]
6439        pub unsafe fn initWithSource_dataSource(
6440            this: Allocated<Self>,
6441            source: &MPSNNImageNode,
6442            data_source: &ProtocolObject<dyn MPSCNNInstanceNormalizationDataSource>,
6443        ) -> Retained<Self>;
6444    );
6445}
6446
6447/// Methods declared on superclass `MPSNNFilterNode`.
6448impl MPSCNNInstanceNormalizationNode {
6449    extern_methods!(
6450        #[unsafe(method(init))]
6451        #[unsafe(method_family = init)]
6452        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6453    );
6454}
6455
6456/// Methods declared on superclass `NSObject`.
6457impl MPSCNNInstanceNormalizationNode {
6458    extern_methods!(
6459        #[unsafe(method(new))]
6460        #[unsafe(method_family = new)]
6461        pub unsafe fn new() -> Retained<Self>;
6462    );
6463}
6464
6465extern_class!(
6466    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnninstancenormalizationgradientnode?language=objc)
6467    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
6468    #[derive(Debug, PartialEq, Eq, Hash)]
6469    pub struct MPSCNNInstanceNormalizationGradientNode;
6470);
6471
6472extern_conformance!(
6473    unsafe impl MPSNNTrainableNode for MPSCNNInstanceNormalizationGradientNode {}
6474);
6475
6476extern_conformance!(
6477    unsafe impl NSObjectProtocol for MPSCNNInstanceNormalizationGradientNode {}
6478);
6479
6480impl MPSCNNInstanceNormalizationGradientNode {
6481    extern_methods!(
6482        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
6483        #[unsafe(method_family = none)]
6484        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
6485            source_gradient: &MPSNNImageNode,
6486            source_image: &MPSNNImageNode,
6487            gradient_state: &MPSNNGradientStateNode,
6488        ) -> Retained<Self>;
6489
6490        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
6491        #[unsafe(method_family = init)]
6492        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
6493            this: Allocated<Self>,
6494            source_gradient: &MPSNNImageNode,
6495            source_image: &MPSNNImageNode,
6496            gradient_state: &MPSNNGradientStateNode,
6497        ) -> Retained<Self>;
6498    );
6499}
6500
6501/// Methods declared on superclass `MPSNNFilterNode`.
6502impl MPSCNNInstanceNormalizationGradientNode {
6503    extern_methods!(
6504        #[unsafe(method(init))]
6505        #[unsafe(method_family = init)]
6506        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6507    );
6508}
6509
6510/// Methods declared on superclass `NSObject`.
6511impl MPSCNNInstanceNormalizationGradientNode {
6512    extern_methods!(
6513        #[unsafe(method(new))]
6514        #[unsafe(method_family = new)]
6515        pub unsafe fn new() -> Retained<Self>;
6516    );
6517}
6518
6519extern_class!(
6520    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnngroupnormalizationnode?language=objc)
6521    #[unsafe(super(MPSNNFilterNode, NSObject))]
6522    #[derive(Debug, PartialEq, Eq, Hash)]
6523    pub struct MPSCNNGroupNormalizationNode;
6524);
6525
6526extern_conformance!(
6527    unsafe impl MPSNNTrainableNode for MPSCNNGroupNormalizationNode {}
6528);
6529
6530extern_conformance!(
6531    unsafe impl NSObjectProtocol for MPSCNNGroupNormalizationNode {}
6532);
6533
6534impl MPSCNNGroupNormalizationNode {
6535    extern_methods!(
6536        #[cfg(feature = "MPSNeuralNetworkTypes")]
6537        /// The training style of the forward node will be propagated to gradient nodes made from it
6538        #[unsafe(method(trainingStyle))]
6539        #[unsafe(method_family = none)]
6540        pub unsafe fn trainingStyle(&self) -> MPSNNTrainingStyle;
6541
6542        #[cfg(feature = "MPSNeuralNetworkTypes")]
6543        /// Setter for [`trainingStyle`][Self::trainingStyle].
6544        #[unsafe(method(setTrainingStyle:))]
6545        #[unsafe(method_family = none)]
6546        pub unsafe fn setTrainingStyle(&self, training_style: MPSNNTrainingStyle);
6547
6548        #[cfg(feature = "MPSCNNGroupNormalization")]
6549        #[unsafe(method(nodeWithSource:dataSource:))]
6550        #[unsafe(method_family = none)]
6551        pub unsafe fn nodeWithSource_dataSource(
6552            source: &MPSNNImageNode,
6553            data_source: &ProtocolObject<dyn MPSCNNGroupNormalizationDataSource>,
6554        ) -> Retained<Self>;
6555
6556        #[cfg(feature = "MPSCNNGroupNormalization")]
6557        #[unsafe(method(initWithSource:dataSource:))]
6558        #[unsafe(method_family = init)]
6559        pub unsafe fn initWithSource_dataSource(
6560            this: Allocated<Self>,
6561            source: &MPSNNImageNode,
6562            data_source: &ProtocolObject<dyn MPSCNNGroupNormalizationDataSource>,
6563        ) -> Retained<Self>;
6564    );
6565}
6566
6567/// Methods declared on superclass `MPSNNFilterNode`.
6568impl MPSCNNGroupNormalizationNode {
6569    extern_methods!(
6570        #[unsafe(method(init))]
6571        #[unsafe(method_family = init)]
6572        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6573    );
6574}
6575
6576/// Methods declared on superclass `NSObject`.
6577impl MPSCNNGroupNormalizationNode {
6578    extern_methods!(
6579        #[unsafe(method(new))]
6580        #[unsafe(method_family = new)]
6581        pub unsafe fn new() -> Retained<Self>;
6582    );
6583}
6584
6585extern_class!(
6586    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnngroupnormalizationgradientnode?language=objc)
6587    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
6588    #[derive(Debug, PartialEq, Eq, Hash)]
6589    pub struct MPSCNNGroupNormalizationGradientNode;
6590);
6591
6592extern_conformance!(
6593    unsafe impl MPSNNTrainableNode for MPSCNNGroupNormalizationGradientNode {}
6594);
6595
6596extern_conformance!(
6597    unsafe impl NSObjectProtocol for MPSCNNGroupNormalizationGradientNode {}
6598);
6599
6600impl MPSCNNGroupNormalizationGradientNode {
6601    extern_methods!(
6602        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
6603        #[unsafe(method_family = none)]
6604        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
6605            source_gradient: &MPSNNImageNode,
6606            source_image: &MPSNNImageNode,
6607            gradient_state: &MPSNNGradientStateNode,
6608        ) -> Retained<Self>;
6609
6610        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
6611        #[unsafe(method_family = init)]
6612        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
6613            this: Allocated<Self>,
6614            source_gradient: &MPSNNImageNode,
6615            source_image: &MPSNNImageNode,
6616            gradient_state: &MPSNNGradientStateNode,
6617        ) -> Retained<Self>;
6618    );
6619}
6620
6621/// Methods declared on superclass `MPSNNFilterNode`.
6622impl MPSCNNGroupNormalizationGradientNode {
6623    extern_methods!(
6624        #[unsafe(method(init))]
6625        #[unsafe(method_family = init)]
6626        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6627    );
6628}
6629
6630/// Methods declared on superclass `NSObject`.
6631impl MPSCNNGroupNormalizationGradientNode {
6632    extern_methods!(
6633        #[unsafe(method(new))]
6634        #[unsafe(method_family = new)]
6635        pub unsafe fn new() -> Retained<Self>;
6636    );
6637}
6638
6639extern_class!(
6640    /// A node representing batch normalization for inference or training
6641    ///
6642    /// Batch normalization operates differently for inference and training.
6643    /// For inference, the normalization is done according to a static statistical
6644    /// representation of data saved during training. For training, this representation
6645    /// is ever evolving.  In the low level MPS batch normalization interface,
6646    /// during training, the batch normalization is broken up into two steps:
6647    /// calculation of the statistical representation of input data, followed
6648    /// by normalization once the statistics are known for the entire batch.
6649    /// These are MPSCNNBatchNormalizationStatistics and MPSCNNBatchNormalization,
6650    /// respectively.
6651    ///
6652    /// When this node appears in a graph and is not required to produce a
6653    /// MPSCNNBatchNormalizationState -- that is, MPSCNNBatchNormalizationNode.resultState
6654    /// is not used within the graph -- then it operates in inference mode
6655    /// and new batch-only statistics are not calculated. When this state node
6656    /// is consumed, then the node is assumed to be in training mode and
6657    /// new statistics will be calculated and written to the MPSCNNBatchNormalizationState
6658    /// and passed along to the MPSCNNBatchNormalizationGradient and
6659    /// MPSCNNBatchNormalizationStatisticsGradient as necessary. This should
6660    /// allow you to construct an identical sequence of nodes for inference
6661    /// and training and expect the right thing to happen.
6662    ///
6663    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnbatchnormalizationnode?language=objc)
6664    #[unsafe(super(MPSNNFilterNode, NSObject))]
6665    #[derive(Debug, PartialEq, Eq, Hash)]
6666    pub struct MPSCNNBatchNormalizationNode;
6667);
6668
6669extern_conformance!(
6670    unsafe impl MPSNNTrainableNode for MPSCNNBatchNormalizationNode {}
6671);
6672
6673extern_conformance!(
6674    unsafe impl NSObjectProtocol for MPSCNNBatchNormalizationNode {}
6675);
6676
6677impl MPSCNNBatchNormalizationNode {
6678    extern_methods!(
6679        #[cfg(feature = "MPSNeuralNetworkTypes")]
6680        /// Options controlling how batch normalization is calculated
6681        ///
6682        /// Default: MPSCNNBatchNormalizationFlagsDefault
6683        #[unsafe(method(flags))]
6684        #[unsafe(method_family = none)]
6685        pub unsafe fn flags(&self) -> MPSCNNBatchNormalizationFlags;
6686
6687        #[cfg(feature = "MPSNeuralNetworkTypes")]
6688        /// Setter for [`flags`][Self::flags].
6689        #[unsafe(method(setFlags:))]
6690        #[unsafe(method_family = none)]
6691        pub unsafe fn setFlags(&self, flags: MPSCNNBatchNormalizationFlags);
6692
6693        #[cfg(feature = "MPSNeuralNetworkTypes")]
6694        /// The training style of the forward node will be propagated to gradient nodes made from it
6695        #[unsafe(method(trainingStyle))]
6696        #[unsafe(method_family = none)]
6697        pub unsafe fn trainingStyle(&self) -> MPSNNTrainingStyle;
6698
6699        #[cfg(feature = "MPSNeuralNetworkTypes")]
6700        /// Setter for [`trainingStyle`][Self::trainingStyle].
6701        #[unsafe(method(setTrainingStyle:))]
6702        #[unsafe(method_family = none)]
6703        pub unsafe fn setTrainingStyle(&self, training_style: MPSNNTrainingStyle);
6704
6705        #[cfg(feature = "MPSCNNBatchNormalization")]
6706        #[unsafe(method(nodeWithSource:dataSource:))]
6707        #[unsafe(method_family = none)]
6708        pub unsafe fn nodeWithSource_dataSource(
6709            source: &MPSNNImageNode,
6710            data_source: &ProtocolObject<dyn MPSCNNBatchNormalizationDataSource>,
6711        ) -> Retained<Self>;
6712
6713        #[cfg(feature = "MPSCNNBatchNormalization")]
6714        #[unsafe(method(initWithSource:dataSource:))]
6715        #[unsafe(method_family = init)]
6716        pub unsafe fn initWithSource_dataSource(
6717            this: Allocated<Self>,
6718            source: &MPSNNImageNode,
6719            data_source: &ProtocolObject<dyn MPSCNNBatchNormalizationDataSource>,
6720        ) -> Retained<Self>;
6721    );
6722}
6723
6724/// Methods declared on superclass `MPSNNFilterNode`.
6725impl MPSCNNBatchNormalizationNode {
6726    extern_methods!(
6727        #[unsafe(method(init))]
6728        #[unsafe(method_family = init)]
6729        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6730    );
6731}
6732
6733/// Methods declared on superclass `NSObject`.
6734impl MPSCNNBatchNormalizationNode {
6735    extern_methods!(
6736        #[unsafe(method(new))]
6737        #[unsafe(method_family = new)]
6738        pub unsafe fn new() -> Retained<Self>;
6739    );
6740}
6741
6742extern_class!(
6743    /// A node representing batch normalization gradient for training
6744    ///
6745    /// This filter encapsulates the MPSCNNBatchNormalizationStatisticsGradient
6746    /// and MPSCNNBatchNormalizationGradient low level filters as a single
6747    /// node. They will be called in sequence: statistics gradient until the
6748    /// batch is complete, then batch normalization gradient on the result.
6749    ///
6750    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnbatchnormalizationgradientnode?language=objc)
6751    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
6752    #[derive(Debug, PartialEq, Eq, Hash)]
6753    pub struct MPSCNNBatchNormalizationGradientNode;
6754);
6755
6756extern_conformance!(
6757    unsafe impl MPSNNTrainableNode for MPSCNNBatchNormalizationGradientNode {}
6758);
6759
6760extern_conformance!(
6761    unsafe impl NSObjectProtocol for MPSCNNBatchNormalizationGradientNode {}
6762);
6763
6764impl MPSCNNBatchNormalizationGradientNode {
6765    extern_methods!(
6766        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
6767        #[unsafe(method_family = none)]
6768        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
6769            source_gradient: &MPSNNImageNode,
6770            source_image: &MPSNNImageNode,
6771            gradient_state: &MPSNNGradientStateNode,
6772        ) -> Retained<Self>;
6773
6774        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
6775        #[unsafe(method_family = init)]
6776        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
6777            this: Allocated<Self>,
6778            source_gradient: &MPSNNImageNode,
6779            source_image: &MPSNNImageNode,
6780            gradient_state: &MPSNNGradientStateNode,
6781        ) -> Retained<Self>;
6782    );
6783}
6784
6785/// Methods declared on superclass `MPSNNFilterNode`.
6786impl MPSCNNBatchNormalizationGradientNode {
6787    extern_methods!(
6788        #[unsafe(method(init))]
6789        #[unsafe(method_family = init)]
6790        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6791    );
6792}
6793
6794/// Methods declared on superclass `NSObject`.
6795impl MPSCNNBatchNormalizationGradientNode {
6796    extern_methods!(
6797        #[unsafe(method(new))]
6798        #[unsafe(method_family = new)]
6799        pub unsafe fn new() -> Retained<Self>;
6800    );
6801}
6802
6803extern_protocol!(
6804    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsimagetransformprovider?language=objc)
6805    pub unsafe trait MPSImageTransformProvider: NSSecureCoding + NSObjectProtocol {
6806        #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes", feature = "MPSImage"))]
6807        #[unsafe(method(transformForSourceImage:handle:))]
6808        #[unsafe(method_family = none)]
6809        unsafe fn transformForSourceImage_handle(
6810            &self,
6811            image: &MPSImage,
6812            handle: Option<&ProtocolObject<dyn MPSHandle>>,
6813        ) -> MPSScaleTransform;
6814    }
6815);
6816
6817extern_class!(
6818    /// Abstract Node representing a image resampling operation
6819    ///
6820    /// Please make a MPSNNBilinearScale or MPSNNLanczosScale object instead
6821    ///
6822    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnscalenode?language=objc)
6823    #[unsafe(super(MPSNNFilterNode, NSObject))]
6824    #[derive(Debug, PartialEq, Eq, Hash)]
6825    pub struct MPSNNScaleNode;
6826);
6827
6828extern_conformance!(
6829    unsafe impl NSObjectProtocol for MPSNNScaleNode {}
6830);
6831
6832impl MPSNNScaleNode {
6833    extern_methods!(
6834        /// create an autoreleased node to convert a MPSImage to the desired size
6835        ///
6836        /// Parameter `sourceNode`: A valid MPSNNImageNode
6837        ///
6838        /// Parameter `size`: The size of the output image {width, height, depth}
6839        #[unsafe(method(nodeWithSource:outputSize:))]
6840        #[unsafe(method_family = none)]
6841        pub unsafe fn nodeWithSource_outputSize(
6842            source_node: &MPSNNImageNode,
6843            size: MTLSize,
6844        ) -> Retained<Self>;
6845
6846        /// create an autoreleased node to convert a MPSImage to the desired size for a region of interest
6847        ///
6848        /// Parameter `sourceNode`: A valid MPSNNImageNode
6849        ///
6850        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
6851        ///
6852        /// Parameter `size`: The size of the output image {width, height, depth}
6853        #[unsafe(method(nodeWithSource:transformProvider:outputSize:))]
6854        #[unsafe(method_family = none)]
6855        pub unsafe fn nodeWithSource_transformProvider_outputSize(
6856            source_node: &MPSNNImageNode,
6857            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
6858            size: MTLSize,
6859        ) -> Retained<Self>;
6860
6861        /// init a node to convert a MPSImage to the desired size
6862        ///
6863        /// Parameter `sourceNode`: A valid MPSNNImageNode
6864        ///
6865        /// Parameter `size`: The size of the output image {width, height, depth}
6866        #[unsafe(method(initWithSource:outputSize:))]
6867        #[unsafe(method_family = init)]
6868        pub unsafe fn initWithSource_outputSize(
6869            this: Allocated<Self>,
6870            source_node: &MPSNNImageNode,
6871            size: MTLSize,
6872        ) -> Retained<Self>;
6873
6874        /// init a node to convert a MPSImage to the desired size for a region of interest
6875        ///
6876        /// Parameter `sourceNode`: A valid MPSNNImageNode
6877        ///
6878        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
6879        ///
6880        /// Parameter `size`: The size of the output image {width, height, depth}
6881        #[unsafe(method(initWithSource:transformProvider:outputSize:))]
6882        #[unsafe(method_family = init)]
6883        pub unsafe fn initWithSource_transformProvider_outputSize(
6884            this: Allocated<Self>,
6885            source_node: &MPSNNImageNode,
6886            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
6887            size: MTLSize,
6888        ) -> Retained<Self>;
6889    );
6890}
6891
6892/// Methods declared on superclass `MPSNNFilterNode`.
6893impl MPSNNScaleNode {
6894    extern_methods!(
6895        #[unsafe(method(init))]
6896        #[unsafe(method_family = init)]
6897        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6898    );
6899}
6900
6901/// Methods declared on superclass `NSObject`.
6902impl MPSNNScaleNode {
6903    extern_methods!(
6904        #[unsafe(method(new))]
6905        #[unsafe(method_family = new)]
6906        pub unsafe fn new() -> Retained<Self>;
6907    );
6908}
6909
6910extern_class!(
6911    /// A MPSNNScale object that uses bilinear interpolation for resampling
6912    ///
6913    /// Caution: bilinear downscaling by more than a factor of
6914    /// two in any dimension causes loss of information if a
6915    /// low pass filter is not run over the image first. Details
6916    /// may be omitted.
6917    ///
6918    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnbilinearscalenode?language=objc)
6919    #[unsafe(super(MPSNNScaleNode, MPSNNFilterNode, NSObject))]
6920    #[derive(Debug, PartialEq, Eq, Hash)]
6921    pub struct MPSNNBilinearScaleNode;
6922);
6923
6924extern_conformance!(
6925    unsafe impl NSObjectProtocol for MPSNNBilinearScaleNode {}
6926);
6927
6928impl MPSNNBilinearScaleNode {
6929    extern_methods!();
6930}
6931
6932/// Methods declared on superclass `MPSNNScaleNode`.
6933impl MPSNNBilinearScaleNode {
6934    extern_methods!(
6935        /// create an autoreleased node to convert a MPSImage to the desired size
6936        ///
6937        /// Parameter `sourceNode`: A valid MPSNNImageNode
6938        ///
6939        /// Parameter `size`: The size of the output image {width, height, depth}
6940        #[unsafe(method(nodeWithSource:outputSize:))]
6941        #[unsafe(method_family = none)]
6942        pub unsafe fn nodeWithSource_outputSize(
6943            source_node: &MPSNNImageNode,
6944            size: MTLSize,
6945        ) -> Retained<Self>;
6946
6947        /// create an autoreleased node to convert a MPSImage to the desired size for a region of interest
6948        ///
6949        /// Parameter `sourceNode`: A valid MPSNNImageNode
6950        ///
6951        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
6952        ///
6953        /// Parameter `size`: The size of the output image {width, height, depth}
6954        #[unsafe(method(nodeWithSource:transformProvider:outputSize:))]
6955        #[unsafe(method_family = none)]
6956        pub unsafe fn nodeWithSource_transformProvider_outputSize(
6957            source_node: &MPSNNImageNode,
6958            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
6959            size: MTLSize,
6960        ) -> Retained<Self>;
6961
6962        /// init a node to convert a MPSImage to the desired size
6963        ///
6964        /// Parameter `sourceNode`: A valid MPSNNImageNode
6965        ///
6966        /// Parameter `size`: The size of the output image {width, height, depth}
6967        #[unsafe(method(initWithSource:outputSize:))]
6968        #[unsafe(method_family = init)]
6969        pub unsafe fn initWithSource_outputSize(
6970            this: Allocated<Self>,
6971            source_node: &MPSNNImageNode,
6972            size: MTLSize,
6973        ) -> Retained<Self>;
6974
6975        /// init a node to convert a MPSImage to the desired size for a region of interest
6976        ///
6977        /// Parameter `sourceNode`: A valid MPSNNImageNode
6978        ///
6979        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
6980        ///
6981        /// Parameter `size`: The size of the output image {width, height, depth}
6982        #[unsafe(method(initWithSource:transformProvider:outputSize:))]
6983        #[unsafe(method_family = init)]
6984        pub unsafe fn initWithSource_transformProvider_outputSize(
6985            this: Allocated<Self>,
6986            source_node: &MPSNNImageNode,
6987            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
6988            size: MTLSize,
6989        ) -> Retained<Self>;
6990    );
6991}
6992
6993/// Methods declared on superclass `MPSNNFilterNode`.
6994impl MPSNNBilinearScaleNode {
6995    extern_methods!(
6996        #[unsafe(method(init))]
6997        #[unsafe(method_family = init)]
6998        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
6999    );
7000}
7001
7002/// Methods declared on superclass `NSObject`.
7003impl MPSNNBilinearScaleNode {
7004    extern_methods!(
7005        #[unsafe(method(new))]
7006        #[unsafe(method_family = new)]
7007        pub unsafe fn new() -> Retained<Self>;
7008    );
7009}
7010
7011extern_class!(
7012    /// A MPSNNScale object that uses the Lanczos resampling filter
7013    ///
7014    /// This method does not require a low pass filter for downsampling
7015    /// by more than a factor of two. Caution: may cause ringing, which
7016    /// could prove distracting to a neural network unused to seeing it.
7017    /// You should use the resampling method that was used to train the
7018    /// network.
7019    ///
7020    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnlanczosscalenode?language=objc)
7021    #[unsafe(super(MPSNNScaleNode, MPSNNFilterNode, NSObject))]
7022    #[derive(Debug, PartialEq, Eq, Hash)]
7023    pub struct MPSNNLanczosScaleNode;
7024);
7025
7026extern_conformance!(
7027    unsafe impl NSObjectProtocol for MPSNNLanczosScaleNode {}
7028);
7029
7030impl MPSNNLanczosScaleNode {
7031    extern_methods!();
7032}
7033
7034/// Methods declared on superclass `MPSNNScaleNode`.
7035impl MPSNNLanczosScaleNode {
7036    extern_methods!(
7037        /// create an autoreleased node to convert a MPSImage to the desired size
7038        ///
7039        /// Parameter `sourceNode`: A valid MPSNNImageNode
7040        ///
7041        /// Parameter `size`: The size of the output image {width, height, depth}
7042        #[unsafe(method(nodeWithSource:outputSize:))]
7043        #[unsafe(method_family = none)]
7044        pub unsafe fn nodeWithSource_outputSize(
7045            source_node: &MPSNNImageNode,
7046            size: MTLSize,
7047        ) -> Retained<Self>;
7048
7049        /// create an autoreleased node to convert a MPSImage to the desired size for a region of interest
7050        ///
7051        /// Parameter `sourceNode`: A valid MPSNNImageNode
7052        ///
7053        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
7054        ///
7055        /// Parameter `size`: The size of the output image {width, height, depth}
7056        #[unsafe(method(nodeWithSource:transformProvider:outputSize:))]
7057        #[unsafe(method_family = none)]
7058        pub unsafe fn nodeWithSource_transformProvider_outputSize(
7059            source_node: &MPSNNImageNode,
7060            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
7061            size: MTLSize,
7062        ) -> Retained<Self>;
7063
7064        /// init a node to convert a MPSImage to the desired size
7065        ///
7066        /// Parameter `sourceNode`: A valid MPSNNImageNode
7067        ///
7068        /// Parameter `size`: The size of the output image {width, height, depth}
7069        #[unsafe(method(initWithSource:outputSize:))]
7070        #[unsafe(method_family = init)]
7071        pub unsafe fn initWithSource_outputSize(
7072            this: Allocated<Self>,
7073            source_node: &MPSNNImageNode,
7074            size: MTLSize,
7075        ) -> Retained<Self>;
7076
7077        /// init a node to convert a MPSImage to the desired size for a region of interest
7078        ///
7079        /// Parameter `sourceNode`: A valid MPSNNImageNode
7080        ///
7081        /// Parameter `transformProvider`: If non-nil, a valid MPSImageTransformProvider that provides the region of interest
7082        ///
7083        /// Parameter `size`: The size of the output image {width, height, depth}
7084        #[unsafe(method(initWithSource:transformProvider:outputSize:))]
7085        #[unsafe(method_family = init)]
7086        pub unsafe fn initWithSource_transformProvider_outputSize(
7087            this: Allocated<Self>,
7088            source_node: &MPSNNImageNode,
7089            transform_provider: Option<&ProtocolObject<dyn MPSImageTransformProvider>>,
7090            size: MTLSize,
7091        ) -> Retained<Self>;
7092    );
7093}
7094
7095/// Methods declared on superclass `MPSNNFilterNode`.
7096impl MPSNNLanczosScaleNode {
7097    extern_methods!(
7098        #[unsafe(method(init))]
7099        #[unsafe(method_family = init)]
7100        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7101    );
7102}
7103
7104/// Methods declared on superclass `NSObject`.
7105impl MPSNNLanczosScaleNode {
7106    extern_methods!(
7107        #[unsafe(method(new))]
7108        #[unsafe(method_family = new)]
7109        pub unsafe fn new() -> Retained<Self>;
7110    );
7111}
7112
7113extern_class!(
7114    /// virtual base class for basic arithmetic nodes
7115    ///
7116    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnbinaryarithmeticnode?language=objc)
7117    #[unsafe(super(MPSNNFilterNode, NSObject))]
7118    #[derive(Debug, PartialEq, Eq, Hash)]
7119    pub struct MPSNNBinaryArithmeticNode;
7120);
7121
7122extern_conformance!(
7123    unsafe impl NSObjectProtocol for MPSNNBinaryArithmeticNode {}
7124);
7125
7126impl MPSNNBinaryArithmeticNode {
7127    extern_methods!(
7128        /// create an autoreleased arithemtic node with an array of sources
7129        ///
7130        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7131        #[unsafe(method(nodeWithSources:))]
7132        #[unsafe(method_family = none)]
7133        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7134
7135        /// create an autoreleased arithemtic node with two sources
7136        ///
7137        /// Parameter `left`: the left operand
7138        ///
7139        /// Parameter `right`: the right operand
7140        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7141        #[unsafe(method_family = none)]
7142        pub unsafe fn nodeWithLeftSource_rightSource(
7143            left: &MPSNNImageNode,
7144            right: &MPSNNImageNode,
7145        ) -> Retained<Self>;
7146
7147        /// init an arithemtic node with an array of sources
7148        ///
7149        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7150        #[unsafe(method(initWithSources:))]
7151        #[unsafe(method_family = init)]
7152        pub unsafe fn initWithSources(
7153            this: Allocated<Self>,
7154            source_nodes: &NSArray<MPSNNImageNode>,
7155        ) -> Retained<Self>;
7156
7157        /// init an arithemtic node with two sources
7158        ///
7159        /// Parameter `left`: the left operand
7160        ///
7161        /// Parameter `right`: the right operand
7162        #[unsafe(method(initWithLeftSource:rightSource:))]
7163        #[unsafe(method_family = init)]
7164        pub unsafe fn initWithLeftSource_rightSource(
7165            this: Allocated<Self>,
7166            left: &MPSNNImageNode,
7167            right: &MPSNNImageNode,
7168        ) -> Retained<Self>;
7169
7170        #[unsafe(method(gradientClass))]
7171        #[unsafe(method_family = none)]
7172        pub unsafe fn gradientClass(&self) -> &'static AnyClass;
7173
7174        #[unsafe(method(gradientFilterWithSources:))]
7175        #[unsafe(method_family = none)]
7176        pub unsafe fn gradientFilterWithSources(
7177            &self,
7178            gradient_images: &NSArray<MPSNNImageNode>,
7179        ) -> Retained<MPSNNGradientFilterNode>;
7180
7181        /// create new arithmetic gradient nodes
7182        ///
7183        /// Create two new arithmetic gradient nodes - one that computes the gradient for the primary
7184        /// source image and one that computes the gradient for the secondary sourcefrom the inference pass.
7185        #[unsafe(method(gradientFiltersWithSources:))]
7186        #[unsafe(method_family = none)]
7187        pub unsafe fn gradientFiltersWithSources(
7188            &self,
7189            gradient_images: &NSArray<MPSNNImageNode>,
7190        ) -> Retained<NSArray<MPSNNGradientFilterNode>>;
7191
7192        #[unsafe(method(primaryScale))]
7193        #[unsafe(method_family = none)]
7194        pub unsafe fn primaryScale(&self) -> c_float;
7195
7196        /// Setter for [`primaryScale`][Self::primaryScale].
7197        #[unsafe(method(setPrimaryScale:))]
7198        #[unsafe(method_family = none)]
7199        pub unsafe fn setPrimaryScale(&self, primary_scale: c_float);
7200
7201        #[unsafe(method(secondaryScale))]
7202        #[unsafe(method_family = none)]
7203        pub unsafe fn secondaryScale(&self) -> c_float;
7204
7205        /// Setter for [`secondaryScale`][Self::secondaryScale].
7206        #[unsafe(method(setSecondaryScale:))]
7207        #[unsafe(method_family = none)]
7208        pub unsafe fn setSecondaryScale(&self, secondary_scale: c_float);
7209
7210        #[unsafe(method(bias))]
7211        #[unsafe(method_family = none)]
7212        pub unsafe fn bias(&self) -> c_float;
7213
7214        /// Setter for [`bias`][Self::bias].
7215        #[unsafe(method(setBias:))]
7216        #[unsafe(method_family = none)]
7217        pub unsafe fn setBias(&self, bias: c_float);
7218
7219        #[unsafe(method(primaryStrideInPixelsX))]
7220        #[unsafe(method_family = none)]
7221        pub unsafe fn primaryStrideInPixelsX(&self) -> NSUInteger;
7222
7223        /// Setter for [`primaryStrideInPixelsX`][Self::primaryStrideInPixelsX].
7224        #[unsafe(method(setPrimaryStrideInPixelsX:))]
7225        #[unsafe(method_family = none)]
7226        pub unsafe fn setPrimaryStrideInPixelsX(&self, primary_stride_in_pixels_x: NSUInteger);
7227
7228        #[unsafe(method(primaryStrideInPixelsY))]
7229        #[unsafe(method_family = none)]
7230        pub unsafe fn primaryStrideInPixelsY(&self) -> NSUInteger;
7231
7232        /// Setter for [`primaryStrideInPixelsY`][Self::primaryStrideInPixelsY].
7233        #[unsafe(method(setPrimaryStrideInPixelsY:))]
7234        #[unsafe(method_family = none)]
7235        pub unsafe fn setPrimaryStrideInPixelsY(&self, primary_stride_in_pixels_y: NSUInteger);
7236
7237        #[unsafe(method(primaryStrideInFeatureChannels))]
7238        #[unsafe(method_family = none)]
7239        pub unsafe fn primaryStrideInFeatureChannels(&self) -> NSUInteger;
7240
7241        /// Setter for [`primaryStrideInFeatureChannels`][Self::primaryStrideInFeatureChannels].
7242        #[unsafe(method(setPrimaryStrideInFeatureChannels:))]
7243        #[unsafe(method_family = none)]
7244        pub unsafe fn setPrimaryStrideInFeatureChannels(
7245            &self,
7246            primary_stride_in_feature_channels: NSUInteger,
7247        );
7248
7249        #[unsafe(method(secondaryStrideInPixelsX))]
7250        #[unsafe(method_family = none)]
7251        pub unsafe fn secondaryStrideInPixelsX(&self) -> NSUInteger;
7252
7253        /// Setter for [`secondaryStrideInPixelsX`][Self::secondaryStrideInPixelsX].
7254        #[unsafe(method(setSecondaryStrideInPixelsX:))]
7255        #[unsafe(method_family = none)]
7256        pub unsafe fn setSecondaryStrideInPixelsX(&self, secondary_stride_in_pixels_x: NSUInteger);
7257
7258        #[unsafe(method(secondaryStrideInPixelsY))]
7259        #[unsafe(method_family = none)]
7260        pub unsafe fn secondaryStrideInPixelsY(&self) -> NSUInteger;
7261
7262        /// Setter for [`secondaryStrideInPixelsY`][Self::secondaryStrideInPixelsY].
7263        #[unsafe(method(setSecondaryStrideInPixelsY:))]
7264        #[unsafe(method_family = none)]
7265        pub unsafe fn setSecondaryStrideInPixelsY(&self, secondary_stride_in_pixels_y: NSUInteger);
7266
7267        #[unsafe(method(secondaryStrideInFeatureChannels))]
7268        #[unsafe(method_family = none)]
7269        pub unsafe fn secondaryStrideInFeatureChannels(&self) -> NSUInteger;
7270
7271        /// Setter for [`secondaryStrideInFeatureChannels`][Self::secondaryStrideInFeatureChannels].
7272        #[unsafe(method(setSecondaryStrideInFeatureChannels:))]
7273        #[unsafe(method_family = none)]
7274        pub unsafe fn setSecondaryStrideInFeatureChannels(
7275            &self,
7276            secondary_stride_in_feature_channels: NSUInteger,
7277        );
7278
7279        #[unsafe(method(minimumValue))]
7280        #[unsafe(method_family = none)]
7281        pub unsafe fn minimumValue(&self) -> c_float;
7282
7283        /// Setter for [`minimumValue`][Self::minimumValue].
7284        #[unsafe(method(setMinimumValue:))]
7285        #[unsafe(method_family = none)]
7286        pub unsafe fn setMinimumValue(&self, minimum_value: c_float);
7287
7288        #[unsafe(method(maximumValue))]
7289        #[unsafe(method_family = none)]
7290        pub unsafe fn maximumValue(&self) -> c_float;
7291
7292        /// Setter for [`maximumValue`][Self::maximumValue].
7293        #[unsafe(method(setMaximumValue:))]
7294        #[unsafe(method_family = none)]
7295        pub unsafe fn setMaximumValue(&self, maximum_value: c_float);
7296    );
7297}
7298
7299/// Methods declared on superclass `MPSNNFilterNode`.
7300impl MPSNNBinaryArithmeticNode {
7301    extern_methods!(
7302        #[unsafe(method(init))]
7303        #[unsafe(method_family = init)]
7304        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7305    );
7306}
7307
7308/// Methods declared on superclass `NSObject`.
7309impl MPSNNBinaryArithmeticNode {
7310    extern_methods!(
7311        #[unsafe(method(new))]
7312        #[unsafe(method_family = new)]
7313        pub unsafe fn new() -> Retained<Self>;
7314    );
7315}
7316
7317extern_class!(
7318    /// returns elementwise sum of left + right
7319    ///
7320    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnadditionnode?language=objc)
7321    #[unsafe(super(MPSNNBinaryArithmeticNode, MPSNNFilterNode, NSObject))]
7322    #[derive(Debug, PartialEq, Eq, Hash)]
7323    pub struct MPSNNAdditionNode;
7324);
7325
7326extern_conformance!(
7327    unsafe impl NSObjectProtocol for MPSNNAdditionNode {}
7328);
7329
7330impl MPSNNAdditionNode {
7331    extern_methods!();
7332}
7333
7334/// Methods declared on superclass `MPSNNBinaryArithmeticNode`.
7335impl MPSNNAdditionNode {
7336    extern_methods!(
7337        /// create an autoreleased arithemtic node with an array of sources
7338        ///
7339        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7340        #[unsafe(method(nodeWithSources:))]
7341        #[unsafe(method_family = none)]
7342        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7343
7344        /// create an autoreleased arithemtic node with two sources
7345        ///
7346        /// Parameter `left`: the left operand
7347        ///
7348        /// Parameter `right`: the right operand
7349        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7350        #[unsafe(method_family = none)]
7351        pub unsafe fn nodeWithLeftSource_rightSource(
7352            left: &MPSNNImageNode,
7353            right: &MPSNNImageNode,
7354        ) -> Retained<Self>;
7355
7356        /// init an arithemtic node with an array of sources
7357        ///
7358        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7359        #[unsafe(method(initWithSources:))]
7360        #[unsafe(method_family = init)]
7361        pub unsafe fn initWithSources(
7362            this: Allocated<Self>,
7363            source_nodes: &NSArray<MPSNNImageNode>,
7364        ) -> Retained<Self>;
7365
7366        /// init an arithemtic node with two sources
7367        ///
7368        /// Parameter `left`: the left operand
7369        ///
7370        /// Parameter `right`: the right operand
7371        #[unsafe(method(initWithLeftSource:rightSource:))]
7372        #[unsafe(method_family = init)]
7373        pub unsafe fn initWithLeftSource_rightSource(
7374            this: Allocated<Self>,
7375            left: &MPSNNImageNode,
7376            right: &MPSNNImageNode,
7377        ) -> Retained<Self>;
7378    );
7379}
7380
7381/// Methods declared on superclass `MPSNNFilterNode`.
7382impl MPSNNAdditionNode {
7383    extern_methods!(
7384        #[unsafe(method(init))]
7385        #[unsafe(method_family = init)]
7386        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7387    );
7388}
7389
7390/// Methods declared on superclass `NSObject`.
7391impl MPSNNAdditionNode {
7392    extern_methods!(
7393        #[unsafe(method(new))]
7394        #[unsafe(method_family = new)]
7395        pub unsafe fn new() -> Retained<Self>;
7396    );
7397}
7398
7399extern_class!(
7400    /// returns elementwise difference of left - right
7401    ///
7402    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnsubtractionnode?language=objc)
7403    #[unsafe(super(MPSNNBinaryArithmeticNode, MPSNNFilterNode, NSObject))]
7404    #[derive(Debug, PartialEq, Eq, Hash)]
7405    pub struct MPSNNSubtractionNode;
7406);
7407
7408extern_conformance!(
7409    unsafe impl NSObjectProtocol for MPSNNSubtractionNode {}
7410);
7411
7412impl MPSNNSubtractionNode {
7413    extern_methods!();
7414}
7415
7416/// Methods declared on superclass `MPSNNBinaryArithmeticNode`.
7417impl MPSNNSubtractionNode {
7418    extern_methods!(
7419        /// create an autoreleased arithemtic node with an array of sources
7420        ///
7421        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7422        #[unsafe(method(nodeWithSources:))]
7423        #[unsafe(method_family = none)]
7424        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7425
7426        /// create an autoreleased arithemtic node with two sources
7427        ///
7428        /// Parameter `left`: the left operand
7429        ///
7430        /// Parameter `right`: the right operand
7431        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7432        #[unsafe(method_family = none)]
7433        pub unsafe fn nodeWithLeftSource_rightSource(
7434            left: &MPSNNImageNode,
7435            right: &MPSNNImageNode,
7436        ) -> Retained<Self>;
7437
7438        /// init an arithemtic node with an array of sources
7439        ///
7440        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7441        #[unsafe(method(initWithSources:))]
7442        #[unsafe(method_family = init)]
7443        pub unsafe fn initWithSources(
7444            this: Allocated<Self>,
7445            source_nodes: &NSArray<MPSNNImageNode>,
7446        ) -> Retained<Self>;
7447
7448        /// init an arithemtic node with two sources
7449        ///
7450        /// Parameter `left`: the left operand
7451        ///
7452        /// Parameter `right`: the right operand
7453        #[unsafe(method(initWithLeftSource:rightSource:))]
7454        #[unsafe(method_family = init)]
7455        pub unsafe fn initWithLeftSource_rightSource(
7456            this: Allocated<Self>,
7457            left: &MPSNNImageNode,
7458            right: &MPSNNImageNode,
7459        ) -> Retained<Self>;
7460    );
7461}
7462
7463/// Methods declared on superclass `MPSNNFilterNode`.
7464impl MPSNNSubtractionNode {
7465    extern_methods!(
7466        #[unsafe(method(init))]
7467        #[unsafe(method_family = init)]
7468        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7469    );
7470}
7471
7472/// Methods declared on superclass `NSObject`.
7473impl MPSNNSubtractionNode {
7474    extern_methods!(
7475        #[unsafe(method(new))]
7476        #[unsafe(method_family = new)]
7477        pub unsafe fn new() -> Retained<Self>;
7478    );
7479}
7480
7481extern_class!(
7482    /// returns elementwise product of left * right
7483    ///
7484    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnmultiplicationnode?language=objc)
7485    #[unsafe(super(MPSNNBinaryArithmeticNode, MPSNNFilterNode, NSObject))]
7486    #[derive(Debug, PartialEq, Eq, Hash)]
7487    pub struct MPSNNMultiplicationNode;
7488);
7489
7490extern_conformance!(
7491    unsafe impl NSObjectProtocol for MPSNNMultiplicationNode {}
7492);
7493
7494impl MPSNNMultiplicationNode {
7495    extern_methods!();
7496}
7497
7498/// Methods declared on superclass `MPSNNBinaryArithmeticNode`.
7499impl MPSNNMultiplicationNode {
7500    extern_methods!(
7501        /// create an autoreleased arithemtic node with an array of sources
7502        ///
7503        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7504        #[unsafe(method(nodeWithSources:))]
7505        #[unsafe(method_family = none)]
7506        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7507
7508        /// create an autoreleased arithemtic node with two sources
7509        ///
7510        /// Parameter `left`: the left operand
7511        ///
7512        /// Parameter `right`: the right operand
7513        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7514        #[unsafe(method_family = none)]
7515        pub unsafe fn nodeWithLeftSource_rightSource(
7516            left: &MPSNNImageNode,
7517            right: &MPSNNImageNode,
7518        ) -> Retained<Self>;
7519
7520        /// init an arithemtic node with an array of sources
7521        ///
7522        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7523        #[unsafe(method(initWithSources:))]
7524        #[unsafe(method_family = init)]
7525        pub unsafe fn initWithSources(
7526            this: Allocated<Self>,
7527            source_nodes: &NSArray<MPSNNImageNode>,
7528        ) -> Retained<Self>;
7529
7530        /// init an arithemtic node with two sources
7531        ///
7532        /// Parameter `left`: the left operand
7533        ///
7534        /// Parameter `right`: the right operand
7535        #[unsafe(method(initWithLeftSource:rightSource:))]
7536        #[unsafe(method_family = init)]
7537        pub unsafe fn initWithLeftSource_rightSource(
7538            this: Allocated<Self>,
7539            left: &MPSNNImageNode,
7540            right: &MPSNNImageNode,
7541        ) -> Retained<Self>;
7542    );
7543}
7544
7545/// Methods declared on superclass `MPSNNFilterNode`.
7546impl MPSNNMultiplicationNode {
7547    extern_methods!(
7548        #[unsafe(method(init))]
7549        #[unsafe(method_family = init)]
7550        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7551    );
7552}
7553
7554/// Methods declared on superclass `NSObject`.
7555impl MPSNNMultiplicationNode {
7556    extern_methods!(
7557        #[unsafe(method(new))]
7558        #[unsafe(method_family = new)]
7559        pub unsafe fn new() -> Retained<Self>;
7560    );
7561}
7562
7563extern_class!(
7564    /// returns elementwise quotient of left / right
7565    ///
7566    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnndivisionnode?language=objc)
7567    #[unsafe(super(MPSNNBinaryArithmeticNode, MPSNNFilterNode, NSObject))]
7568    #[derive(Debug, PartialEq, Eq, Hash)]
7569    pub struct MPSNNDivisionNode;
7570);
7571
7572extern_conformance!(
7573    unsafe impl NSObjectProtocol for MPSNNDivisionNode {}
7574);
7575
7576impl MPSNNDivisionNode {
7577    extern_methods!();
7578}
7579
7580/// Methods declared on superclass `MPSNNBinaryArithmeticNode`.
7581impl MPSNNDivisionNode {
7582    extern_methods!(
7583        /// create an autoreleased arithemtic node with an array of sources
7584        ///
7585        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7586        #[unsafe(method(nodeWithSources:))]
7587        #[unsafe(method_family = none)]
7588        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7589
7590        /// create an autoreleased arithemtic node with two sources
7591        ///
7592        /// Parameter `left`: the left operand
7593        ///
7594        /// Parameter `right`: the right operand
7595        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7596        #[unsafe(method_family = none)]
7597        pub unsafe fn nodeWithLeftSource_rightSource(
7598            left: &MPSNNImageNode,
7599            right: &MPSNNImageNode,
7600        ) -> Retained<Self>;
7601
7602        /// init an arithemtic node with an array of sources
7603        ///
7604        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7605        #[unsafe(method(initWithSources:))]
7606        #[unsafe(method_family = init)]
7607        pub unsafe fn initWithSources(
7608            this: Allocated<Self>,
7609            source_nodes: &NSArray<MPSNNImageNode>,
7610        ) -> Retained<Self>;
7611
7612        /// init an arithemtic node with two sources
7613        ///
7614        /// Parameter `left`: the left operand
7615        ///
7616        /// Parameter `right`: the right operand
7617        #[unsafe(method(initWithLeftSource:rightSource:))]
7618        #[unsafe(method_family = init)]
7619        pub unsafe fn initWithLeftSource_rightSource(
7620            this: Allocated<Self>,
7621            left: &MPSNNImageNode,
7622            right: &MPSNNImageNode,
7623        ) -> Retained<Self>;
7624    );
7625}
7626
7627/// Methods declared on superclass `MPSNNFilterNode`.
7628impl MPSNNDivisionNode {
7629    extern_methods!(
7630        #[unsafe(method(init))]
7631        #[unsafe(method_family = init)]
7632        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7633    );
7634}
7635
7636/// Methods declared on superclass `NSObject`.
7637impl MPSNNDivisionNode {
7638    extern_methods!(
7639        #[unsafe(method(new))]
7640        #[unsafe(method_family = new)]
7641        pub unsafe fn new() -> Retained<Self>;
7642    );
7643}
7644
7645extern_class!(
7646    /// returns elementwise comparison of left and right
7647    ///
7648    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnncomparisonnode?language=objc)
7649    #[unsafe(super(MPSNNBinaryArithmeticNode, MPSNNFilterNode, NSObject))]
7650    #[derive(Debug, PartialEq, Eq, Hash)]
7651    pub struct MPSNNComparisonNode;
7652);
7653
7654extern_conformance!(
7655    unsafe impl NSObjectProtocol for MPSNNComparisonNode {}
7656);
7657
7658impl MPSNNComparisonNode {
7659    extern_methods!(
7660        #[cfg(feature = "MPSCNNMath")]
7661        /// The comparison type to set on the underlying kernel.  Defaults
7662        /// to MPSNNComparisonTypeEqual.
7663        #[unsafe(method(comparisonType))]
7664        #[unsafe(method_family = none)]
7665        pub unsafe fn comparisonType(&self) -> MPSNNComparisonType;
7666
7667        #[cfg(feature = "MPSCNNMath")]
7668        /// Setter for [`comparisonType`][Self::comparisonType].
7669        #[unsafe(method(setComparisonType:))]
7670        #[unsafe(method_family = none)]
7671        pub unsafe fn setComparisonType(&self, comparison_type: MPSNNComparisonType);
7672    );
7673}
7674
7675/// Methods declared on superclass `MPSNNBinaryArithmeticNode`.
7676impl MPSNNComparisonNode {
7677    extern_methods!(
7678        /// create an autoreleased arithemtic node with an array of sources
7679        ///
7680        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7681        #[unsafe(method(nodeWithSources:))]
7682        #[unsafe(method_family = none)]
7683        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
7684
7685        /// create an autoreleased arithemtic node with two sources
7686        ///
7687        /// Parameter `left`: the left operand
7688        ///
7689        /// Parameter `right`: the right operand
7690        #[unsafe(method(nodeWithLeftSource:rightSource:))]
7691        #[unsafe(method_family = none)]
7692        pub unsafe fn nodeWithLeftSource_rightSource(
7693            left: &MPSNNImageNode,
7694            right: &MPSNNImageNode,
7695        ) -> Retained<Self>;
7696
7697        /// init an arithemtic node with an array of sources
7698        ///
7699        /// Parameter `sourceNodes`: A valid NSArray containing two sources
7700        #[unsafe(method(initWithSources:))]
7701        #[unsafe(method_family = init)]
7702        pub unsafe fn initWithSources(
7703            this: Allocated<Self>,
7704            source_nodes: &NSArray<MPSNNImageNode>,
7705        ) -> Retained<Self>;
7706
7707        /// init an arithemtic node with two sources
7708        ///
7709        /// Parameter `left`: the left operand
7710        ///
7711        /// Parameter `right`: the right operand
7712        #[unsafe(method(initWithLeftSource:rightSource:))]
7713        #[unsafe(method_family = init)]
7714        pub unsafe fn initWithLeftSource_rightSource(
7715            this: Allocated<Self>,
7716            left: &MPSNNImageNode,
7717            right: &MPSNNImageNode,
7718        ) -> Retained<Self>;
7719    );
7720}
7721
7722/// Methods declared on superclass `MPSNNFilterNode`.
7723impl MPSNNComparisonNode {
7724    extern_methods!(
7725        #[unsafe(method(init))]
7726        #[unsafe(method_family = init)]
7727        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7728    );
7729}
7730
7731/// Methods declared on superclass `NSObject`.
7732impl MPSNNComparisonNode {
7733    extern_methods!(
7734        #[unsafe(method(new))]
7735        #[unsafe(method_family = new)]
7736        pub unsafe fn new() -> Retained<Self>;
7737    );
7738}
7739
7740extern_class!(
7741    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnarithmeticgradientnode?language=objc)
7742    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
7743    #[derive(Debug, PartialEq, Eq, Hash)]
7744    pub struct MPSNNArithmeticGradientNode;
7745);
7746
7747extern_conformance!(
7748    unsafe impl NSObjectProtocol for MPSNNArithmeticGradientNode {}
7749);
7750
7751impl MPSNNArithmeticGradientNode {
7752    extern_methods!(
7753        /// create a new arithmetic gradient node
7754        ///
7755        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7756        /// for an easier way to do this.
7757        ///
7758        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
7759        ///
7760        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
7761        ///
7762        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
7763        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
7764        #[unsafe(method_family = none)]
7765        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
7766            source_gradient: &MPSNNImageNode,
7767            source_image: &MPSNNImageNode,
7768            gradient_state: &MPSNNBinaryGradientStateNode,
7769            is_secondary_source_filter: bool,
7770        ) -> Retained<Self>;
7771
7772        /// create a new arithmetic gradient node
7773        ///
7774        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7775        /// for an easier way to do this.
7776        ///
7777        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
7778        ///
7779        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
7780        ///
7781        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
7782        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
7783        #[unsafe(method_family = init)]
7784        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
7785            this: Allocated<Self>,
7786            source_gradient: &MPSNNImageNode,
7787            source_image: &MPSNNImageNode,
7788            gradient_state: &MPSNNBinaryGradientStateNode,
7789            is_secondary_source_filter: bool,
7790        ) -> Retained<Self>;
7791
7792        /// create a new arithmetic gradient node
7793        ///
7794        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7795        /// for an easier way to do this.
7796        ///
7797        /// Parameter `gradientImages`: The input gradient from the 'downstream' gradient filter and the source input image
7798        /// from the forward pass (primary or secondary).
7799        ///
7800        /// Parameter `filter`: The matching filter node from the forward pass.
7801        ///
7802        /// Parameter `isSecondarySourceFilter`: The isSecondarySourceFilter property is used to indicate whether the arithmetic
7803        /// gradient filter is operating on the primary or secondary source image from the
7804        /// forward pass.
7805        #[unsafe(method(initWithGradientImages:forwardFilter:isSecondarySourceFilter:))]
7806        #[unsafe(method_family = init)]
7807        pub unsafe fn initWithGradientImages_forwardFilter_isSecondarySourceFilter(
7808            this: Allocated<Self>,
7809            gradient_images: &NSArray<MPSNNImageNode>,
7810            filter: &MPSNNFilterNode,
7811            is_secondary_source_filter: bool,
7812        ) -> Retained<Self>;
7813
7814        #[unsafe(method(primaryScale))]
7815        #[unsafe(method_family = none)]
7816        pub unsafe fn primaryScale(&self) -> c_float;
7817
7818        /// Setter for [`primaryScale`][Self::primaryScale].
7819        #[unsafe(method(setPrimaryScale:))]
7820        #[unsafe(method_family = none)]
7821        pub unsafe fn setPrimaryScale(&self, primary_scale: c_float);
7822
7823        #[unsafe(method(secondaryScale))]
7824        #[unsafe(method_family = none)]
7825        pub unsafe fn secondaryScale(&self) -> c_float;
7826
7827        /// Setter for [`secondaryScale`][Self::secondaryScale].
7828        #[unsafe(method(setSecondaryScale:))]
7829        #[unsafe(method_family = none)]
7830        pub unsafe fn setSecondaryScale(&self, secondary_scale: c_float);
7831
7832        #[unsafe(method(bias))]
7833        #[unsafe(method_family = none)]
7834        pub unsafe fn bias(&self) -> c_float;
7835
7836        /// Setter for [`bias`][Self::bias].
7837        #[unsafe(method(setBias:))]
7838        #[unsafe(method_family = none)]
7839        pub unsafe fn setBias(&self, bias: c_float);
7840
7841        #[unsafe(method(secondaryStrideInPixelsX))]
7842        #[unsafe(method_family = none)]
7843        pub unsafe fn secondaryStrideInPixelsX(&self) -> NSUInteger;
7844
7845        /// Setter for [`secondaryStrideInPixelsX`][Self::secondaryStrideInPixelsX].
7846        #[unsafe(method(setSecondaryStrideInPixelsX:))]
7847        #[unsafe(method_family = none)]
7848        pub unsafe fn setSecondaryStrideInPixelsX(&self, secondary_stride_in_pixels_x: NSUInteger);
7849
7850        #[unsafe(method(secondaryStrideInPixelsY))]
7851        #[unsafe(method_family = none)]
7852        pub unsafe fn secondaryStrideInPixelsY(&self) -> NSUInteger;
7853
7854        /// Setter for [`secondaryStrideInPixelsY`][Self::secondaryStrideInPixelsY].
7855        #[unsafe(method(setSecondaryStrideInPixelsY:))]
7856        #[unsafe(method_family = none)]
7857        pub unsafe fn setSecondaryStrideInPixelsY(&self, secondary_stride_in_pixels_y: NSUInteger);
7858
7859        #[unsafe(method(secondaryStrideInFeatureChannels))]
7860        #[unsafe(method_family = none)]
7861        pub unsafe fn secondaryStrideInFeatureChannels(&self) -> NSUInteger;
7862
7863        /// Setter for [`secondaryStrideInFeatureChannels`][Self::secondaryStrideInFeatureChannels].
7864        #[unsafe(method(setSecondaryStrideInFeatureChannels:))]
7865        #[unsafe(method_family = none)]
7866        pub unsafe fn setSecondaryStrideInFeatureChannels(
7867            &self,
7868            secondary_stride_in_feature_channels: NSUInteger,
7869        );
7870
7871        #[unsafe(method(minimumValue))]
7872        #[unsafe(method_family = none)]
7873        pub unsafe fn minimumValue(&self) -> c_float;
7874
7875        /// Setter for [`minimumValue`][Self::minimumValue].
7876        #[unsafe(method(setMinimumValue:))]
7877        #[unsafe(method_family = none)]
7878        pub unsafe fn setMinimumValue(&self, minimum_value: c_float);
7879
7880        #[unsafe(method(maximumValue))]
7881        #[unsafe(method_family = none)]
7882        pub unsafe fn maximumValue(&self) -> c_float;
7883
7884        /// Setter for [`maximumValue`][Self::maximumValue].
7885        #[unsafe(method(setMaximumValue:))]
7886        #[unsafe(method_family = none)]
7887        pub unsafe fn setMaximumValue(&self, maximum_value: c_float);
7888
7889        #[unsafe(method(isSecondarySourceFilter))]
7890        #[unsafe(method_family = none)]
7891        pub unsafe fn isSecondarySourceFilter(&self) -> bool;
7892    );
7893}
7894
7895/// Methods declared on superclass `MPSNNFilterNode`.
7896impl MPSNNArithmeticGradientNode {
7897    extern_methods!(
7898        #[unsafe(method(init))]
7899        #[unsafe(method_family = init)]
7900        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
7901    );
7902}
7903
7904/// Methods declared on superclass `NSObject`.
7905impl MPSNNArithmeticGradientNode {
7906    extern_methods!(
7907        #[unsafe(method(new))]
7908        #[unsafe(method_family = new)]
7909        pub unsafe fn new() -> Retained<Self>;
7910    );
7911}
7912
7913extern_class!(
7914    /// returns gradient for either primary or secondary source image from the inference pass.
7915    /// Use the isSecondarySourceFilter property to indicate whether this filter is computing the gradient
7916    /// for the primary or secondary source image from the inference pass.
7917    ///
7918    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnadditiongradientnode?language=objc)
7919    #[unsafe(super(
7920        MPSNNArithmeticGradientNode,
7921        MPSNNGradientFilterNode,
7922        MPSNNFilterNode,
7923        NSObject
7924    ))]
7925    #[derive(Debug, PartialEq, Eq, Hash)]
7926    pub struct MPSNNAdditionGradientNode;
7927);
7928
7929extern_conformance!(
7930    unsafe impl NSObjectProtocol for MPSNNAdditionGradientNode {}
7931);
7932
7933impl MPSNNAdditionGradientNode {
7934    extern_methods!();
7935}
7936
7937/// Methods declared on superclass `MPSNNArithmeticGradientNode`.
7938impl MPSNNAdditionGradientNode {
7939    extern_methods!(
7940        /// create a new arithmetic gradient node
7941        ///
7942        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7943        /// for an easier way to do this.
7944        ///
7945        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
7946        ///
7947        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
7948        ///
7949        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
7950        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
7951        #[unsafe(method_family = none)]
7952        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
7953            source_gradient: &MPSNNImageNode,
7954            source_image: &MPSNNImageNode,
7955            gradient_state: &MPSNNBinaryGradientStateNode,
7956            is_secondary_source_filter: bool,
7957        ) -> Retained<Self>;
7958
7959        /// create a new arithmetic gradient node
7960        ///
7961        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7962        /// for an easier way to do this.
7963        ///
7964        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
7965        ///
7966        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
7967        ///
7968        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
7969        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
7970        #[unsafe(method_family = init)]
7971        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
7972            this: Allocated<Self>,
7973            source_gradient: &MPSNNImageNode,
7974            source_image: &MPSNNImageNode,
7975            gradient_state: &MPSNNBinaryGradientStateNode,
7976            is_secondary_source_filter: bool,
7977        ) -> Retained<Self>;
7978
7979        /// create a new arithmetic gradient node
7980        ///
7981        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
7982        /// for an easier way to do this.
7983        ///
7984        /// Parameter `gradientImages`: The input gradient from the 'downstream' gradient filter and the source input image
7985        /// from the forward pass (primary or secondary).
7986        ///
7987        /// Parameter `filter`: The matching filter node from the forward pass.
7988        ///
7989        /// Parameter `isSecondarySourceFilter`: The isSecondarySourceFilter property is used to indicate whether the arithmetic
7990        /// gradient filter is operating on the primary or secondary source image from the
7991        /// forward pass.
7992        #[unsafe(method(initWithGradientImages:forwardFilter:isSecondarySourceFilter:))]
7993        #[unsafe(method_family = init)]
7994        pub unsafe fn initWithGradientImages_forwardFilter_isSecondarySourceFilter(
7995            this: Allocated<Self>,
7996            gradient_images: &NSArray<MPSNNImageNode>,
7997            filter: &MPSNNFilterNode,
7998            is_secondary_source_filter: bool,
7999        ) -> Retained<Self>;
8000    );
8001}
8002
8003/// Methods declared on superclass `MPSNNFilterNode`.
8004impl MPSNNAdditionGradientNode {
8005    extern_methods!(
8006        #[unsafe(method(init))]
8007        #[unsafe(method_family = init)]
8008        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8009    );
8010}
8011
8012/// Methods declared on superclass `NSObject`.
8013impl MPSNNAdditionGradientNode {
8014    extern_methods!(
8015        #[unsafe(method(new))]
8016        #[unsafe(method_family = new)]
8017        pub unsafe fn new() -> Retained<Self>;
8018    );
8019}
8020
8021extern_class!(
8022    /// returns gradient for either primary or secondary source image from the inference pass.
8023    /// Use the isSecondarySourceFilter property to indicate whether this filter is computing the gradient
8024    /// for the primary or secondary source image from the inference pass.
8025    ///
8026    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnsubtractiongradientnode?language=objc)
8027    #[unsafe(super(
8028        MPSNNArithmeticGradientNode,
8029        MPSNNGradientFilterNode,
8030        MPSNNFilterNode,
8031        NSObject
8032    ))]
8033    #[derive(Debug, PartialEq, Eq, Hash)]
8034    pub struct MPSNNSubtractionGradientNode;
8035);
8036
8037extern_conformance!(
8038    unsafe impl NSObjectProtocol for MPSNNSubtractionGradientNode {}
8039);
8040
8041impl MPSNNSubtractionGradientNode {
8042    extern_methods!();
8043}
8044
8045/// Methods declared on superclass `MPSNNArithmeticGradientNode`.
8046impl MPSNNSubtractionGradientNode {
8047    extern_methods!(
8048        /// create a new arithmetic gradient node
8049        ///
8050        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8051        /// for an easier way to do this.
8052        ///
8053        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8054        ///
8055        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
8056        ///
8057        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
8058        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
8059        #[unsafe(method_family = none)]
8060        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
8061            source_gradient: &MPSNNImageNode,
8062            source_image: &MPSNNImageNode,
8063            gradient_state: &MPSNNBinaryGradientStateNode,
8064            is_secondary_source_filter: bool,
8065        ) -> Retained<Self>;
8066
8067        /// create a new arithmetic gradient node
8068        ///
8069        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8070        /// for an easier way to do this.
8071        ///
8072        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8073        ///
8074        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
8075        ///
8076        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
8077        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
8078        #[unsafe(method_family = init)]
8079        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
8080            this: Allocated<Self>,
8081            source_gradient: &MPSNNImageNode,
8082            source_image: &MPSNNImageNode,
8083            gradient_state: &MPSNNBinaryGradientStateNode,
8084            is_secondary_source_filter: bool,
8085        ) -> Retained<Self>;
8086
8087        /// create a new arithmetic gradient node
8088        ///
8089        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8090        /// for an easier way to do this.
8091        ///
8092        /// Parameter `gradientImages`: The input gradient from the 'downstream' gradient filter and the source input image
8093        /// from the forward pass (primary or secondary).
8094        ///
8095        /// Parameter `filter`: The matching filter node from the forward pass.
8096        ///
8097        /// Parameter `isSecondarySourceFilter`: The isSecondarySourceFilter property is used to indicate whether the arithmetic
8098        /// gradient filter is operating on the primary or secondary source image from the
8099        /// forward pass.
8100        #[unsafe(method(initWithGradientImages:forwardFilter:isSecondarySourceFilter:))]
8101        #[unsafe(method_family = init)]
8102        pub unsafe fn initWithGradientImages_forwardFilter_isSecondarySourceFilter(
8103            this: Allocated<Self>,
8104            gradient_images: &NSArray<MPSNNImageNode>,
8105            filter: &MPSNNFilterNode,
8106            is_secondary_source_filter: bool,
8107        ) -> Retained<Self>;
8108    );
8109}
8110
8111/// Methods declared on superclass `MPSNNFilterNode`.
8112impl MPSNNSubtractionGradientNode {
8113    extern_methods!(
8114        #[unsafe(method(init))]
8115        #[unsafe(method_family = init)]
8116        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8117    );
8118}
8119
8120/// Methods declared on superclass `NSObject`.
8121impl MPSNNSubtractionGradientNode {
8122    extern_methods!(
8123        #[unsafe(method(new))]
8124        #[unsafe(method_family = new)]
8125        pub unsafe fn new() -> Retained<Self>;
8126    );
8127}
8128
8129extern_class!(
8130    /// returns gradient for either primary or secondary source image from the inference pass.
8131    /// Use the isSecondarySourceFilter property to indicate whether this filter is computing the gradient
8132    /// for the primary or secondary source image from the inference pass.
8133    ///
8134    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnmultiplicationgradientnode?language=objc)
8135    #[unsafe(super(
8136        MPSNNArithmeticGradientNode,
8137        MPSNNGradientFilterNode,
8138        MPSNNFilterNode,
8139        NSObject
8140    ))]
8141    #[derive(Debug, PartialEq, Eq, Hash)]
8142    pub struct MPSNNMultiplicationGradientNode;
8143);
8144
8145extern_conformance!(
8146    unsafe impl NSObjectProtocol for MPSNNMultiplicationGradientNode {}
8147);
8148
8149impl MPSNNMultiplicationGradientNode {
8150    extern_methods!();
8151}
8152
8153/// Methods declared on superclass `MPSNNArithmeticGradientNode`.
8154impl MPSNNMultiplicationGradientNode {
8155    extern_methods!(
8156        /// create a new arithmetic gradient node
8157        ///
8158        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8159        /// for an easier way to do this.
8160        ///
8161        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8162        ///
8163        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
8164        ///
8165        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
8166        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
8167        #[unsafe(method_family = none)]
8168        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
8169            source_gradient: &MPSNNImageNode,
8170            source_image: &MPSNNImageNode,
8171            gradient_state: &MPSNNBinaryGradientStateNode,
8172            is_secondary_source_filter: bool,
8173        ) -> Retained<Self>;
8174
8175        /// create a new arithmetic gradient node
8176        ///
8177        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8178        /// for an easier way to do this.
8179        ///
8180        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8181        ///
8182        /// Parameter `sourceImage`: The source input image from the forward pass (primary or secondary).
8183        ///
8184        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter.
8185        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:isSecondarySourceFilter:))]
8186        #[unsafe(method_family = init)]
8187        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_isSecondarySourceFilter(
8188            this: Allocated<Self>,
8189            source_gradient: &MPSNNImageNode,
8190            source_image: &MPSNNImageNode,
8191            gradient_state: &MPSNNBinaryGradientStateNode,
8192            is_secondary_source_filter: bool,
8193        ) -> Retained<Self>;
8194
8195        /// create a new arithmetic gradient node
8196        ///
8197        /// See also -[MPSCNNNeuronNode gradientFilterNodesWithSources:]
8198        /// for an easier way to do this.
8199        ///
8200        /// Parameter `gradientImages`: The input gradient from the 'downstream' gradient filter and the source input image
8201        /// from the forward pass (primary or secondary).
8202        ///
8203        /// Parameter `filter`: The matching filter node from the forward pass.
8204        ///
8205        /// Parameter `isSecondarySourceFilter`: The isSecondarySourceFilter property is used to indicate whether the arithmetic
8206        /// gradient filter is operating on the primary or secondary source image from the
8207        /// forward pass.
8208        #[unsafe(method(initWithGradientImages:forwardFilter:isSecondarySourceFilter:))]
8209        #[unsafe(method_family = init)]
8210        pub unsafe fn initWithGradientImages_forwardFilter_isSecondarySourceFilter(
8211            this: Allocated<Self>,
8212            gradient_images: &NSArray<MPSNNImageNode>,
8213            filter: &MPSNNFilterNode,
8214            is_secondary_source_filter: bool,
8215        ) -> Retained<Self>;
8216    );
8217}
8218
8219/// Methods declared on superclass `MPSNNFilterNode`.
8220impl MPSNNMultiplicationGradientNode {
8221    extern_methods!(
8222        #[unsafe(method(init))]
8223        #[unsafe(method_family = init)]
8224        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8225    );
8226}
8227
8228/// Methods declared on superclass `NSObject`.
8229impl MPSNNMultiplicationGradientNode {
8230    extern_methods!(
8231        #[unsafe(method(new))]
8232        #[unsafe(method_family = new)]
8233        pub unsafe fn new() -> Retained<Self>;
8234    );
8235}
8236
8237extern_class!(
8238    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnndropoutnode?language=objc)
8239    #[unsafe(super(MPSNNFilterNode, NSObject))]
8240    #[derive(Debug, PartialEq, Eq, Hash)]
8241    pub struct MPSCNNDropoutNode;
8242);
8243
8244extern_conformance!(
8245    unsafe impl NSObjectProtocol for MPSCNNDropoutNode {}
8246);
8247
8248impl MPSCNNDropoutNode {
8249    extern_methods!(
8250        #[unsafe(method(nodeWithSource:))]
8251        #[unsafe(method_family = none)]
8252        pub unsafe fn nodeWithSource(source: &MPSNNImageNode) -> Retained<Self>;
8253
8254        #[unsafe(method(initWithSource:))]
8255        #[unsafe(method_family = init)]
8256        pub unsafe fn initWithSource(
8257            this: Allocated<Self>,
8258            source: &MPSNNImageNode,
8259        ) -> Retained<Self>;
8260
8261        #[unsafe(method(nodeWithSource:keepProbability:))]
8262        #[unsafe(method_family = none)]
8263        pub unsafe fn nodeWithSource_keepProbability(
8264            source: &MPSNNImageNode,
8265            keep_probability: c_float,
8266        ) -> Retained<Self>;
8267
8268        #[unsafe(method(initWithSource:keepProbability:))]
8269        #[unsafe(method_family = init)]
8270        pub unsafe fn initWithSource_keepProbability(
8271            this: Allocated<Self>,
8272            source: &MPSNNImageNode,
8273            keep_probability: c_float,
8274        ) -> Retained<Self>;
8275
8276        #[unsafe(method(nodeWithSource:keepProbability:seed:maskStrideInPixels:))]
8277        #[unsafe(method_family = none)]
8278        pub unsafe fn nodeWithSource_keepProbability_seed_maskStrideInPixels(
8279            source: &MPSNNImageNode,
8280            keep_probability: c_float,
8281            seed: NSUInteger,
8282            mask_stride_in_pixels: MTLSize,
8283        ) -> Retained<Self>;
8284
8285        #[unsafe(method(initWithSource:keepProbability:seed:maskStrideInPixels:))]
8286        #[unsafe(method_family = init)]
8287        pub unsafe fn initWithSource_keepProbability_seed_maskStrideInPixels(
8288            this: Allocated<Self>,
8289            source: &MPSNNImageNode,
8290            keep_probability: c_float,
8291            seed: NSUInteger,
8292            mask_stride_in_pixels: MTLSize,
8293        ) -> Retained<Self>;
8294
8295        #[unsafe(method(keepProbability))]
8296        #[unsafe(method_family = none)]
8297        pub unsafe fn keepProbability(&self) -> c_float;
8298
8299        #[unsafe(method(seed))]
8300        #[unsafe(method_family = none)]
8301        pub unsafe fn seed(&self) -> NSUInteger;
8302
8303        #[unsafe(method(maskStrideInPixels))]
8304        #[unsafe(method_family = none)]
8305        pub unsafe fn maskStrideInPixels(&self) -> MTLSize;
8306    );
8307}
8308
8309/// Methods declared on superclass `MPSNNFilterNode`.
8310impl MPSCNNDropoutNode {
8311    extern_methods!(
8312        #[unsafe(method(init))]
8313        #[unsafe(method_family = init)]
8314        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8315    );
8316}
8317
8318/// Methods declared on superclass `NSObject`.
8319impl MPSCNNDropoutNode {
8320    extern_methods!(
8321        #[unsafe(method(new))]
8322        #[unsafe(method_family = new)]
8323        pub unsafe fn new() -> Retained<Self>;
8324    );
8325}
8326
8327extern_class!(
8328    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnndropoutgradientnode?language=objc)
8329    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
8330    #[derive(Debug, PartialEq, Eq, Hash)]
8331    pub struct MPSCNNDropoutGradientNode;
8332);
8333
8334extern_conformance!(
8335    unsafe impl NSObjectProtocol for MPSCNNDropoutGradientNode {}
8336);
8337
8338impl MPSCNNDropoutGradientNode {
8339    extern_methods!(
8340        /// create a new dropout gradient node
8341        ///
8342        /// See also -[MPSCNNNeuronNode gradientFilterNodeWithSources:]
8343        /// for an easier way to do this
8344        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:keepProbability:seed:maskStrideInPixels:))]
8345        #[unsafe(method_family = none)]
8346        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_keepProbability_seed_maskStrideInPixels(
8347            source_gradient: &MPSNNImageNode,
8348            source_image: &MPSNNImageNode,
8349            gradient_state: &MPSNNGradientStateNode,
8350            keep_probability: c_float,
8351            seed: NSUInteger,
8352            mask_stride_in_pixels: MTLSize,
8353        ) -> Retained<Self>;
8354
8355        /// create a new dropout gradient node
8356        ///
8357        /// See also -[MPSCNNNeuronNode gradientFilterNodeWithSources:]
8358        /// for an easier way to do this
8359        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:keepProbability:seed:maskStrideInPixels:))]
8360        #[unsafe(method_family = init)]
8361        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_keepProbability_seed_maskStrideInPixels(
8362            this: Allocated<Self>,
8363            source_gradient: &MPSNNImageNode,
8364            source_image: &MPSNNImageNode,
8365            gradient_state: &MPSNNGradientStateNode,
8366            keep_probability: c_float,
8367            seed: NSUInteger,
8368            mask_stride_in_pixels: MTLSize,
8369        ) -> Retained<Self>;
8370
8371        #[unsafe(method(keepProbability))]
8372        #[unsafe(method_family = none)]
8373        pub unsafe fn keepProbability(&self) -> c_float;
8374
8375        #[unsafe(method(seed))]
8376        #[unsafe(method_family = none)]
8377        pub unsafe fn seed(&self) -> NSUInteger;
8378
8379        #[unsafe(method(maskStrideInPixels))]
8380        #[unsafe(method_family = none)]
8381        pub unsafe fn maskStrideInPixels(&self) -> MTLSize;
8382    );
8383}
8384
8385/// Methods declared on superclass `MPSNNFilterNode`.
8386impl MPSCNNDropoutGradientNode {
8387    extern_methods!(
8388        #[unsafe(method(init))]
8389        #[unsafe(method_family = init)]
8390        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8391    );
8392}
8393
8394/// Methods declared on superclass `NSObject`.
8395impl MPSCNNDropoutGradientNode {
8396    extern_methods!(
8397        #[unsafe(method(new))]
8398        #[unsafe(method_family = new)]
8399        pub unsafe fn new() -> Retained<Self>;
8400    );
8401}
8402
8403extern_class!(
8404    /// The labels and weights for each MPSImage are passed in
8405    /// separately to the graph in a MPSNNLabels object. If
8406    /// the batch interface is used then there will be a
8407    /// MPSStateBatch of these of the same size as the MPSImageBatch
8408    /// that holds the images.  The MPSNNLabelsNode is a place
8409    /// holder in the graph for these nodes. The MPSNNLabels node
8410    /// is taken as an input to the Loss node
8411    ///
8412    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnlabelsnode?language=objc)
8413    #[unsafe(super(MPSNNStateNode, NSObject))]
8414    #[derive(Debug, PartialEq, Eq, Hash)]
8415    pub struct MPSNNLabelsNode;
8416);
8417
8418extern_conformance!(
8419    unsafe impl NSObjectProtocol for MPSNNLabelsNode {}
8420);
8421
8422impl MPSNNLabelsNode {
8423    extern_methods!();
8424}
8425
8426/// Methods declared on superclass `MPSNNStateNode`.
8427impl MPSNNLabelsNode {
8428    extern_methods!(
8429        #[unsafe(method(init))]
8430        #[unsafe(method_family = init)]
8431        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8432    );
8433}
8434
8435/// Methods declared on superclass `NSObject`.
8436impl MPSNNLabelsNode {
8437    extern_methods!(
8438        #[unsafe(method(new))]
8439        #[unsafe(method_family = new)]
8440        pub unsafe fn new() -> Retained<Self>;
8441    );
8442}
8443
8444extern_class!(
8445    /// This node calculates loss information during training
8446    /// typically immediately after the inference portion
8447    /// of network evaluation is performed. The result image
8448    /// of the loss operations is typically the first gradient
8449    /// image to be comsumed by the gradient passes that work
8450    /// their way back up the graph. In addition, the node will
8451    /// update the loss image in the MPSNNLabels with the
8452    /// desired estimate of correctness.
8453    ///
8454    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnlossnode?language=objc)
8455    #[unsafe(super(MPSNNFilterNode, NSObject))]
8456    #[derive(Debug, PartialEq, Eq, Hash)]
8457    pub struct MPSCNNLossNode;
8458);
8459
8460extern_conformance!(
8461    unsafe impl NSObjectProtocol for MPSCNNLossNode {}
8462);
8463
8464impl MPSCNNLossNode {
8465    extern_methods!(
8466        #[cfg(feature = "MPSCNNLoss")]
8467        #[unsafe(method(nodeWithSource:lossDescriptor:))]
8468        #[unsafe(method_family = none)]
8469        pub unsafe fn nodeWithSource_lossDescriptor(
8470            source: &MPSNNImageNode,
8471            descriptor: &MPSCNNLossDescriptor,
8472        ) -> Retained<Self>;
8473
8474        #[cfg(feature = "MPSCNNLoss")]
8475        #[unsafe(method(initWithSource:lossDescriptor:))]
8476        #[unsafe(method_family = init)]
8477        pub unsafe fn initWithSource_lossDescriptor(
8478            this: Allocated<Self>,
8479            source: &MPSNNImageNode,
8480            descriptor: &MPSCNNLossDescriptor,
8481        ) -> Retained<Self>;
8482
8483        /// Get the input node for labes and weights, for example to set the handle
8484        #[unsafe(method(inputLabels))]
8485        #[unsafe(method_family = none)]
8486        pub unsafe fn inputLabels(&self) -> Retained<MPSNNLabelsNode>;
8487
8488        /// The loss filter is its own gradient filter and doesn't provide a corresponding gradient node.
8489        ///
8490        /// The image returned by the loss filter is the gradient image to be consumed by
8491        /// the gradient filters corresponding to preceeding inference nodes.
8492        #[unsafe(method(gradientFilterWithSources:))]
8493        #[unsafe(method_family = none)]
8494        pub unsafe fn gradientFilterWithSources(
8495            &self,
8496            gradient_images: &NSArray<MPSNNImageNode>,
8497        ) -> Retained<MPSNNGradientFilterNode>;
8498    );
8499}
8500
8501/// Methods declared on superclass `MPSNNFilterNode`.
8502impl MPSCNNLossNode {
8503    extern_methods!(
8504        #[unsafe(method(init))]
8505        #[unsafe(method_family = init)]
8506        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8507    );
8508}
8509
8510/// Methods declared on superclass `NSObject`.
8511impl MPSCNNLossNode {
8512    extern_methods!(
8513        #[unsafe(method(new))]
8514        #[unsafe(method_family = new)]
8515        pub unsafe fn new() -> Retained<Self>;
8516    );
8517}
8518
8519extern_class!(
8520    /// This node calculates loss information during training
8521    /// typically immediately after the inference portion
8522    /// of network evaluation is performed. The result image
8523    /// of the loss operations is typically the first gradient
8524    /// image to be comsumed by the gradient passes that work
8525    /// their way back up the graph. In addition, the node will
8526    /// update the loss image in the MPSNNLabels with the
8527    /// desired estimate of correctness.
8528    ///
8529    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnyololossnode?language=objc)
8530    #[unsafe(super(MPSNNFilterNode, NSObject))]
8531    #[derive(Debug, PartialEq, Eq, Hash)]
8532    pub struct MPSCNNYOLOLossNode;
8533);
8534
8535extern_conformance!(
8536    unsafe impl NSObjectProtocol for MPSCNNYOLOLossNode {}
8537);
8538
8539impl MPSCNNYOLOLossNode {
8540    extern_methods!(
8541        #[cfg(feature = "MPSCNNLoss")]
8542        #[unsafe(method(nodeWithSource:lossDescriptor:))]
8543        #[unsafe(method_family = none)]
8544        pub unsafe fn nodeWithSource_lossDescriptor(
8545            source: &MPSNNImageNode,
8546            descriptor: &MPSCNNYOLOLossDescriptor,
8547        ) -> Retained<Self>;
8548
8549        #[cfg(feature = "MPSCNNLoss")]
8550        #[unsafe(method(initWithSource:lossDescriptor:))]
8551        #[unsafe(method_family = init)]
8552        pub unsafe fn initWithSource_lossDescriptor(
8553            this: Allocated<Self>,
8554            source: &MPSNNImageNode,
8555            descriptor: &MPSCNNYOLOLossDescriptor,
8556        ) -> Retained<Self>;
8557
8558        /// Get the input node for labes and weights, for example to set the handle
8559        #[unsafe(method(inputLabels))]
8560        #[unsafe(method_family = none)]
8561        pub unsafe fn inputLabels(&self) -> Retained<MPSNNLabelsNode>;
8562
8563        /// The loss filter is its own gradient filter and doesn't provide a corresponding gradient node.
8564        ///
8565        /// The image returned by the loss filter is the gradient image to be consumed by
8566        /// the gradient filters corresponding to preceeding inference nodes.
8567        #[unsafe(method(gradientFilterWithSources:))]
8568        #[unsafe(method_family = none)]
8569        pub unsafe fn gradientFilterWithSources(
8570            &self,
8571            gradient_images: &NSArray<MPSNNImageNode>,
8572        ) -> Retained<MPSNNGradientFilterNode>;
8573    );
8574}
8575
8576/// Methods declared on superclass `MPSNNFilterNode`.
8577impl MPSCNNYOLOLossNode {
8578    extern_methods!(
8579        #[unsafe(method(init))]
8580        #[unsafe(method_family = init)]
8581        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8582    );
8583}
8584
8585/// Methods declared on superclass `NSObject`.
8586impl MPSCNNYOLOLossNode {
8587    extern_methods!(
8588        #[unsafe(method(new))]
8589        #[unsafe(method_family = new)]
8590        pub unsafe fn new() -> Retained<Self>;
8591    );
8592}
8593
8594extern_class!(
8595    /// Node representing a the concatenation (in the feature channel dimension) of the results from one or more kernels
8596    ///
8597    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnconcatenationnode?language=objc)
8598    #[unsafe(super(MPSNNFilterNode, NSObject))]
8599    #[derive(Debug, PartialEq, Eq, Hash)]
8600    pub struct MPSNNConcatenationNode;
8601);
8602
8603extern_conformance!(
8604    unsafe impl NSObjectProtocol for MPSNNConcatenationNode {}
8605);
8606
8607impl MPSNNConcatenationNode {
8608    extern_methods!(
8609        /// Init a autoreleased node that concatenates feature channels from multiple images
8610        ///
8611        /// In some neural network designs, it is necessary to append feature channels
8612        /// from one neural network filter to the results of another. If we have three
8613        /// image nodes with M, N and O feature channels in them, passed to -initWithSources:
8614        /// as
8615        /// @
8616        /// [imageM, imageN, imageO], then feature channels [0,M-1] will be drawn from
8617        /// image M,  feature channels [M, M+N-1] will be drawn from image N and feature channels
8618        /// [M+N, M+N+O-1] will be drawn from image O.
8619        ///
8620        /// As all images are padded out to a multiple of four feature channels,
8621        /// M, N and O here are also multiples of four, even when the MPSImages
8622        /// are not. That is, if the image is 23 feature channels and one channel
8623        /// of padding, it takes up 24 feature channels worth of space in the
8624        /// concatenated result.
8625        ///
8626        /// Performance Note:  Generally, concatenation is free as long as all
8627        /// of the sourceNodes are produced by filters in the same MPSNNGraph.
8628        /// Most MPSCNNKernels have the ability to write their results  at a
8629        /// feature channel offset within a target MPSImage. However, if the
8630        /// MPSNNImageNode source nodes come from images external to the MPSNNGraph,
8631        /// then we have to do a copy operation to assemble the concatenated node.
8632        /// As a result, when deciding where to break a large logical graph into
8633        /// multiple smaller MPSNNGraphs, it is better for concatenations to
8634        /// appear at the ends of subgraphs when possible rather than at the start,
8635        /// to the extent that all the images used in the concatenation are
8636        /// produced by that subgraph.
8637        ///
8638        ///
8639        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
8640        ///
8641        /// Returns: A new MPSNNFilter node that concatenates its inputs.
8642        #[unsafe(method(nodeWithSources:))]
8643        #[unsafe(method_family = none)]
8644        pub unsafe fn nodeWithSources(source_nodes: &NSArray<MPSNNImageNode>) -> Retained<Self>;
8645
8646        /// Init a node that concatenates feature channels from multiple images
8647        ///
8648        /// In some neural network designs, it is necessary to append feature channels
8649        /// from one neural network filter to the results of another. If we have three
8650        /// image nodes with M, N and O feature channels in them, passed to -initWithSources:
8651        /// as
8652        /// @
8653        /// [imageM, imageN, imageO], then feature channels [0,M-1] will be drawn from
8654        /// image M,  feature channels [M, M+N-1] will be drawn from image N and feature channels
8655        /// [M+N, M+N+O-1] will be drawn from image O.
8656        ///
8657        /// As all images are padded out to a multiple of four feature channels,
8658        /// M, N and O here are also multiples of four, even when the MPSImages
8659        /// are not. That is, if the image is 23 feature channels and one channel
8660        /// of padding, it takes up 24 feature channels worth of space in the
8661        /// concatenated result.
8662        ///
8663        /// Performance Note:  Generally, concatenation is free as long as all
8664        /// of the sourceNodes are produced by filters in the same MPSNNGraph.
8665        /// Most MPSCNNKernels have the ability to write their results  at a
8666        /// feature channel offset within a target MPSImage. However, if the
8667        /// MPSNNImageNode source nodes come from images external to the MPSNNGraph,
8668        /// then we have to do a copy operation to assemble the concatenated node.
8669        /// As a result, when deciding where to break a large logical graph into
8670        /// multiple smaller MPSNNGraphs, it is better for concatenations to
8671        /// appear at the ends of subgraphs when possible rather than at the start,
8672        /// to the extent that all the images used in the concatenation are
8673        /// produced by that subgraph.
8674        ///
8675        ///
8676        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
8677        ///
8678        /// Returns: A new MPSNNFilter node that concatenates its inputs.
8679        #[unsafe(method(initWithSources:))]
8680        #[unsafe(method_family = init)]
8681        pub unsafe fn initWithSources(
8682            this: Allocated<Self>,
8683            source_nodes: &NSArray<MPSNNImageNode>,
8684        ) -> Retained<Self>;
8685
8686        /// Concatenation returns multiple gradient filters. Use -gradientFiltersWithSources: instead.
8687        #[unsafe(method(gradientFilterWithSources:))]
8688        #[unsafe(method_family = none)]
8689        pub unsafe fn gradientFilterWithSources(
8690            &self,
8691            gradient_images: &NSArray<MPSNNImageNode>,
8692        ) -> Retained<MPSNNGradientFilterNode>;
8693    );
8694}
8695
8696/// Methods declared on superclass `MPSNNFilterNode`.
8697impl MPSNNConcatenationNode {
8698    extern_methods!(
8699        #[unsafe(method(init))]
8700        #[unsafe(method_family = init)]
8701        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8702    );
8703}
8704
8705/// Methods declared on superclass `NSObject`.
8706impl MPSNNConcatenationNode {
8707    extern_methods!(
8708        #[unsafe(method(new))]
8709        #[unsafe(method_family = new)]
8710        pub unsafe fn new() -> Retained<Self>;
8711    );
8712}
8713
8714extern_class!(
8715    /// A MPSNNSlice filter that operates as the conjugate computation for concatentation operators during training
8716    ///
8717    /// As concatenation is formally just a copy and not a computation, there isn't a lot of arithmetic for
8718    /// the slice operator to do, but we still need to extract out the relevant portion
8719    /// of the gradient of the input signal that went into the corresponding concatenation
8720    /// destination image.
8721    ///
8722    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnconcatenationgradientnode?language=objc)
8723    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
8724    #[derive(Debug, PartialEq, Eq, Hash)]
8725    pub struct MPSNNConcatenationGradientNode;
8726);
8727
8728extern_conformance!(
8729    unsafe impl NSObjectProtocol for MPSNNConcatenationGradientNode {}
8730);
8731
8732impl MPSNNConcatenationGradientNode {
8733    extern_methods!(
8734        /// create a MPSNNConcatenationGradientNode
8735        ///
8736        /// Generally you should use [MPSNNConcatenationNode gradientFiltersWithSources:] instead.
8737        ///
8738        /// Parameter `gradientSourceNode`: The gradient image functioning as input for the operator
8739        ///
8740        /// Parameter `sourceImage`: The particular input image to the concatentation, if any, that the slice corresponds with
8741        ///
8742        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter
8743        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
8744        #[unsafe(method_family = none)]
8745        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
8746            gradient_source_node: &MPSNNImageNode,
8747            source_image: &MPSNNImageNode,
8748            gradient_state: &MPSNNGradientStateNode,
8749        ) -> Retained<Self>;
8750
8751        /// Init a MPSNNConcatenationGradientNode
8752        ///
8753        /// Generally you should use [MPSNNConcatenationNode gradientFiltersWithSources:] instead.
8754        ///
8755        /// Parameter `gradientSourceNode`: The gradient image functioning as input for the operator
8756        ///
8757        /// Parameter `sourceImage`: The particular input image to the concatentation, if any, that the slice corresponds with
8758        ///
8759        /// Parameter `gradientState`: The gradient state produced by the concatenation filter, consumed by this filter
8760        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
8761        #[unsafe(method_family = init)]
8762        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
8763            this: Allocated<Self>,
8764            gradient_source_node: &MPSNNImageNode,
8765            source_image: &MPSNNImageNode,
8766            gradient_state: &MPSNNGradientStateNode,
8767        ) -> Retained<Self>;
8768    );
8769}
8770
8771/// Methods declared on superclass `MPSNNFilterNode`.
8772impl MPSNNConcatenationGradientNode {
8773    extern_methods!(
8774        #[unsafe(method(init))]
8775        #[unsafe(method_family = init)]
8776        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8777    );
8778}
8779
8780/// Methods declared on superclass `NSObject`.
8781impl MPSNNConcatenationGradientNode {
8782    extern_methods!(
8783        #[unsafe(method(new))]
8784        #[unsafe(method_family = new)]
8785        pub unsafe fn new() -> Retained<Self>;
8786    );
8787}
8788
8789extern_class!(
8790    /// A node for a MPSNNReshape kernel
8791    ///
8792    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreshapenode?language=objc)
8793    #[unsafe(super(MPSNNFilterNode, NSObject))]
8794    #[derive(Debug, PartialEq, Eq, Hash)]
8795    pub struct MPSNNReshapeNode;
8796);
8797
8798extern_conformance!(
8799    unsafe impl NSObjectProtocol for MPSNNReshapeNode {}
8800);
8801
8802impl MPSNNReshapeNode {
8803    extern_methods!(
8804        /// Init a node representing a autoreleased MPSNNReshape kernel
8805        ///
8806        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
8807        ///
8808        /// Parameter `resultWidth`: The width of the reshaped image.
8809        ///
8810        /// Parameter `resultHeight`: The height of the reshaped image.
8811        ///
8812        /// Parameter `resultFeatureChannels`: The number of feature channels in the reshaped image.
8813        ///
8814        /// Returns: A new MPSNNFilter node for a MPSNNReshape kernel.
8815        #[unsafe(method(nodeWithSource:resultWidth:resultHeight:resultFeatureChannels:))]
8816        #[unsafe(method_family = none)]
8817        pub unsafe fn nodeWithSource_resultWidth_resultHeight_resultFeatureChannels(
8818            source: &MPSNNImageNode,
8819            result_width: NSUInteger,
8820            result_height: NSUInteger,
8821            result_feature_channels: NSUInteger,
8822        ) -> Retained<Self>;
8823
8824        /// Init a node representing a MPSNNReshape kernel
8825        ///
8826        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
8827        ///
8828        /// Parameter `resultWidth`: The width of the reshaped image.
8829        ///
8830        /// Parameter `resultHeight`: The height of the reshaped image.
8831        ///
8832        /// Parameter `resultFeatureChannels`: The number of feature channels in the reshaped image.
8833        ///
8834        /// Returns: A new MPSNNFilter node for a MPSNNReshape kernel.
8835        #[unsafe(method(initWithSource:resultWidth:resultHeight:resultFeatureChannels:))]
8836        #[unsafe(method_family = init)]
8837        pub unsafe fn initWithSource_resultWidth_resultHeight_resultFeatureChannels(
8838            this: Allocated<Self>,
8839            source: &MPSNNImageNode,
8840            result_width: NSUInteger,
8841            result_height: NSUInteger,
8842            result_feature_channels: NSUInteger,
8843        ) -> Retained<Self>;
8844    );
8845}
8846
8847/// Methods declared on superclass `MPSNNFilterNode`.
8848impl MPSNNReshapeNode {
8849    extern_methods!(
8850        #[unsafe(method(init))]
8851        #[unsafe(method_family = init)]
8852        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8853    );
8854}
8855
8856/// Methods declared on superclass `NSObject`.
8857impl MPSNNReshapeNode {
8858    extern_methods!(
8859        #[unsafe(method(new))]
8860        #[unsafe(method_family = new)]
8861        pub unsafe fn new() -> Retained<Self>;
8862    );
8863}
8864
8865extern_class!(
8866    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreshapegradientnode?language=objc)
8867    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
8868    #[derive(Debug, PartialEq, Eq, Hash)]
8869    pub struct MPSNNReshapeGradientNode;
8870);
8871
8872extern_conformance!(
8873    unsafe impl NSObjectProtocol for MPSNNReshapeGradientNode {}
8874);
8875
8876impl MPSNNReshapeGradientNode {
8877    extern_methods!(
8878        /// A node to represent the gradient of a reshape node.
8879        ///
8880        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8881        ///
8882        /// Parameter `sourceImage`: The input image from the forward reshape node.
8883        ///
8884        /// Returns: A MPSNNReshapeGradientNode
8885        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
8886        #[unsafe(method_family = none)]
8887        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
8888            source_gradient: &MPSNNImageNode,
8889            source_image: &MPSNNImageNode,
8890            gradient_state: &MPSNNGradientStateNode,
8891        ) -> Retained<Self>;
8892
8893        /// A node to represent the gradient of a reshape node.
8894        ///
8895        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8896        ///
8897        /// Parameter `sourceImage`: The input image from the forward reshape node.
8898        ///
8899        /// Returns: A MPSCNNConvolutionGradientNode
8900        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
8901        #[unsafe(method_family = init)]
8902        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
8903            this: Allocated<Self>,
8904            source_gradient: &MPSNNImageNode,
8905            source_image: &MPSNNImageNode,
8906            gradient_state: &MPSNNGradientStateNode,
8907        ) -> Retained<Self>;
8908    );
8909}
8910
8911/// Methods declared on superclass `MPSNNFilterNode`.
8912impl MPSNNReshapeGradientNode {
8913    extern_methods!(
8914        #[unsafe(method(init))]
8915        #[unsafe(method_family = init)]
8916        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8917    );
8918}
8919
8920/// Methods declared on superclass `NSObject`.
8921impl MPSNNReshapeGradientNode {
8922    extern_methods!(
8923        #[unsafe(method(new))]
8924        #[unsafe(method_family = new)]
8925        pub unsafe fn new() -> Retained<Self>;
8926    );
8927}
8928
8929extern_class!(
8930    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnreductionspatialmeangradientnode?language=objc)
8931    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
8932    #[derive(Debug, PartialEq, Eq, Hash)]
8933    pub struct MPSNNReductionSpatialMeanGradientNode;
8934);
8935
8936extern_conformance!(
8937    unsafe impl NSObjectProtocol for MPSNNReductionSpatialMeanGradientNode {}
8938);
8939
8940impl MPSNNReductionSpatialMeanGradientNode {
8941    extern_methods!(
8942        /// A node to represent the gradient of a spatial mean reduction node.
8943        ///
8944        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8945        ///
8946        /// Parameter `sourceImage`: The input image from the forward spatial mean reduction node.
8947        ///
8948        /// Returns: A MPSNNReductionSpatialMeanGradientNode
8949        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
8950        #[unsafe(method_family = none)]
8951        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
8952            source_gradient: &MPSNNImageNode,
8953            source_image: &MPSNNImageNode,
8954            gradient_state: &MPSNNGradientStateNode,
8955        ) -> Retained<Self>;
8956
8957        /// A node to represent the gradient of a spatial mean reduction node.
8958        ///
8959        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
8960        ///
8961        /// Parameter `sourceImage`: The input image from the forward spatial mean reduction node.
8962        ///
8963        /// Returns: A MPSNNReductionSpatialMeanGradientNode
8964        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
8965        #[unsafe(method_family = init)]
8966        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
8967            this: Allocated<Self>,
8968            source_gradient: &MPSNNImageNode,
8969            source_image: &MPSNNImageNode,
8970            gradient_state: &MPSNNGradientStateNode,
8971        ) -> Retained<Self>;
8972    );
8973}
8974
8975/// Methods declared on superclass `MPSNNFilterNode`.
8976impl MPSNNReductionSpatialMeanGradientNode {
8977    extern_methods!(
8978        #[unsafe(method(init))]
8979        #[unsafe(method_family = init)]
8980        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
8981    );
8982}
8983
8984/// Methods declared on superclass `NSObject`.
8985impl MPSNNReductionSpatialMeanGradientNode {
8986    extern_methods!(
8987        #[unsafe(method(new))]
8988        #[unsafe(method_family = new)]
8989        pub unsafe fn new() -> Retained<Self>;
8990    );
8991}
8992
8993extern_class!(
8994    /// A node for a MPSNNPad kernel
8995    ///
8996    /// You should not use this node to zero pad your data in the XY-plane.
8997    /// This node copies the input image and therefore should only be used in
8998    /// special circumstances where the normal padding operation, defined for most
8999    /// filters and nodes through
9000    /// MPSNNPadding,cannot achieve the necessary padding.
9001    /// Therefore use this node only when you need one of the special edge modes:
9002    /// MPSImageEdgeModeConstant,MPSImageEdgeModeMirror,MPSImageEdgeModeMirrorWithEdgeor, if you need padding in the
9003    /// feature-channel dimesion.
9004    /// In other cases use to
9005    /// MPSNNPaddingto get best performance.
9006    ///
9007    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnpadnode?language=objc)
9008    #[unsafe(super(MPSNNFilterNode, NSObject))]
9009    #[derive(Debug, PartialEq, Eq, Hash)]
9010    pub struct MPSNNPadNode;
9011);
9012
9013extern_conformance!(
9014    unsafe impl NSObjectProtocol for MPSNNPadNode {}
9015);
9016
9017impl MPSNNPadNode {
9018    extern_methods!(
9019        /// Determines the constant value to apply when using
9020        /// MPSImageEdgeModeConstant.Default: 0.0f.
9021        #[unsafe(method(fillValue))]
9022        #[unsafe(method_family = none)]
9023        pub unsafe fn fillValue(&self) -> c_float;
9024
9025        /// Setter for [`fillValue`][Self::fillValue].
9026        #[unsafe(method(setFillValue:))]
9027        #[unsafe(method_family = none)]
9028        pub unsafe fn setFillValue(&self, fill_value: c_float);
9029
9030        #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
9031        /// Init a node representing a autoreleased MPSNNPad kernel
9032        ///
9033        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
9034        ///
9035        /// Parameter `paddingSizeBefore`: The amount of padding to apply before the image in each dimension.
9036        ///
9037        /// Parameter `paddingSizeAfter`: The amount of padding to apply after the image in each dimension.
9038        ///
9039        /// Parameter `edgeMode`: The
9040        /// MPSImageEdgeModefor the padding node - Note that for now
9041        /// the pad-node and its gradient are the only nodes that support
9042        /// the extended edge-modes, ie. the ones beyond MPSImageEdgeModeClamp.
9043        ///
9044        /// Returns: A new MPSNNFilter node for a MPSNNPad kernel.
9045        #[unsafe(method(nodeWithSource:paddingSizeBefore:paddingSizeAfter:edgeMode:))]
9046        #[unsafe(method_family = none)]
9047        pub unsafe fn nodeWithSource_paddingSizeBefore_paddingSizeAfter_edgeMode(
9048            source: &MPSNNImageNode,
9049            padding_size_before: MPSImageCoordinate,
9050            padding_size_after: MPSImageCoordinate,
9051            edge_mode: MPSImageEdgeMode,
9052        ) -> Retained<Self>;
9053
9054        #[cfg(all(feature = "MPSCore", feature = "MPSCoreTypes"))]
9055        /// Init a node representing a MPSNNPad kernel
9056        ///
9057        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
9058        ///
9059        /// Parameter `paddingSizeBefore`: The amount of padding to apply before the image in each dimension.
9060        ///
9061        /// Parameter `paddingSizeAfter`: The amount of padding to apply after the image in each dimension.
9062        ///
9063        /// Parameter `edgeMode`: The
9064        /// MPSImageEdgeModefor the padding node - Note that for now
9065        /// the pad-node and its gradient are the only nodes that support
9066        /// the extended edge-modes, ie. the ones beyond MPSImageEdgeModeClamp.
9067        ///
9068        /// Returns: A new MPSNNFilter node for a MPSNNPad kernel.
9069        #[unsafe(method(initWithSource:paddingSizeBefore:paddingSizeAfter:edgeMode:))]
9070        #[unsafe(method_family = init)]
9071        pub unsafe fn initWithSource_paddingSizeBefore_paddingSizeAfter_edgeMode(
9072            this: Allocated<Self>,
9073            source: &MPSNNImageNode,
9074            padding_size_before: MPSImageCoordinate,
9075            padding_size_after: MPSImageCoordinate,
9076            edge_mode: MPSImageEdgeMode,
9077        ) -> Retained<Self>;
9078    );
9079}
9080
9081/// Methods declared on superclass `MPSNNFilterNode`.
9082impl MPSNNPadNode {
9083    extern_methods!(
9084        #[unsafe(method(init))]
9085        #[unsafe(method_family = init)]
9086        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9087    );
9088}
9089
9090/// Methods declared on superclass `NSObject`.
9091impl MPSNNPadNode {
9092    extern_methods!(
9093        #[unsafe(method(new))]
9094        #[unsafe(method_family = new)]
9095        pub unsafe fn new() -> Retained<Self>;
9096    );
9097}
9098
9099extern_class!(
9100    /// [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnpadgradientnode?language=objc)
9101    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9102    #[derive(Debug, PartialEq, Eq, Hash)]
9103    pub struct MPSNNPadGradientNode;
9104);
9105
9106extern_conformance!(
9107    unsafe impl NSObjectProtocol for MPSNNPadGradientNode {}
9108);
9109
9110impl MPSNNPadGradientNode {
9111    extern_methods!(
9112        /// A node to represent the gradient of a padding node.
9113        ///
9114        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9115        ///
9116        /// Parameter `sourceImage`: The input image from the forward padding node.
9117        ///
9118        /// Returns: A MPSNNPadGradientNode
9119        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
9120        #[unsafe(method_family = none)]
9121        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
9122            source_gradient: &MPSNNImageNode,
9123            source_image: &MPSNNImageNode,
9124            gradient_state: &MPSNNGradientStateNode,
9125        ) -> Retained<Self>;
9126
9127        /// A node to represent the gradient of a padding node.
9128        ///
9129        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9130        ///
9131        /// Parameter `sourceImage`: The input image from the forward reshape node.
9132        ///
9133        /// Returns: A MPSNNPadGradientNode
9134        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
9135        #[unsafe(method_family = init)]
9136        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
9137            this: Allocated<Self>,
9138            source_gradient: &MPSNNImageNode,
9139            source_image: &MPSNNImageNode,
9140            gradient_state: &MPSNNGradientStateNode,
9141        ) -> Retained<Self>;
9142    );
9143}
9144
9145/// Methods declared on superclass `MPSNNFilterNode`.
9146impl MPSNNPadGradientNode {
9147    extern_methods!(
9148        #[unsafe(method(init))]
9149        #[unsafe(method_family = init)]
9150        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9151    );
9152}
9153
9154/// Methods declared on superclass `NSObject`.
9155impl MPSNNPadGradientNode {
9156    extern_methods!(
9157        #[unsafe(method(new))]
9158        #[unsafe(method_family = new)]
9159        pub unsafe fn new() -> Retained<Self>;
9160    );
9161}
9162
9163extern_class!(
9164    /// Node representing a MPSCNNSoftMax kernel
9165    ///
9166    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnsoftmaxnode?language=objc)
9167    #[unsafe(super(MPSNNFilterNode, NSObject))]
9168    #[derive(Debug, PartialEq, Eq, Hash)]
9169    pub struct MPSCNNSoftMaxNode;
9170);
9171
9172extern_conformance!(
9173    unsafe impl NSObjectProtocol for MPSCNNSoftMaxNode {}
9174);
9175
9176impl MPSCNNSoftMaxNode {
9177    extern_methods!(
9178        /// Init a node representing a autoreleased MPSCNNSoftMax kernel
9179        ///
9180        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9181        ///
9182        /// Returns: A new MPSNNFilter node for a MPSCNNSoftMax kernel.
9183        #[unsafe(method(nodeWithSource:))]
9184        #[unsafe(method_family = none)]
9185        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
9186
9187        /// Init a node representing a MPSCNNSoftMax kernel
9188        ///
9189        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9190        ///
9191        /// Returns: A new MPSNNFilter node for a MPSCNNSoftMax kernel.
9192        #[unsafe(method(initWithSource:))]
9193        #[unsafe(method_family = init)]
9194        pub unsafe fn initWithSource(
9195            this: Allocated<Self>,
9196            source_node: &MPSNNImageNode,
9197        ) -> Retained<Self>;
9198    );
9199}
9200
9201/// Methods declared on superclass `MPSNNFilterNode`.
9202impl MPSCNNSoftMaxNode {
9203    extern_methods!(
9204        #[unsafe(method(init))]
9205        #[unsafe(method_family = init)]
9206        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9207    );
9208}
9209
9210/// Methods declared on superclass `NSObject`.
9211impl MPSCNNSoftMaxNode {
9212    extern_methods!(
9213        #[unsafe(method(new))]
9214        #[unsafe(method_family = new)]
9215        pub unsafe fn new() -> Retained<Self>;
9216    );
9217}
9218
9219extern_class!(
9220    /// Node representing a MPSCNNSoftMaxGradient kernel
9221    ///
9222    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnsoftmaxgradientnode?language=objc)
9223    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9224    #[derive(Debug, PartialEq, Eq, Hash)]
9225    pub struct MPSCNNSoftMaxGradientNode;
9226);
9227
9228extern_conformance!(
9229    unsafe impl NSObjectProtocol for MPSCNNSoftMaxGradientNode {}
9230);
9231
9232impl MPSCNNSoftMaxGradientNode {
9233    extern_methods!(
9234        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
9235        #[unsafe(method_family = none)]
9236        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
9237            source_gradient: &MPSNNImageNode,
9238            source_image: &MPSNNImageNode,
9239            gradient_state: &MPSNNGradientStateNode,
9240        ) -> Retained<Self>;
9241
9242        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
9243        #[unsafe(method_family = init)]
9244        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
9245            this: Allocated<Self>,
9246            source_gradient: &MPSNNImageNode,
9247            source_image: &MPSNNImageNode,
9248            gradient_state: &MPSNNGradientStateNode,
9249        ) -> Retained<Self>;
9250    );
9251}
9252
9253/// Methods declared on superclass `MPSNNFilterNode`.
9254impl MPSCNNSoftMaxGradientNode {
9255    extern_methods!(
9256        #[unsafe(method(init))]
9257        #[unsafe(method_family = init)]
9258        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9259    );
9260}
9261
9262/// Methods declared on superclass `NSObject`.
9263impl MPSCNNSoftMaxGradientNode {
9264    extern_methods!(
9265        #[unsafe(method(new))]
9266        #[unsafe(method_family = new)]
9267        pub unsafe fn new() -> Retained<Self>;
9268    );
9269}
9270
9271extern_class!(
9272    /// Node representing a MPSCNNLogSoftMax kernel
9273    ///
9274    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnlogsoftmaxnode?language=objc)
9275    #[unsafe(super(MPSNNFilterNode, NSObject))]
9276    #[derive(Debug, PartialEq, Eq, Hash)]
9277    pub struct MPSCNNLogSoftMaxNode;
9278);
9279
9280extern_conformance!(
9281    unsafe impl NSObjectProtocol for MPSCNNLogSoftMaxNode {}
9282);
9283
9284impl MPSCNNLogSoftMaxNode {
9285    extern_methods!(
9286        /// Init a node representing a autoreleased MPSCNNLogSoftMax kernel
9287        ///
9288        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9289        ///
9290        /// Returns: A new MPSNNFilter node for a MPSCNNLogSoftMax kernel.
9291        #[unsafe(method(nodeWithSource:))]
9292        #[unsafe(method_family = none)]
9293        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
9294
9295        /// Init a node representing a MPSCNNLogSoftMax kernel
9296        ///
9297        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9298        ///
9299        /// Returns: A new MPSNNFilter node for a MPSCNNLogSoftMax kernel.
9300        #[unsafe(method(initWithSource:))]
9301        #[unsafe(method_family = init)]
9302        pub unsafe fn initWithSource(
9303            this: Allocated<Self>,
9304            source_node: &MPSNNImageNode,
9305        ) -> Retained<Self>;
9306    );
9307}
9308
9309/// Methods declared on superclass `MPSNNFilterNode`.
9310impl MPSCNNLogSoftMaxNode {
9311    extern_methods!(
9312        #[unsafe(method(init))]
9313        #[unsafe(method_family = init)]
9314        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9315    );
9316}
9317
9318/// Methods declared on superclass `NSObject`.
9319impl MPSCNNLogSoftMaxNode {
9320    extern_methods!(
9321        #[unsafe(method(new))]
9322        #[unsafe(method_family = new)]
9323        pub unsafe fn new() -> Retained<Self>;
9324    );
9325}
9326
9327extern_class!(
9328    /// Node representing a MPSCNNLogSoftMaxGradient kernel
9329    ///
9330    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnlogsoftmaxgradientnode?language=objc)
9331    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9332    #[derive(Debug, PartialEq, Eq, Hash)]
9333    pub struct MPSCNNLogSoftMaxGradientNode;
9334);
9335
9336extern_conformance!(
9337    unsafe impl NSObjectProtocol for MPSCNNLogSoftMaxGradientNode {}
9338);
9339
9340impl MPSCNNLogSoftMaxGradientNode {
9341    extern_methods!(
9342        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
9343        #[unsafe(method_family = none)]
9344        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
9345            source_gradient: &MPSNNImageNode,
9346            source_image: &MPSNNImageNode,
9347            gradient_state: &MPSNNGradientStateNode,
9348        ) -> Retained<Self>;
9349
9350        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
9351        #[unsafe(method_family = init)]
9352        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
9353            this: Allocated<Self>,
9354            source_gradient: &MPSNNImageNode,
9355            source_image: &MPSNNImageNode,
9356            gradient_state: &MPSNNGradientStateNode,
9357        ) -> Retained<Self>;
9358    );
9359}
9360
9361/// Methods declared on superclass `MPSNNFilterNode`.
9362impl MPSCNNLogSoftMaxGradientNode {
9363    extern_methods!(
9364        #[unsafe(method(init))]
9365        #[unsafe(method_family = init)]
9366        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9367    );
9368}
9369
9370/// Methods declared on superclass `NSObject`.
9371impl MPSCNNLogSoftMaxGradientNode {
9372    extern_methods!(
9373        #[unsafe(method(new))]
9374        #[unsafe(method_family = new)]
9375        pub unsafe fn new() -> Retained<Self>;
9376    );
9377}
9378
9379extern_class!(
9380    /// Node representing a MPSCNNUpsamplingNearest kernel
9381    ///
9382    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnupsamplingnearestnode?language=objc)
9383    #[unsafe(super(MPSNNFilterNode, NSObject))]
9384    #[derive(Debug, PartialEq, Eq, Hash)]
9385    pub struct MPSCNNUpsamplingNearestNode;
9386);
9387
9388extern_conformance!(
9389    unsafe impl NSObjectProtocol for MPSCNNUpsamplingNearestNode {}
9390);
9391
9392impl MPSCNNUpsamplingNearestNode {
9393    extern_methods!(
9394        /// Convenience initializer for an autoreleased MPSCNNUpsamplingNearest nodes
9395        ///
9396        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9397        ///
9398        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9399        ///
9400        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9401        ///
9402        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingNearest kernel.
9403        #[unsafe(method(nodeWithSource:integerScaleFactorX:integerScaleFactorY:))]
9404        #[unsafe(method_family = none)]
9405        pub unsafe fn nodeWithSource_integerScaleFactorX_integerScaleFactorY(
9406            source_node: &MPSNNImageNode,
9407            integer_scale_factor_x: NSUInteger,
9408            integer_scale_factor_y: NSUInteger,
9409        ) -> Retained<Self>;
9410
9411        /// Init a node representing a MPSCNNUpsamplingNearest kernel
9412        ///
9413        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9414        ///
9415        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9416        ///
9417        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9418        ///
9419        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingNearest kernel.
9420        #[unsafe(method(initWithSource:integerScaleFactorX:integerScaleFactorY:))]
9421        #[unsafe(method_family = init)]
9422        pub unsafe fn initWithSource_integerScaleFactorX_integerScaleFactorY(
9423            this: Allocated<Self>,
9424            source_node: &MPSNNImageNode,
9425            integer_scale_factor_x: NSUInteger,
9426            integer_scale_factor_y: NSUInteger,
9427        ) -> Retained<Self>;
9428
9429        #[unsafe(method(scaleFactorX))]
9430        #[unsafe(method_family = none)]
9431        pub unsafe fn scaleFactorX(&self) -> c_double;
9432
9433        #[unsafe(method(scaleFactorY))]
9434        #[unsafe(method_family = none)]
9435        pub unsafe fn scaleFactorY(&self) -> c_double;
9436    );
9437}
9438
9439/// Methods declared on superclass `MPSNNFilterNode`.
9440impl MPSCNNUpsamplingNearestNode {
9441    extern_methods!(
9442        #[unsafe(method(init))]
9443        #[unsafe(method_family = init)]
9444        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9445    );
9446}
9447
9448/// Methods declared on superclass `NSObject`.
9449impl MPSCNNUpsamplingNearestNode {
9450    extern_methods!(
9451        #[unsafe(method(new))]
9452        #[unsafe(method_family = new)]
9453        pub unsafe fn new() -> Retained<Self>;
9454    );
9455}
9456
9457extern_class!(
9458    /// Node representing a MPSCNNUpsamplingBilinear kernel
9459    ///
9460    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnupsamplingbilinearnode?language=objc)
9461    #[unsafe(super(MPSNNFilterNode, NSObject))]
9462    #[derive(Debug, PartialEq, Eq, Hash)]
9463    pub struct MPSCNNUpsamplingBilinearNode;
9464);
9465
9466extern_conformance!(
9467    unsafe impl NSObjectProtocol for MPSCNNUpsamplingBilinearNode {}
9468);
9469
9470impl MPSCNNUpsamplingBilinearNode {
9471    extern_methods!(
9472        /// Init a autoreleased node representing a MPSCNNUpsamplingBilinear kernel
9473        ///
9474        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9475        ///
9476        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9477        ///
9478        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9479        ///
9480        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingBilinear kernel.
9481        #[unsafe(method(nodeWithSource:integerScaleFactorX:integerScaleFactorY:))]
9482        #[unsafe(method_family = none)]
9483        pub unsafe fn nodeWithSource_integerScaleFactorX_integerScaleFactorY(
9484            source_node: &MPSNNImageNode,
9485            integer_scale_factor_x: NSUInteger,
9486            integer_scale_factor_y: NSUInteger,
9487        ) -> Retained<Self>;
9488
9489        /// Init a autoreleased node representing a MPSCNNUpsamplingBilinear kernel
9490        ///
9491        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9492        ///
9493        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9494        ///
9495        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9496        ///
9497        /// Parameter `alignCorners`: Specifier whether the centers of the 4 corner pixels of the input and output regions are aligned,
9498        ///
9499        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingBilinear kernel.
9500        #[unsafe(method(nodeWithSource:integerScaleFactorX:integerScaleFactorY:alignCorners:))]
9501        #[unsafe(method_family = none)]
9502        pub unsafe fn nodeWithSource_integerScaleFactorX_integerScaleFactorY_alignCorners(
9503            source_node: &MPSNNImageNode,
9504            integer_scale_factor_x: NSUInteger,
9505            integer_scale_factor_y: NSUInteger,
9506            align_corners: bool,
9507        ) -> Retained<Self>;
9508
9509        /// Init a node representing a MPSCNNUpsamplingBilinear kernel
9510        ///
9511        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9512        ///
9513        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9514        ///
9515        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9516        ///
9517        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingBilinear kernel.
9518        #[unsafe(method(initWithSource:integerScaleFactorX:integerScaleFactorY:))]
9519        #[unsafe(method_family = init)]
9520        pub unsafe fn initWithSource_integerScaleFactorX_integerScaleFactorY(
9521            this: Allocated<Self>,
9522            source_node: &MPSNNImageNode,
9523            integer_scale_factor_x: NSUInteger,
9524            integer_scale_factor_y: NSUInteger,
9525        ) -> Retained<Self>;
9526
9527        /// Init a node representing a MPSCNNUpsamplingBilinear kernel
9528        ///
9529        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter
9530        ///
9531        /// Parameter `integerScaleFactorX`: The upsampling factor for the x dimension.
9532        ///
9533        /// Parameter `integerScaleFactorY`: The upsampling factor for the y dimension.
9534        ///
9535        /// Parameter `alignCorners`: Specifier whether the centers of the 4 corner pixels of the input and output regions are aligned,
9536        ///
9537        /// Returns: A new MPSNNFilter node for a MPSCNNUpsamplingBilinear kernel.
9538        #[unsafe(method(initWithSource:integerScaleFactorX:integerScaleFactorY:alignCorners:))]
9539        #[unsafe(method_family = init)]
9540        pub unsafe fn initWithSource_integerScaleFactorX_integerScaleFactorY_alignCorners(
9541            this: Allocated<Self>,
9542            source_node: &MPSNNImageNode,
9543            integer_scale_factor_x: NSUInteger,
9544            integer_scale_factor_y: NSUInteger,
9545            align_corners: bool,
9546        ) -> Retained<Self>;
9547
9548        #[unsafe(method(scaleFactorX))]
9549        #[unsafe(method_family = none)]
9550        pub unsafe fn scaleFactorX(&self) -> c_double;
9551
9552        #[unsafe(method(scaleFactorY))]
9553        #[unsafe(method_family = none)]
9554        pub unsafe fn scaleFactorY(&self) -> c_double;
9555
9556        #[unsafe(method(alignCorners))]
9557        #[unsafe(method_family = none)]
9558        pub unsafe fn alignCorners(&self) -> bool;
9559    );
9560}
9561
9562/// Methods declared on superclass `MPSNNFilterNode`.
9563impl MPSCNNUpsamplingBilinearNode {
9564    extern_methods!(
9565        #[unsafe(method(init))]
9566        #[unsafe(method_family = init)]
9567        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9568    );
9569}
9570
9571/// Methods declared on superclass `NSObject`.
9572impl MPSCNNUpsamplingBilinearNode {
9573    extern_methods!(
9574        #[unsafe(method(new))]
9575        #[unsafe(method_family = new)]
9576        pub unsafe fn new() -> Retained<Self>;
9577    );
9578}
9579
9580extern_class!(
9581    /// Node representing a MPSCNNUpsamplingNearest kernel
9582    ///
9583    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnupsamplingnearestgradientnode?language=objc)
9584    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9585    #[derive(Debug, PartialEq, Eq, Hash)]
9586    pub struct MPSCNNUpsamplingNearestGradientNode;
9587);
9588
9589extern_conformance!(
9590    unsafe impl NSObjectProtocol for MPSCNNUpsamplingNearestGradientNode {}
9591);
9592
9593impl MPSCNNUpsamplingNearestGradientNode {
9594    extern_methods!(
9595        /// A node to represent the gradient calculation for nearest upsampling training.
9596        ///
9597        /// [forwardFilter gradientFilterWithSources:] is a more convient way to do this.
9598        ///
9599        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9600        ///
9601        /// Parameter `sourceImage`: The input image from the forward filter node
9602        ///
9603        /// Parameter `gradientState`: The gradient state from the forward filter
9604        ///
9605        /// Parameter `scaleFactorX`: The X scale factor from the forward pass
9606        ///
9607        /// Parameter `scaleFactorY`: The Y scale factor from the forward pass
9608        ///
9609        /// Returns: A MPSCNNUpsamplingNearestGradientNode
9610        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:scaleFactorX:scaleFactorY:))]
9611        #[unsafe(method_family = none)]
9612        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_scaleFactorX_scaleFactorY(
9613            source_gradient: &MPSNNImageNode,
9614            source_image: &MPSNNImageNode,
9615            gradient_state: &MPSNNGradientStateNode,
9616            scale_factor_x: c_double,
9617            scale_factor_y: c_double,
9618        ) -> Retained<Self>;
9619
9620        /// A node to represent the gradient calculation for nearest upsampling training.
9621        ///
9622        /// [forwardFilter gradientFilterWithSources:] is a more convient way to do this.
9623        ///
9624        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9625        ///
9626        /// Parameter `sourceImage`: The input image from the forward filter node
9627        ///
9628        /// Parameter `gradientState`: The gradient state from the forward filter
9629        ///
9630        /// Parameter `scaleFactorX`: The X scale factor from the forward pass
9631        ///
9632        /// Parameter `scaleFactorY`: The Y scale factor from the forward pass
9633        ///
9634        /// Returns: A MPSCNNUpsamplingNearestGradientNode
9635        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:scaleFactorX:scaleFactorY:))]
9636        #[unsafe(method_family = init)]
9637        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_scaleFactorX_scaleFactorY(
9638            this: Allocated<Self>,
9639            source_gradient: &MPSNNImageNode,
9640            source_image: &MPSNNImageNode,
9641            gradient_state: &MPSNNGradientStateNode,
9642            scale_factor_x: c_double,
9643            scale_factor_y: c_double,
9644        ) -> Retained<Self>;
9645
9646        #[unsafe(method(scaleFactorX))]
9647        #[unsafe(method_family = none)]
9648        pub unsafe fn scaleFactorX(&self) -> c_double;
9649
9650        #[unsafe(method(scaleFactorY))]
9651        #[unsafe(method_family = none)]
9652        pub unsafe fn scaleFactorY(&self) -> c_double;
9653    );
9654}
9655
9656/// Methods declared on superclass `MPSNNFilterNode`.
9657impl MPSCNNUpsamplingNearestGradientNode {
9658    extern_methods!(
9659        #[unsafe(method(init))]
9660        #[unsafe(method_family = init)]
9661        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9662    );
9663}
9664
9665/// Methods declared on superclass `NSObject`.
9666impl MPSCNNUpsamplingNearestGradientNode {
9667    extern_methods!(
9668        #[unsafe(method(new))]
9669        #[unsafe(method_family = new)]
9670        pub unsafe fn new() -> Retained<Self>;
9671    );
9672}
9673
9674extern_class!(
9675    /// Node representing a MPSCNNUpsamplingBilinear kernel
9676    ///
9677    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnupsamplingbilineargradientnode?language=objc)
9678    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9679    #[derive(Debug, PartialEq, Eq, Hash)]
9680    pub struct MPSCNNUpsamplingBilinearGradientNode;
9681);
9682
9683extern_conformance!(
9684    unsafe impl NSObjectProtocol for MPSCNNUpsamplingBilinearGradientNode {}
9685);
9686
9687impl MPSCNNUpsamplingBilinearGradientNode {
9688    extern_methods!(
9689        /// A node to represent the gradient calculation for nearest upsampling training.
9690        ///
9691        /// [forwardFilter gradientFilterWithSources:] is a more convient way to do this.
9692        ///
9693        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9694        ///
9695        /// Parameter `sourceImage`: The input image from the forward filter node
9696        ///
9697        /// Parameter `gradientState`: The gradient state from the forward filter
9698        ///
9699        /// Parameter `scaleFactorX`: The X scale factor from the forward pass
9700        ///
9701        /// Parameter `scaleFactorY`: The Y scale factor from the forward pass
9702        ///
9703        /// Returns: A MPSCNNUpsamplingBilinearGradientNode
9704        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:scaleFactorX:scaleFactorY:))]
9705        #[unsafe(method_family = none)]
9706        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_scaleFactorX_scaleFactorY(
9707            source_gradient: &MPSNNImageNode,
9708            source_image: &MPSNNImageNode,
9709            gradient_state: &MPSNNGradientStateNode,
9710            scale_factor_x: c_double,
9711            scale_factor_y: c_double,
9712        ) -> Retained<Self>;
9713
9714        /// A node to represent the gradient calculation for nearest upsampling training.
9715        ///
9716        /// [forwardFilter gradientFilterWithSources:] is a more convient way to do this.
9717        ///
9718        /// Parameter `sourceGradient`: The input gradient from the 'downstream' gradient filter.
9719        ///
9720        /// Parameter `sourceImage`: The input image from the forward filter node
9721        ///
9722        /// Parameter `gradientState`: The gradient state from the forward filter
9723        ///
9724        /// Parameter `scaleFactorX`: The X scale factor from the forward pass
9725        ///
9726        /// Parameter `scaleFactorY`: The Y scale factor from the forward pass
9727        ///
9728        /// Returns: A MPSCNNUpsamplingBilinearGradientNode
9729        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:scaleFactorX:scaleFactorY:))]
9730        #[unsafe(method_family = init)]
9731        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_scaleFactorX_scaleFactorY(
9732            this: Allocated<Self>,
9733            source_gradient: &MPSNNImageNode,
9734            source_image: &MPSNNImageNode,
9735            gradient_state: &MPSNNGradientStateNode,
9736            scale_factor_x: c_double,
9737            scale_factor_y: c_double,
9738        ) -> Retained<Self>;
9739
9740        #[unsafe(method(scaleFactorX))]
9741        #[unsafe(method_family = none)]
9742        pub unsafe fn scaleFactorX(&self) -> c_double;
9743
9744        #[unsafe(method(scaleFactorY))]
9745        #[unsafe(method_family = none)]
9746        pub unsafe fn scaleFactorY(&self) -> c_double;
9747    );
9748}
9749
9750/// Methods declared on superclass `MPSNNFilterNode`.
9751impl MPSCNNUpsamplingBilinearGradientNode {
9752    extern_methods!(
9753        #[unsafe(method(init))]
9754        #[unsafe(method_family = init)]
9755        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9756    );
9757}
9758
9759/// Methods declared on superclass `NSObject`.
9760impl MPSCNNUpsamplingBilinearGradientNode {
9761    extern_methods!(
9762        #[unsafe(method(new))]
9763        #[unsafe(method_family = new)]
9764        pub unsafe fn new() -> Retained<Self>;
9765    );
9766}
9767
9768extern_protocol!(
9769    /// MPSNNGramMatrixCallback Defines a callback protocol for
9770    /// MPSNNGramMatrixCalculationNodeto set the 'alpha'
9771    /// scaling value dynamically just before encoding the underlying MPSNNGramMatrixCalculation kernel.
9772    ///
9773    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngrammatrixcallback?language=objc)
9774    pub unsafe trait MPSNNGramMatrixCallback:
9775        NSObjectProtocol + NSSecureCoding + NSCopying
9776    {
9777        #[cfg(all(feature = "MPSCore", feature = "MPSImage"))]
9778        /// Returns the desired alpha scaling value.
9779        ///
9780        /// Parameter `sourceImage`: One of the source images in the batch given as a reference for the alpha computation.
9781        ///
9782        /// Parameter `destinationImage`: One of the destination images in the batch given as a reference for the alpha computation.
9783        ///
9784        /// Returns: The desired alpha value.
9785        #[unsafe(method(alphaForSourceImage:destinationImage:))]
9786        #[unsafe(method_family = none)]
9787        unsafe fn alphaForSourceImage_destinationImage(
9788            &self,
9789            source_image: &MPSImage,
9790            destination_image: &MPSImage,
9791        ) -> c_float;
9792    }
9793);
9794
9795extern_class!(
9796    /// Node representing a
9797    /// MPSNNGramMatrixCalculationkernel
9798    ///
9799    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngrammatrixcalculationnode?language=objc)
9800    #[unsafe(super(MPSNNFilterNode, NSObject))]
9801    #[derive(Debug, PartialEq, Eq, Hash)]
9802    pub struct MPSNNGramMatrixCalculationNode;
9803);
9804
9805extern_conformance!(
9806    unsafe impl NSObjectProtocol for MPSNNGramMatrixCalculationNode {}
9807);
9808
9809impl MPSNNGramMatrixCalculationNode {
9810    extern_methods!(
9811        /// Scaling factor for the output. Default: 1.0f.
9812        #[unsafe(method(alpha))]
9813        #[unsafe(method_family = none)]
9814        pub unsafe fn alpha(&self) -> c_float;
9815
9816        /// Optional callback option - setting this allows the alpha value to be changed dynamically at encode time.
9817        /// Default value: nil.
9818        #[unsafe(method(propertyCallBack))]
9819        #[unsafe(method_family = none)]
9820        pub unsafe fn propertyCallBack(
9821            &self,
9822        ) -> Option<Retained<ProtocolObject<dyn MPSNNGramMatrixCallback>>>;
9823
9824        /// Setter for [`propertyCallBack`][Self::propertyCallBack].
9825        #[unsafe(method(setPropertyCallBack:))]
9826        #[unsafe(method_family = none)]
9827        pub unsafe fn setPropertyCallBack(
9828            &self,
9829            property_call_back: Option<&ProtocolObject<dyn MPSNNGramMatrixCallback>>,
9830        );
9831
9832        /// Init a node representing a autoreleased MPSNNGramMatrixCalculationNode kernel.
9833        ///
9834        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter.
9835        ///
9836        /// Returns: A new MPSNNFilter node for a MPSNNGramMatrixCalculationNode kernel.
9837        #[unsafe(method(nodeWithSource:))]
9838        #[unsafe(method_family = none)]
9839        pub unsafe fn nodeWithSource(source_node: &MPSNNImageNode) -> Retained<Self>;
9840
9841        /// Init a node representing a MPSNNGramMatrixCalculationNode kernel.
9842        ///
9843        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter.
9844        ///
9845        /// Returns: A new MPSNNFilter node for a MPSNNGramMatrixCalculationNode kernel.
9846        #[unsafe(method(initWithSource:))]
9847        #[unsafe(method_family = init)]
9848        pub unsafe fn initWithSource(
9849            this: Allocated<Self>,
9850            source_node: &MPSNNImageNode,
9851        ) -> Retained<Self>;
9852
9853        /// Init a node representing a autoreleased MPSNNGramMatrixCalculationNode kernel.
9854        ///
9855        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter.
9856        ///
9857        /// Parameter `alpha`: Scaling factor for the output.
9858        ///
9859        /// Returns: A new MPSNNFilter node for a MPSNNGramMatrixCalculationNode kernel.
9860        #[unsafe(method(nodeWithSource:alpha:))]
9861        #[unsafe(method_family = none)]
9862        pub unsafe fn nodeWithSource_alpha(
9863            source_node: &MPSNNImageNode,
9864            alpha: c_float,
9865        ) -> Retained<Self>;
9866
9867        /// Init a node representing a MPSNNGramMatrixCalculationNode kernel.
9868        ///
9869        /// Parameter `sourceNode`: The MPSNNImageNode representing the source MPSImage for the filter.
9870        ///
9871        /// Parameter `alpha`: Scaling factor for the output.
9872        ///
9873        /// Returns: A new MPSNNFilter node for a MPSNNGramMatrixCalculationNode kernel.
9874        #[unsafe(method(initWithSource:alpha:))]
9875        #[unsafe(method_family = init)]
9876        pub unsafe fn initWithSource_alpha(
9877            this: Allocated<Self>,
9878            source_node: &MPSNNImageNode,
9879            alpha: c_float,
9880        ) -> Retained<Self>;
9881    );
9882}
9883
9884/// Methods declared on superclass `MPSNNFilterNode`.
9885impl MPSNNGramMatrixCalculationNode {
9886    extern_methods!(
9887        #[unsafe(method(init))]
9888        #[unsafe(method_family = init)]
9889        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9890    );
9891}
9892
9893/// Methods declared on superclass `NSObject`.
9894impl MPSNNGramMatrixCalculationNode {
9895    extern_methods!(
9896        #[unsafe(method(new))]
9897        #[unsafe(method_family = new)]
9898        pub unsafe fn new() -> Retained<Self>;
9899    );
9900}
9901
9902extern_class!(
9903    /// Node representing a
9904    /// MPSNNGramMatrixCalculationGradientkernel
9905    ///
9906    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnngrammatrixcalculationgradientnode?language=objc)
9907    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
9908    #[derive(Debug, PartialEq, Eq, Hash)]
9909    pub struct MPSNNGramMatrixCalculationGradientNode;
9910);
9911
9912extern_conformance!(
9913    unsafe impl NSObjectProtocol for MPSNNGramMatrixCalculationGradientNode {}
9914);
9915
9916impl MPSNNGramMatrixCalculationGradientNode {
9917    extern_methods!(
9918        /// Scaling factor for the output. Default: 1.0f.
9919        #[unsafe(method(alpha))]
9920        #[unsafe(method_family = none)]
9921        pub unsafe fn alpha(&self) -> c_float;
9922
9923        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:))]
9924        #[unsafe(method_family = none)]
9925        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState(
9926            source_gradient: &MPSNNImageNode,
9927            source_image: &MPSNNImageNode,
9928            gradient_state: &MPSNNGradientStateNode,
9929        ) -> Retained<Self>;
9930
9931        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:))]
9932        #[unsafe(method_family = init)]
9933        pub unsafe fn initWithSourceGradient_sourceImage_gradientState(
9934            this: Allocated<Self>,
9935            source_gradient: &MPSNNImageNode,
9936            source_image: &MPSNNImageNode,
9937            gradient_state: &MPSNNGradientStateNode,
9938        ) -> Retained<Self>;
9939
9940        #[unsafe(method(nodeWithSourceGradient:sourceImage:gradientState:alpha:))]
9941        #[unsafe(method_family = none)]
9942        pub unsafe fn nodeWithSourceGradient_sourceImage_gradientState_alpha(
9943            source_gradient: &MPSNNImageNode,
9944            source_image: &MPSNNImageNode,
9945            gradient_state: &MPSNNGradientStateNode,
9946            alpha: c_float,
9947        ) -> Retained<Self>;
9948
9949        #[unsafe(method(initWithSourceGradient:sourceImage:gradientState:alpha:))]
9950        #[unsafe(method_family = init)]
9951        pub unsafe fn initWithSourceGradient_sourceImage_gradientState_alpha(
9952            this: Allocated<Self>,
9953            source_gradient: &MPSNNImageNode,
9954            source_image: &MPSNNImageNode,
9955            gradient_state: &MPSNNGradientStateNode,
9956            alpha: c_float,
9957        ) -> Retained<Self>;
9958    );
9959}
9960
9961/// Methods declared on superclass `MPSNNFilterNode`.
9962impl MPSNNGramMatrixCalculationGradientNode {
9963    extern_methods!(
9964        #[unsafe(method(init))]
9965        #[unsafe(method_family = init)]
9966        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
9967    );
9968}
9969
9970/// Methods declared on superclass `NSObject`.
9971impl MPSNNGramMatrixCalculationGradientNode {
9972    extern_methods!(
9973        #[unsafe(method(new))]
9974        #[unsafe(method_family = new)]
9975        pub unsafe fn new() -> Retained<Self>;
9976    );
9977}
9978
9979extern_protocol!(
9980    /// MPSNNLossCallback Defines a callback protocol for
9981    /// MPSNNForwardLossNodeand
9982    /// MPSNNLossGradientNodeto set the scalar weight value just before encoding the underlying kernels.
9983    ///
9984    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnlosscallback?language=objc)
9985    pub unsafe trait MPSNNLossCallback:
9986        NSObjectProtocol + NSSecureCoding + NSCopying
9987    {
9988        #[cfg(all(feature = "MPSCore", feature = "MPSImage"))]
9989        /// Returns the desired loss scaling weight value.
9990        ///
9991        /// Parameter `sourceImage`: One of the source images in the batch given as a reference.
9992        ///
9993        /// Parameter `destinationImage`: One of the destination images in the batch given as a reference.
9994        ///
9995        /// Returns: The desired scalar weight value.
9996        #[unsafe(method(scalarWeightForSourceImage:destinationImage:))]
9997        #[unsafe(method_family = none)]
9998        unsafe fn scalarWeightForSourceImage_destinationImage(
9999            &self,
10000            source_image: &MPSImage,
10001            destination_image: &MPSImage,
10002        ) -> c_float;
10003    }
10004);
10005
10006extern_class!(
10007    /// Node representing a
10008    /// MPSNNForwardLosskernel
10009    ///
10010    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnforwardlossnode?language=objc)
10011    #[unsafe(super(MPSNNFilterNode, NSObject))]
10012    #[derive(Debug, PartialEq, Eq, Hash)]
10013    pub struct MPSNNForwardLossNode;
10014);
10015
10016extern_conformance!(
10017    unsafe impl NSObjectProtocol for MPSNNForwardLossNode {}
10018);
10019
10020impl MPSNNForwardLossNode {
10021    extern_methods!(
10022        #[cfg(feature = "MPSCNNTypes")]
10023        #[unsafe(method(lossType))]
10024        #[unsafe(method_family = none)]
10025        pub unsafe fn lossType(&self) -> MPSCNNLossType;
10026
10027        #[cfg(feature = "MPSCNNTypes")]
10028        #[unsafe(method(reductionType))]
10029        #[unsafe(method_family = none)]
10030        pub unsafe fn reductionType(&self) -> MPSCNNReductionType;
10031
10032        #[unsafe(method(numberOfClasses))]
10033        #[unsafe(method_family = none)]
10034        pub unsafe fn numberOfClasses(&self) -> NSUInteger;
10035
10036        #[unsafe(method(reduceAcrossBatch))]
10037        #[unsafe(method_family = none)]
10038        pub unsafe fn reduceAcrossBatch(&self) -> bool;
10039
10040        #[unsafe(method(weight))]
10041        #[unsafe(method_family = none)]
10042        pub unsafe fn weight(&self) -> c_float;
10043
10044        #[unsafe(method(labelSmoothing))]
10045        #[unsafe(method_family = none)]
10046        pub unsafe fn labelSmoothing(&self) -> c_float;
10047
10048        #[unsafe(method(epsilon))]
10049        #[unsafe(method_family = none)]
10050        pub unsafe fn epsilon(&self) -> c_float;
10051
10052        #[unsafe(method(delta))]
10053        #[unsafe(method_family = none)]
10054        pub unsafe fn delta(&self) -> c_float;
10055
10056        /// Optional callback option - setting this allows the scalar weight value to be changed dynamically at encode time.
10057        /// Default value: nil.
10058        #[unsafe(method(propertyCallBack))]
10059        #[unsafe(method_family = none)]
10060        pub unsafe fn propertyCallBack(
10061            &self,
10062        ) -> Option<Retained<ProtocolObject<dyn MPSNNLossCallback>>>;
10063
10064        /// Setter for [`propertyCallBack`][Self::propertyCallBack].
10065        #[unsafe(method(setPropertyCallBack:))]
10066        #[unsafe(method_family = none)]
10067        pub unsafe fn setPropertyCallBack(
10068            &self,
10069            property_call_back: Option<&ProtocolObject<dyn MPSNNLossCallback>>,
10070        );
10071
10072        #[cfg(feature = "MPSCNNLoss")]
10073        #[unsafe(method(nodeWithSource:labels:weights:lossDescriptor:))]
10074        #[unsafe(method_family = none)]
10075        pub unsafe fn nodeWithSource_labels_weights_lossDescriptor(
10076            source: &MPSNNImageNode,
10077            labels: &MPSNNImageNode,
10078            weights: &MPSNNImageNode,
10079            descriptor: &MPSCNNLossDescriptor,
10080        ) -> Retained<Self>;
10081
10082        #[cfg(feature = "MPSCNNLoss")]
10083        #[unsafe(method(nodeWithSource:labels:lossDescriptor:))]
10084        #[unsafe(method_family = none)]
10085        pub unsafe fn nodeWithSource_labels_lossDescriptor(
10086            source: &MPSNNImageNode,
10087            labels: &MPSNNImageNode,
10088            descriptor: &MPSCNNLossDescriptor,
10089        ) -> Retained<Self>;
10090
10091        #[cfg(feature = "MPSCNNLoss")]
10092        /// Init a forward loss node from multiple images
10093        ///
10094        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
10095        /// Node0: logits, Node1: labels, Node2: weights
10096        ///
10097        /// Returns: A new MPSNNFilter node.
10098        #[unsafe(method(nodeWithSources:lossDescriptor:))]
10099        #[unsafe(method_family = none)]
10100        pub unsafe fn nodeWithSources_lossDescriptor(
10101            source_nodes: &NSArray<MPSNNImageNode>,
10102            descriptor: &MPSCNNLossDescriptor,
10103        ) -> Retained<Self>;
10104
10105        #[cfg(feature = "MPSCNNLoss")]
10106        #[unsafe(method(initWithSource:labels:weights:lossDescriptor:))]
10107        #[unsafe(method_family = init)]
10108        pub unsafe fn initWithSource_labels_weights_lossDescriptor(
10109            this: Allocated<Self>,
10110            source: &MPSNNImageNode,
10111            labels: &MPSNNImageNode,
10112            weights: Option<&MPSNNImageNode>,
10113            descriptor: &MPSCNNLossDescriptor,
10114        ) -> Retained<Self>;
10115
10116        #[cfg(feature = "MPSCNNLoss")]
10117        #[unsafe(method(initWithSource:labels:lossDescriptor:))]
10118        #[unsafe(method_family = init)]
10119        pub unsafe fn initWithSource_labels_lossDescriptor(
10120            this: Allocated<Self>,
10121            source: &MPSNNImageNode,
10122            labels: &MPSNNImageNode,
10123            descriptor: &MPSCNNLossDescriptor,
10124        ) -> Retained<Self>;
10125
10126        #[cfg(feature = "MPSCNNLoss")]
10127        /// Init a forward loss node from multiple images
10128        ///
10129        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
10130        /// Node0: logits, Node1: labels, Node2: weights
10131        ///
10132        /// Returns: A new MPSNNFilter node.
10133        #[unsafe(method(initWithSources:lossDescriptor:))]
10134        #[unsafe(method_family = init)]
10135        pub unsafe fn initWithSources_lossDescriptor(
10136            this: Allocated<Self>,
10137            source_nodes: &NSArray<MPSNNImageNode>,
10138            descriptor: &MPSCNNLossDescriptor,
10139        ) -> Retained<Self>;
10140
10141        /// Returns the gradient filter for predictions, if you want also gradients for labels then use -gradientFiltersWithSource(s):
10142        #[unsafe(method(gradientFilterWithSources:))]
10143        #[unsafe(method_family = none)]
10144        pub unsafe fn gradientFilterWithSources(
10145            &self,
10146            source_gradient: &NSArray<MPSNNImageNode>,
10147        ) -> Retained<MPSNNLossGradientNode>;
10148
10149        #[unsafe(method(gradientFiltersWithSources:))]
10150        #[unsafe(method_family = none)]
10151        pub unsafe fn gradientFiltersWithSources(
10152            &self,
10153            source_gradient: &NSArray<MPSNNImageNode>,
10154        ) -> Retained<NSArray<MPSNNLossGradientNode>>;
10155
10156        #[unsafe(method(gradientFilterWithSource:))]
10157        #[unsafe(method_family = none)]
10158        pub unsafe fn gradientFilterWithSource(
10159            &self,
10160            source_gradient: &MPSNNImageNode,
10161        ) -> Retained<MPSNNLossGradientNode>;
10162
10163        #[unsafe(method(gradientFiltersWithSource:))]
10164        #[unsafe(method_family = none)]
10165        pub unsafe fn gradientFiltersWithSource(
10166            &self,
10167            source_gradient: &MPSNNImageNode,
10168        ) -> Retained<NSArray<MPSNNLossGradientNode>>;
10169    );
10170}
10171
10172/// Methods declared on superclass `MPSNNFilterNode`.
10173impl MPSNNForwardLossNode {
10174    extern_methods!(
10175        #[unsafe(method(init))]
10176        #[unsafe(method_family = init)]
10177        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
10178    );
10179}
10180
10181/// Methods declared on superclass `NSObject`.
10182impl MPSNNForwardLossNode {
10183    extern_methods!(
10184        #[unsafe(method(new))]
10185        #[unsafe(method_family = new)]
10186        pub unsafe fn new() -> Retained<Self>;
10187    );
10188}
10189
10190extern_class!(
10191    /// Node representing a
10192    /// MPSNNLossGradientkernel
10193    ///
10194    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnlossgradientnode?language=objc)
10195    #[unsafe(super(MPSNNGradientFilterNode, MPSNNFilterNode, NSObject))]
10196    #[derive(Debug, PartialEq, Eq, Hash)]
10197    pub struct MPSNNLossGradientNode;
10198);
10199
10200extern_conformance!(
10201    unsafe impl NSObjectProtocol for MPSNNLossGradientNode {}
10202);
10203
10204impl MPSNNLossGradientNode {
10205    extern_methods!(
10206        #[cfg(feature = "MPSCNNTypes")]
10207        #[unsafe(method(lossType))]
10208        #[unsafe(method_family = none)]
10209        pub unsafe fn lossType(&self) -> MPSCNNLossType;
10210
10211        #[cfg(feature = "MPSCNNTypes")]
10212        #[unsafe(method(reductionType))]
10213        #[unsafe(method_family = none)]
10214        pub unsafe fn reductionType(&self) -> MPSCNNReductionType;
10215
10216        #[unsafe(method(numberOfClasses))]
10217        #[unsafe(method_family = none)]
10218        pub unsafe fn numberOfClasses(&self) -> NSUInteger;
10219
10220        #[unsafe(method(reduceAcrossBatch))]
10221        #[unsafe(method_family = none)]
10222        pub unsafe fn reduceAcrossBatch(&self) -> bool;
10223
10224        #[unsafe(method(weight))]
10225        #[unsafe(method_family = none)]
10226        pub unsafe fn weight(&self) -> c_float;
10227
10228        #[unsafe(method(labelSmoothing))]
10229        #[unsafe(method_family = none)]
10230        pub unsafe fn labelSmoothing(&self) -> c_float;
10231
10232        #[unsafe(method(epsilon))]
10233        #[unsafe(method_family = none)]
10234        pub unsafe fn epsilon(&self) -> c_float;
10235
10236        #[unsafe(method(delta))]
10237        #[unsafe(method_family = none)]
10238        pub unsafe fn delta(&self) -> c_float;
10239
10240        #[unsafe(method(isLabelsGradientFilter))]
10241        #[unsafe(method_family = none)]
10242        pub unsafe fn isLabelsGradientFilter(&self) -> bool;
10243
10244        /// Optional callback option - setting this allows the scalar weight value to be changed dynamically at encode time.
10245        /// Default value: nil.
10246        #[unsafe(method(propertyCallBack))]
10247        #[unsafe(method_family = none)]
10248        pub unsafe fn propertyCallBack(
10249            &self,
10250        ) -> Option<Retained<ProtocolObject<dyn MPSNNLossCallback>>>;
10251
10252        /// Setter for [`propertyCallBack`][Self::propertyCallBack].
10253        #[unsafe(method(setPropertyCallBack:))]
10254        #[unsafe(method_family = none)]
10255        pub unsafe fn setPropertyCallBack(
10256            &self,
10257            property_call_back: Option<&ProtocolObject<dyn MPSNNLossCallback>>,
10258        );
10259
10260        #[cfg(feature = "MPSCNNLoss")]
10261        #[unsafe(method(nodeWithSourceGradient:sourceImage:labels:weights:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10262        #[unsafe(method_family = none)]
10263        pub unsafe fn nodeWithSourceGradient_sourceImage_labels_weights_gradientState_lossDescriptor_isLabelsGradientFilter(
10264            source_gradient: &MPSNNImageNode,
10265            source_image: &MPSNNImageNode,
10266            labels: &MPSNNImageNode,
10267            weights: &MPSNNImageNode,
10268            gradient_state: Option<&MPSNNGradientStateNode>,
10269            descriptor: &MPSCNNLossDescriptor,
10270            is_labels_gradient_filter: bool,
10271        ) -> Retained<Self>;
10272
10273        #[cfg(feature = "MPSCNNLoss")]
10274        #[unsafe(method(nodeWithSourceGradient:sourceImage:labels:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10275        #[unsafe(method_family = none)]
10276        pub unsafe fn nodeWithSourceGradient_sourceImage_labels_gradientState_lossDescriptor_isLabelsGradientFilter(
10277            source_gradient: &MPSNNImageNode,
10278            source_image: &MPSNNImageNode,
10279            labels: &MPSNNImageNode,
10280            gradient_state: Option<&MPSNNGradientStateNode>,
10281            descriptor: &MPSCNNLossDescriptor,
10282            is_labels_gradient_filter: bool,
10283        ) -> Retained<Self>;
10284
10285        #[cfg(feature = "MPSCNNLoss")]
10286        /// Init a gradient loss node from multiple images
10287        ///
10288        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
10289        /// Node0: logits, Node1: labels, Node2: weights
10290        ///
10291        /// Returns: A new MPSNNFilter node.
10292        #[unsafe(method(nodeWithSources:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10293        #[unsafe(method_family = none)]
10294        pub unsafe fn nodeWithSources_gradientState_lossDescriptor_isLabelsGradientFilter(
10295            source_nodes: &NSArray<MPSNNImageNode>,
10296            gradient_state: Option<&MPSNNGradientStateNode>,
10297            descriptor: &MPSCNNLossDescriptor,
10298            is_labels_gradient_filter: bool,
10299        ) -> Retained<Self>;
10300
10301        #[cfg(feature = "MPSCNNLoss")]
10302        #[unsafe(method(initWithSourceGradient:sourceImage:labels:weights:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10303        #[unsafe(method_family = init)]
10304        pub unsafe fn initWithSourceGradient_sourceImage_labels_weights_gradientState_lossDescriptor_isLabelsGradientFilter(
10305            this: Allocated<Self>,
10306            source_gradient: &MPSNNImageNode,
10307            source_image: &MPSNNImageNode,
10308            labels: &MPSNNImageNode,
10309            weights: Option<&MPSNNImageNode>,
10310            gradient_state: Option<&MPSNNGradientStateNode>,
10311            descriptor: &MPSCNNLossDescriptor,
10312            is_labels_gradient_filter: bool,
10313        ) -> Retained<Self>;
10314
10315        #[cfg(feature = "MPSCNNLoss")]
10316        #[unsafe(method(initWithSourceGradient:sourceImage:labels:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10317        #[unsafe(method_family = init)]
10318        pub unsafe fn initWithSourceGradient_sourceImage_labels_gradientState_lossDescriptor_isLabelsGradientFilter(
10319            this: Allocated<Self>,
10320            source_gradient: &MPSNNImageNode,
10321            source_image: &MPSNNImageNode,
10322            labels: &MPSNNImageNode,
10323            gradient_state: Option<&MPSNNGradientStateNode>,
10324            descriptor: &MPSCNNLossDescriptor,
10325            is_labels_gradient_filter: bool,
10326        ) -> Retained<Self>;
10327
10328        #[cfg(feature = "MPSCNNLoss")]
10329        /// Init a gradient loss node from multiple images
10330        ///
10331        /// Parameter `sourceNodes`: The MPSNNImageNode representing the source MPSImages for the filter
10332        /// Node0: input gradients, Node1: logits, Node2: labels, Node3: weights
10333        ///
10334        /// Returns: A new MPSNNFilter node.
10335        #[unsafe(method(initWithSources:gradientState:lossDescriptor:isLabelsGradientFilter:))]
10336        #[unsafe(method_family = init)]
10337        pub unsafe fn initWithSources_gradientState_lossDescriptor_isLabelsGradientFilter(
10338            this: Allocated<Self>,
10339            source_nodes: &NSArray<MPSNNImageNode>,
10340            gradient_state: Option<&MPSNNGradientStateNode>,
10341            descriptor: &MPSCNNLossDescriptor,
10342            is_labels_gradient_filter: bool,
10343        ) -> Retained<Self>;
10344
10345        /// This is a gradient filter - there is no support gradients of gradients currently.
10346        #[unsafe(method(gradientFilterWithSources:))]
10347        #[unsafe(method_family = none)]
10348        pub unsafe fn gradientFilterWithSources(
10349            &self,
10350            gradient_images: &NSArray<MPSNNImageNode>,
10351        ) -> Retained<MPSNNGradientFilterNode>;
10352    );
10353}
10354
10355/// Methods declared on superclass `MPSNNFilterNode`.
10356impl MPSNNLossGradientNode {
10357    extern_methods!(
10358        #[unsafe(method(init))]
10359        #[unsafe(method_family = init)]
10360        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
10361    );
10362}
10363
10364/// Methods declared on superclass `NSObject`.
10365impl MPSNNLossGradientNode {
10366    extern_methods!(
10367        #[unsafe(method(new))]
10368        #[unsafe(method_family = new)]
10369        pub unsafe fn new() -> Retained<Self>;
10370    );
10371}
10372
10373extern_class!(
10374    /// A node for a MPSNNInitialGradient kernel
10375    ///
10376    /// This node can be used to generate a starting point for an arbitrary gradient computation.
10377    /// Simply add this node after the node for which you want to compute gradients and then
10378    /// call the function
10379    /// trainingGraphWithSourceGradient:of this node to automatically
10380    /// generate the nodes needed for gradient computations or add the desired nodes manually.
10381    /// This is generally used with MPSNNLossGradientNode and MPSNNForwardLossNode
10382    ///
10383    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnninitialgradientnode?language=objc)
10384    #[unsafe(super(MPSNNFilterNode, NSObject))]
10385    #[derive(Debug, PartialEq, Eq, Hash)]
10386    pub struct MPSNNInitialGradientNode;
10387);
10388
10389extern_conformance!(
10390    unsafe impl NSObjectProtocol for MPSNNInitialGradientNode {}
10391);
10392
10393impl MPSNNInitialGradientNode {
10394    extern_methods!(
10395        /// Init a node representing a MPSNNInitialGradient MPSNNPad kernel
10396        ///
10397        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
10398        ///
10399        /// Returns: A new MPSNNFilter node for a MPSNNInitialGradient kernel.
10400        #[unsafe(method(nodeWithSource:))]
10401        #[unsafe(method_family = none)]
10402        pub unsafe fn nodeWithSource(source: &MPSNNImageNode) -> Retained<Self>;
10403
10404        /// Init a node representing a MPSNNInitialGradient MPSNNPad kernel
10405        ///
10406        /// Parameter `source`: The MPSNNImageNode representing the source MPSImage for the filter
10407        ///
10408        /// Returns: A new MPSNNFilter node for a MPSNNInitialGradient kernel.
10409        #[unsafe(method(initWithSource:))]
10410        #[unsafe(method_family = init)]
10411        pub unsafe fn initWithSource(
10412            this: Allocated<Self>,
10413            source: &MPSNNImageNode,
10414        ) -> Retained<Self>;
10415
10416        /// The initial gradient filter is a gradient filter and we don't provide support for gradients of gradients currently.
10417        #[unsafe(method(gradientFilterWithSources:))]
10418        #[unsafe(method_family = none)]
10419        pub unsafe fn gradientFilterWithSources(
10420            &self,
10421            gradient_images: &NSArray<MPSNNImageNode>,
10422        ) -> Retained<MPSNNGradientFilterNode>;
10423    );
10424}
10425
10426/// Methods declared on superclass `MPSNNFilterNode`.
10427impl MPSNNInitialGradientNode {
10428    extern_methods!(
10429        #[unsafe(method(init))]
10430        #[unsafe(method_family = init)]
10431        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
10432    );
10433}
10434
10435/// Methods declared on superclass `NSObject`.
10436impl MPSNNInitialGradientNode {
10437    extern_methods!(
10438        #[unsafe(method(new))]
10439        #[unsafe(method_family = new)]
10440        pub unsafe fn new() -> Retained<Self>;
10441    );
10442}