objc2_metal_performance_shaders/generated/MPSNeuralNetwork/
MPSCNNNeuron.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_class!(
12    /// Dependencies: This depends on Metal.framework
13    ///
14    /// The MPSNNNeuronDescriptor specifies a neuron descriptor.
15    /// Supported neuron types:
16    ///
17    /// Neuron type "none": f(x) = x
18    /// Parameters: none
19    ///
20    /// ReLU neuron filter: f(x) = x >= 0 ? x : a * x
21    /// This is called Leaky ReLU in literature. Some literature defines
22    /// classical ReLU as max(0, x). If you want this behavior, simply pass a = 0.
23    /// Parameters: a
24    /// For default behavior, set the value of a to 0.0f.
25    ///
26    /// Linear neuron filter: f(x) = a * x + b
27    /// Parameters: a, b
28    /// For default behavior, set the value of a to 1.0f and the value of b to 0.0f.
29    ///
30    /// Sigmoid neuron filter: f(x) = 1 / (1 + e^-x)
31    /// Parameters: none
32    ///
33    /// Hard Sigmoid filter: f(x) = clamp((x * a) + b, 0, 1)
34    /// Parameters: a, b
35    /// For default behavior, set the value of a to 0.2f and the value of b to 0.5f.
36    ///
37    /// Hyperbolic tangent (TanH) neuron filter: f(x) = a * tanh(b * x)
38    /// Parameters: a, b
39    /// For default behavior, set the value of a to 1.0f and the value of b to 1.0f.
40    ///
41    /// Absolute neuron filter: f(x) = fabs(x)
42    /// Parameters: none
43    ///
44    /// Parametric Soft Plus neuron filter: f(x) = a * log(1 + e^(b * x))
45    /// Parameters: a, b
46    /// For default behavior, set the value of a to 1.0f and the value of b to 1.0f.
47    ///
48    /// Parametric Soft Sign neuron filter: f(x) = x / (1 + abs(x))
49    /// Parameters: none
50    ///
51    /// Parametric ELU neuron filter: f(x) = x >= 0 ? x : a * (exp(x) - 1)
52    /// Parameters: a
53    /// For default behavior, set the value of a to 1.0f.
54    ///
55    /// Parametric ReLU (PReLU) neuron filter: Same as ReLU, except parameter
56    /// aArray is per channel.
57    /// For each pixel, applies the following function: f(x_i) = x_i, if x_i >= 0
58    /// = a_i * x_i if x_i
59    /// <
60    /// 0
61    /// i in [0...channels-1]
62    /// i.e. parameters a_i are learned and applied to each channel separately. Compare
63    /// this to ReLu where parameter a is shared across all channels.
64    /// See https://arxiv.org/pdf/1502.01852.pdf for details.
65    /// Parameters: aArray - Array of floats containing per channel value of PReLu parameter
66    /// count - Number of float values in array aArray.
67    ///
68    /// ReLUN neuron filter: f(x) = min((x >= 0 ? x : a * x), b)
69    /// Parameters: a, b
70    /// As an example, the TensorFlow Relu6 activation layer can be implemented
71    /// by setting the parameter b to 6.0f:
72    /// https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/relu6.
73    /// For default behavior, set the value of a to 1.0f and the value of b to 6.0f.
74    ///
75    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpsnnneurondescriptor?language=objc)
76    #[unsafe(super(NSObject))]
77    #[derive(Debug, PartialEq, Eq, Hash)]
78    pub struct MPSNNNeuronDescriptor;
79);
80
81extern_conformance!(
82    unsafe impl NSCoding for MPSNNNeuronDescriptor {}
83);
84
85extern_conformance!(
86    unsafe impl NSCopying for MPSNNNeuronDescriptor {}
87);
88
89unsafe impl CopyingHelper for MPSNNNeuronDescriptor {
90    type Result = Self;
91}
92
93extern_conformance!(
94    unsafe impl NSObjectProtocol for MPSNNNeuronDescriptor {}
95);
96
97extern_conformance!(
98    unsafe impl NSSecureCoding for MPSNNNeuronDescriptor {}
99);
100
101impl MPSNNNeuronDescriptor {
102    extern_methods!(
103        #[cfg(feature = "MPSCNNNeuronType")]
104        #[unsafe(method(neuronType))]
105        #[unsafe(method_family = none)]
106        pub unsafe fn neuronType(&self) -> MPSCNNNeuronType;
107
108        #[cfg(feature = "MPSCNNNeuronType")]
109        /// Setter for [`neuronType`][Self::neuronType].
110        #[unsafe(method(setNeuronType:))]
111        #[unsafe(method_family = none)]
112        pub unsafe fn setNeuronType(&self, neuron_type: MPSCNNNeuronType);
113
114        #[unsafe(method(a))]
115        #[unsafe(method_family = none)]
116        pub unsafe fn a(&self) -> c_float;
117
118        /// Setter for [`a`][Self::a].
119        #[unsafe(method(setA:))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn setA(&self, a: c_float);
122
123        #[unsafe(method(b))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn b(&self) -> c_float;
126
127        /// Setter for [`b`][Self::b].
128        #[unsafe(method(setB:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setB(&self, b: c_float);
131
132        #[unsafe(method(c))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn c(&self) -> c_float;
135
136        /// Setter for [`c`][Self::c].
137        #[unsafe(method(setC:))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn setC(&self, c: c_float);
140
141        #[unsafe(method(data))]
142        #[unsafe(method_family = none)]
143        pub unsafe fn data(&self) -> Option<Retained<NSData>>;
144
145        /// Setter for [`data`][Self::data].
146        #[unsafe(method(setData:))]
147        #[unsafe(method_family = none)]
148        pub unsafe fn setData(&self, data: Option<&NSData>);
149
150        /// You must use one of the interfaces below instead.
151        #[unsafe(method(init))]
152        #[unsafe(method_family = init)]
153        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
154
155        #[cfg(feature = "MPSCNNNeuronType")]
156        /// Make a descriptor for a MPSCNNNeuron object.
157        ///
158        /// Parameter `neuronType`: The type of a neuron filter.
159        ///
160        /// Returns: A valid MPSNNNeuronDescriptor object or nil, if failure.
161        #[unsafe(method(cnnNeuronDescriptorWithType:))]
162        #[unsafe(method_family = none)]
163        pub unsafe fn cnnNeuronDescriptorWithType(
164            neuron_type: MPSCNNNeuronType,
165        ) -> Retained<MPSNNNeuronDescriptor>;
166
167        #[cfg(feature = "MPSCNNNeuronType")]
168        /// Make a descriptor for a MPSCNNNeuron object.
169        ///
170        /// Parameter `neuronType`: The type of a neuron filter.
171        ///
172        /// Parameter `a`: Parameter "a".
173        ///
174        /// Returns: A valid MPSNNNeuronDescriptor object or nil, if failure.
175        #[unsafe(method(cnnNeuronDescriptorWithType:a:))]
176        #[unsafe(method_family = none)]
177        pub unsafe fn cnnNeuronDescriptorWithType_a(
178            neuron_type: MPSCNNNeuronType,
179            a: c_float,
180        ) -> Retained<MPSNNNeuronDescriptor>;
181
182        #[cfg(feature = "MPSCNNNeuronType")]
183        /// Initialize the neuron descriptor.
184        ///
185        /// Parameter `neuronType`: The type of a neuron filter.
186        ///
187        /// Parameter `a`: Parameter "a".
188        ///
189        /// Parameter `b`: Parameter "b".
190        ///
191        /// Returns: A valid MPSNNNeuronDescriptor object or nil, if failure.
192        #[unsafe(method(cnnNeuronDescriptorWithType:a:b:))]
193        #[unsafe(method_family = none)]
194        pub unsafe fn cnnNeuronDescriptorWithType_a_b(
195            neuron_type: MPSCNNNeuronType,
196            a: c_float,
197            b: c_float,
198        ) -> Retained<MPSNNNeuronDescriptor>;
199
200        #[cfg(feature = "MPSCNNNeuronType")]
201        /// Make a descriptor for a MPSCNNNeuron object.
202        ///
203        /// Parameter `neuronType`: The type of a neuron filter.
204        ///
205        /// Parameter `a`: Parameter "a".
206        ///
207        /// Parameter `b`: Parameter "b".
208        ///
209        /// Parameter `c`: Parameter "c".
210        ///
211        /// Returns: A valid MPSNNNeuronDescriptor object or nil, if failure.
212        #[unsafe(method(cnnNeuronDescriptorWithType:a:b:c:))]
213        #[unsafe(method_family = none)]
214        pub unsafe fn cnnNeuronDescriptorWithType_a_b_c(
215            neuron_type: MPSCNNNeuronType,
216            a: c_float,
217            b: c_float,
218            c: c_float,
219        ) -> Retained<MPSNNNeuronDescriptor>;
220
221        /// Make a descriptor for a neuron of type MPSCNNNeuronTypePReLU.
222        ///
223        /// The PReLU neuron is the same as a ReLU neuron, except parameter "a" is per feature channel.
224        ///
225        /// Parameter `data`: A NSData containing a float array with the per feature channel value
226        /// of PReLu parameter. The number of float values in this array usually
227        /// corresponds to number of output channels in a convolution layer.
228        /// The descriptor retains the NSData object.
229        ///
230        /// Parameter `noCopy`: An optimization flag that tells us whether the NSData allocation is
231        /// suitable for use directly with no copying of the data into internal
232        /// storage. This allocation has to match the same restrictions as listed
233        /// for the newBufferWithBytesNoCopy:length:options:deallocator: method of
234        /// MTLBuffer.
235        ///
236        /// Returns: A valid MPSNNNeuronDescriptor object for a neuron of type MPSCNNNeuronTypePReLU or nil, if failure
237        #[unsafe(method(cnnNeuronPReLUDescriptorWithData:noCopy:))]
238        #[unsafe(method_family = none)]
239        pub unsafe fn cnnNeuronPReLUDescriptorWithData_noCopy(
240            data: &NSData,
241            no_copy: bool,
242        ) -> Retained<MPSNNNeuronDescriptor>;
243    );
244}
245
246/// Methods declared on superclass `NSObject`.
247impl MPSNNNeuronDescriptor {
248    extern_methods!(
249        #[unsafe(method(new))]
250        #[unsafe(method_family = new)]
251        pub unsafe fn new() -> Retained<Self>;
252    );
253}
254
255extern_class!(
256    /// Dependencies: This depends on Metal.framework
257    ///
258    /// This filter applies a neuron activation function.
259    /// You must use one of the sub-classes of MPSCNNNeuron.
260    ///
261    /// The following filter types are supported:
262    /// MPSCNNNeuronTypeNone            ///
263    /// <
264    /// f(x) = x
265    /// MPSCNNNeuronTypeLinear          ///
266    /// <
267    /// f(x) = a * x + b
268    /// MPSCNNNeuronTypeReLU            ///
269    /// <
270    /// f(x) = x >= 0 ? x : a * x
271    /// MPSCNNNeuronTypeSigmoid         ///
272    /// <
273    /// f(x) = 1 / (1 + e^-x)
274    /// MPSCNNNeuronTypeHardSigmoid     ///
275    /// <
276    /// f(x) = clamp((x * a) + b, 0, 1)
277    /// MPSCNNNeuronTypeTanH            ///
278    /// <
279    /// f(x) = a * tanh(b * x)
280    /// MPSCNNNeuronTypeAbsolute        ///
281    /// <
282    /// f(x) = fabs(x)
283    /// MPSCNNNeuronTypeSoftPlus        ///
284    /// <
285    /// f(x) = a * log(1 + e^(b * x))
286    /// MPSCNNNeuronTypeSoftSign        ///
287    /// <
288    /// f(x) = x / (1 + abs(x))
289    /// MPSCNNNeuronTypeELU             ///
290    /// <
291    /// f(x) = x >= 0 ? x : a * (exp(x) - 1)
292    /// MPSCNNNeuronTypePReLU           ///
293    /// <
294    /// Same as ReLU except parameter a is per channel
295    /// MPSCNNNeuronTypeReLUN           ///
296    /// <
297    /// f(x) = min((x >= 0 ? x : a * x), b)
298    /// MPSCNNNeuronTypePower           ///
299    /// <
300    /// f(x) = (a * x + b) ^ c
301    /// MPSCNNNeuronTypeExponential     ///
302    /// <
303    /// f(x) = c ^ (a * x + b)
304    /// MPSCNNNeuronTypeLogarithm       ///
305    /// <
306    /// f(x) = log_c(a * x + b)
307    /// MPSCNNNeuronTypeGeLU            ///
308    /// <
309    /// f(x) = (1.0 + erf(x * sqrt(0.5))) * 0.5 * x
310    ///
311    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuron?language=objc)
312    #[unsafe(super(MPSCNNKernel, MPSKernel, NSObject))]
313    #[derive(Debug, PartialEq, Eq, Hash)]
314    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
315    pub struct MPSCNNNeuron;
316);
317
318#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
319extern_conformance!(
320    unsafe impl NSCoding for MPSCNNNeuron {}
321);
322
323#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
324extern_conformance!(
325    unsafe impl NSCopying for MPSCNNNeuron {}
326);
327
328#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
329unsafe impl CopyingHelper for MPSCNNNeuron {
330    type Result = Self;
331}
332
333#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
334extern_conformance!(
335    unsafe impl NSObjectProtocol for MPSCNNNeuron {}
336);
337
338#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
339extern_conformance!(
340    unsafe impl NSSecureCoding for MPSCNNNeuron {}
341);
342
343#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
344impl MPSCNNNeuron {
345    extern_methods!(
346        #[cfg(feature = "MPSCNNNeuronType")]
347        #[unsafe(method(neuronType))]
348        #[unsafe(method_family = none)]
349        pub unsafe fn neuronType(&self) -> MPSCNNNeuronType;
350
351        #[unsafe(method(a))]
352        #[unsafe(method_family = none)]
353        pub unsafe fn a(&self) -> c_float;
354
355        #[unsafe(method(b))]
356        #[unsafe(method_family = none)]
357        pub unsafe fn b(&self) -> c_float;
358
359        #[unsafe(method(c))]
360        #[unsafe(method_family = none)]
361        pub unsafe fn c(&self) -> c_float;
362
363        #[unsafe(method(data))]
364        #[unsafe(method_family = none)]
365        pub unsafe fn data(&self) -> Option<Retained<NSData>>;
366
367        #[unsafe(method(initWithDevice:))]
368        #[unsafe(method_family = init)]
369        pub unsafe fn initWithDevice(
370            this: Allocated<Self>,
371            device: &ProtocolObject<dyn MTLDevice>,
372        ) -> Retained<Self>;
373
374        /// Initialize the neuron filter with a neuron descriptor.
375        ///
376        /// Parameter `device`: The device the filter will run on.
377        ///
378        /// Parameter `neuronDescriptor`: The neuron descriptor.
379        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
380        /// descriptor references an NSData object containing a float array
381        /// with the per feature channel value of PReLu parameter and, in this
382        /// case, the MPSCNNNeuron retains the NSData object.
383        ///
384        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
385        #[unsafe(method(initWithDevice:neuronDescriptor:))]
386        #[unsafe(method_family = init)]
387        pub unsafe fn initWithDevice_neuronDescriptor(
388            this: Allocated<Self>,
389            device: &ProtocolObject<dyn MTLDevice>,
390            neuron_descriptor: &MPSNNNeuronDescriptor,
391        ) -> Retained<Self>;
392
393        /// NSSecureCoding compatability
394        ///
395        /// While the standard NSSecureCoding/NSCoding method
396        /// -initWithCoder: should work, since the file can't
397        /// know which device your data is allocated on, we
398        /// have to guess and may guess incorrectly.  To avoid
399        /// that problem, use initWithCoder:device instead.
400        ///
401        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
402        ///
403        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
404        ///
405        /// Returns: A new MPSKernel object, or nil if failure.
406        ///
407        /// # Safety
408        ///
409        /// `a_decoder` possibly has further requirements.
410        #[unsafe(method(initWithCoder:device:))]
411        #[unsafe(method_family = init)]
412        pub unsafe fn initWithCoder_device(
413            this: Allocated<Self>,
414            a_decoder: &NSCoder,
415            device: &ProtocolObject<dyn MTLDevice>,
416        ) -> Option<Retained<Self>>;
417    );
418}
419
420/// Methods declared on superclass `MPSKernel`.
421#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
422impl MPSCNNNeuron {
423    extern_methods!(
424        /// Called by NSCoder to decode MPSKernels
425        ///
426        /// This isn't the right interface to decode a MPSKernel, but
427        /// it is the one that NSCoder uses. To enable your NSCoder
428        /// (e.g. NSKeyedUnarchiver) to set which device to use
429        /// extend the object to adopt the MPSDeviceProvider
430        /// protocol. Otherwise, the Metal system default device
431        /// will be used.
432        ///
433        /// # Safety
434        ///
435        /// `a_decoder` possibly has further requirements.
436        #[unsafe(method(initWithCoder:))]
437        #[unsafe(method_family = init)]
438        pub unsafe fn initWithCoder(
439            this: Allocated<Self>,
440            a_decoder: &NSCoder,
441        ) -> Option<Retained<Self>>;
442    );
443}
444
445/// Methods declared on superclass `NSObject`.
446#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
447impl MPSCNNNeuron {
448    extern_methods!(
449        #[unsafe(method(init))]
450        #[unsafe(method_family = init)]
451        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
452
453        #[unsafe(method(new))]
454        #[unsafe(method_family = new)]
455        pub unsafe fn new() -> Retained<Self>;
456    );
457}
458
459extern_class!(
460    /// Dependencies: This depends on Metal.framework
461    ///
462    /// This filter is a backward filter for the neuron activation function filter.
463    ///
464    /// The following filter types are supported:
465    /// MPSCNNNeuronTypeNone            ///
466    /// <
467    /// df/dx = 1
468    /// MPSCNNNeuronTypeLinear          ///
469    /// <
470    /// df/dx = a
471    /// MPSCNNNeuronTypeReLU            ///
472    /// <
473    /// df/dx = [ 1, if x >= 0
474    /// [ a, if x
475    /// <
476    /// 0
477    /// MPSCNNNeuronTypeSigmoid         ///
478    /// <
479    /// df/dx = e^x / (e^x + 1)^2
480    /// MPSCNNNeuronTypeHardSigmoid     ///
481    /// <
482    /// df/dx = [ a, if ((x * a) + b >= 0) and ((x * a) + b
483    /// <
484    /// = 1)
485    /// [ 0, otherwise
486    /// MPSCNNNeuronTypeTanH            ///
487    /// <
488    /// df/dx = a * b * (1 - tanh^2(b * x))
489    /// MPSCNNNeuronTypeAbsolute        ///
490    /// <
491    /// df/dx = sign(x)
492    /// MPSCNNNeuronTypeSoftPlus        ///
493    /// <
494    /// df/dx = (a * b * exp(b * x)) / (exp(b * x) + 1)
495    /// MPSCNNNeuronTypeSoftSign        ///
496    /// <
497    /// df/dx = 1 / (|x| + 1)^2
498    /// MPSCNNNeuronTypeELU             ///
499    /// <
500    /// df/dx = [ a * exp(x), x
501    /// <
502    /// 0
503    /// [          1, x >= 0
504    /// MPSCNNNeuronTypePReLU           ///
505    /// <
506    /// df/dx = [  1, if x >= 0
507    /// [ aV, if x
508    /// <
509    /// 0
510    /// MPSCNNNeuronTypeReLUN           ///
511    /// <
512    /// df/dx = [ 1, if x >= 0
513    /// [ a, if x
514    /// <
515    /// 0
516    /// [ b, if x >= b
517    /// MPSCNNNeuronTypePower           ///
518    /// <
519    /// df/dx = a * c * (a * x + b)^(c - 1)
520    /// MPSCNNNeuronTypeExponential     ///
521    /// <
522    /// df/dx = [         a * exp(a * x + b), if c == -1
523    /// [ a * log(c) * c^(a * x + b), if c != -1
524    /// MPSCNNNeuronTypeLogarithm       ///
525    /// <
526    /// df/dx = [            a / (a * in + b), if c == -1
527    /// [ a / (log(c) * (a * in + b)), if c != -1
528    /// MPSCNNNeuronTypeGeLU            ///
529    /// <
530    /// df/dx = 0.5 * (1.0 + erf(x * sqrt(0.5))) + (sqrt(0.5) * M_2_SQRTPI * exp(-x*x * 0.5) * x) )
531    ///
532    /// The result of the above operation is multiplied with the gradient, computed
533    /// by the preceeding filter (going backwards).
534    ///
535    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneurongradient?language=objc)
536    #[unsafe(super(MPSCNNGradientKernel, MPSCNNBinaryKernel, MPSKernel, NSObject))]
537    #[derive(Debug, PartialEq, Eq, Hash)]
538    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
539    pub struct MPSCNNNeuronGradient;
540);
541
542#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
543extern_conformance!(
544    unsafe impl NSCoding for MPSCNNNeuronGradient {}
545);
546
547#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
548extern_conformance!(
549    unsafe impl NSCopying for MPSCNNNeuronGradient {}
550);
551
552#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
553unsafe impl CopyingHelper for MPSCNNNeuronGradient {
554    type Result = Self;
555}
556
557#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
558extern_conformance!(
559    unsafe impl NSObjectProtocol for MPSCNNNeuronGradient {}
560);
561
562#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
563extern_conformance!(
564    unsafe impl NSSecureCoding for MPSCNNNeuronGradient {}
565);
566
567#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
568impl MPSCNNNeuronGradient {
569    extern_methods!(
570        #[cfg(feature = "MPSCNNNeuronType")]
571        #[unsafe(method(neuronType))]
572        #[unsafe(method_family = none)]
573        pub unsafe fn neuronType(&self) -> MPSCNNNeuronType;
574
575        #[unsafe(method(a))]
576        #[unsafe(method_family = none)]
577        pub unsafe fn a(&self) -> c_float;
578
579        #[unsafe(method(b))]
580        #[unsafe(method_family = none)]
581        pub unsafe fn b(&self) -> c_float;
582
583        #[unsafe(method(c))]
584        #[unsafe(method_family = none)]
585        pub unsafe fn c(&self) -> c_float;
586
587        #[unsafe(method(data))]
588        #[unsafe(method_family = none)]
589        pub unsafe fn data(&self) -> Option<Retained<NSData>>;
590
591        #[unsafe(method(initWithDevice:))]
592        #[unsafe(method_family = init)]
593        pub unsafe fn initWithDevice(
594            this: Allocated<Self>,
595            device: &ProtocolObject<dyn MTLDevice>,
596        ) -> Retained<Self>;
597
598        /// Initialize the neuron gradient filter with a neuron descriptor.
599        ///
600        /// Parameter `device`: The device the filter will run on.
601        ///
602        /// Parameter `neuronDescriptor`: The neuron descriptor.
603        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
604        /// descriptor references an NSData object containing a float array
605        /// with the per feature channel value of PReLu parameter and, in this
606        /// case, the MPSCNNNeuronGradient retains the NSData object.
607        ///
608        /// Returns: A valid MPSCNNNeuronGradient object or nil, if failure.
609        #[unsafe(method(initWithDevice:neuronDescriptor:))]
610        #[unsafe(method_family = init)]
611        pub unsafe fn initWithDevice_neuronDescriptor(
612            this: Allocated<Self>,
613            device: &ProtocolObject<dyn MTLDevice>,
614            neuron_descriptor: &MPSNNNeuronDescriptor,
615        ) -> Retained<Self>;
616
617        /// NSSecureCoding compatability
618        ///
619        /// While the standard NSSecureCoding/NSCoding method
620        /// -initWithCoder: should work, since the file can't
621        /// know which device your data is allocated on, we
622        /// have to guess and may guess incorrectly.  To avoid
623        /// that problem, use initWithCoder:device instead.
624        ///
625        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
626        ///
627        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
628        ///
629        /// Returns: A new MPSKernel object, or nil if failure.
630        ///
631        /// # Safety
632        ///
633        /// `a_decoder` possibly has further requirements.
634        #[unsafe(method(initWithCoder:device:))]
635        #[unsafe(method_family = init)]
636        pub unsafe fn initWithCoder_device(
637            this: Allocated<Self>,
638            a_decoder: &NSCoder,
639            device: &ProtocolObject<dyn MTLDevice>,
640        ) -> Option<Retained<Self>>;
641    );
642}
643
644/// Methods declared on superclass `MPSKernel`.
645#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
646impl MPSCNNNeuronGradient {
647    extern_methods!(
648        /// Called by NSCoder to decode MPSKernels
649        ///
650        /// This isn't the right interface to decode a MPSKernel, but
651        /// it is the one that NSCoder uses. To enable your NSCoder
652        /// (e.g. NSKeyedUnarchiver) to set which device to use
653        /// extend the object to adopt the MPSDeviceProvider
654        /// protocol. Otherwise, the Metal system default device
655        /// will be used.
656        ///
657        /// # Safety
658        ///
659        /// `a_decoder` possibly has further requirements.
660        #[unsafe(method(initWithCoder:))]
661        #[unsafe(method_family = init)]
662        pub unsafe fn initWithCoder(
663            this: Allocated<Self>,
664            a_decoder: &NSCoder,
665        ) -> Option<Retained<Self>>;
666    );
667}
668
669/// Methods declared on superclass `NSObject`.
670#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
671impl MPSCNNNeuronGradient {
672    extern_methods!(
673        #[unsafe(method(init))]
674        #[unsafe(method_family = init)]
675        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
676
677        #[unsafe(method(new))]
678        #[unsafe(method_family = new)]
679        pub unsafe fn new() -> Retained<Self>;
680    );
681}
682
683extern_class!(
684    /// Dependencies: This depends on Metal.framework
685    ///
686    /// Specifies the linear neuron filter. For each pixel, applies the following function: f(x) = a * x + b
687    ///
688    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronlinear?language=objc)
689    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
690    #[derive(Debug, PartialEq, Eq, Hash)]
691    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
692    pub struct MPSCNNNeuronLinear;
693);
694
695#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
696extern_conformance!(
697    unsafe impl NSCoding for MPSCNNNeuronLinear {}
698);
699
700#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
701extern_conformance!(
702    unsafe impl NSCopying for MPSCNNNeuronLinear {}
703);
704
705#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
706unsafe impl CopyingHelper for MPSCNNNeuronLinear {
707    type Result = Self;
708}
709
710#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
711extern_conformance!(
712    unsafe impl NSObjectProtocol for MPSCNNNeuronLinear {}
713);
714
715#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
716extern_conformance!(
717    unsafe impl NSSecureCoding for MPSCNNNeuronLinear {}
718);
719
720#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
721impl MPSCNNNeuronLinear {
722    extern_methods!(
723        /// Initialize the linear neuron filter
724        ///
725        /// Parameter `device`: The device the filter will run on
726        ///
727        /// Parameter `a`: Filter property "a". See class discussion.
728        ///
729        /// Parameter `b`: Filter property "b". See class discussion.
730        ///
731        /// Returns: A valid MPSCNNNeuronLinear object or nil, if failure.
732        #[deprecated]
733        #[unsafe(method(initWithDevice:a:b:))]
734        #[unsafe(method_family = init)]
735        pub unsafe fn initWithDevice_a_b(
736            this: Allocated<Self>,
737            device: &ProtocolObject<dyn MTLDevice>,
738            a: c_float,
739            b: c_float,
740        ) -> Retained<Self>;
741
742        #[unsafe(method(initWithDevice:))]
743        #[unsafe(method_family = init)]
744        pub unsafe fn initWithDevice(
745            this: Allocated<Self>,
746            device: &ProtocolObject<dyn MTLDevice>,
747        ) -> Retained<Self>;
748    );
749}
750
751/// Methods declared on superclass `MPSCNNNeuron`.
752#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
753impl MPSCNNNeuronLinear {
754    extern_methods!(
755        /// Initialize the neuron filter with a neuron descriptor.
756        ///
757        /// Parameter `device`: The device the filter will run on.
758        ///
759        /// Parameter `neuronDescriptor`: The neuron descriptor.
760        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
761        /// descriptor references an NSData object containing a float array
762        /// with the per feature channel value of PReLu parameter and, in this
763        /// case, the MPSCNNNeuron retains the NSData object.
764        ///
765        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
766        #[unsafe(method(initWithDevice:neuronDescriptor:))]
767        #[unsafe(method_family = init)]
768        pub unsafe fn initWithDevice_neuronDescriptor(
769            this: Allocated<Self>,
770            device: &ProtocolObject<dyn MTLDevice>,
771            neuron_descriptor: &MPSNNNeuronDescriptor,
772        ) -> Retained<Self>;
773
774        /// NSSecureCoding compatability
775        ///
776        /// While the standard NSSecureCoding/NSCoding method
777        /// -initWithCoder: should work, since the file can't
778        /// know which device your data is allocated on, we
779        /// have to guess and may guess incorrectly.  To avoid
780        /// that problem, use initWithCoder:device instead.
781        ///
782        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
783        ///
784        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
785        ///
786        /// Returns: A new MPSKernel object, or nil if failure.
787        ///
788        /// # Safety
789        ///
790        /// `a_decoder` possibly has further requirements.
791        #[unsafe(method(initWithCoder:device:))]
792        #[unsafe(method_family = init)]
793        pub unsafe fn initWithCoder_device(
794            this: Allocated<Self>,
795            a_decoder: &NSCoder,
796            device: &ProtocolObject<dyn MTLDevice>,
797        ) -> Option<Retained<Self>>;
798    );
799}
800
801/// Methods declared on superclass `MPSKernel`.
802#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
803impl MPSCNNNeuronLinear {
804    extern_methods!(
805        /// Called by NSCoder to decode MPSKernels
806        ///
807        /// This isn't the right interface to decode a MPSKernel, but
808        /// it is the one that NSCoder uses. To enable your NSCoder
809        /// (e.g. NSKeyedUnarchiver) to set which device to use
810        /// extend the object to adopt the MPSDeviceProvider
811        /// protocol. Otherwise, the Metal system default device
812        /// will be used.
813        ///
814        /// # Safety
815        ///
816        /// `a_decoder` possibly has further requirements.
817        #[unsafe(method(initWithCoder:))]
818        #[unsafe(method_family = init)]
819        pub unsafe fn initWithCoder(
820            this: Allocated<Self>,
821            a_decoder: &NSCoder,
822        ) -> Option<Retained<Self>>;
823    );
824}
825
826/// Methods declared on superclass `NSObject`.
827#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
828impl MPSCNNNeuronLinear {
829    extern_methods!(
830        #[unsafe(method(init))]
831        #[unsafe(method_family = init)]
832        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
833
834        #[unsafe(method(new))]
835        #[unsafe(method_family = new)]
836        pub unsafe fn new() -> Retained<Self>;
837    );
838}
839
840extern_class!(
841    /// Dependencies: This depends on Metal.framework
842    ///
843    /// Specifies the ReLU neuron filter.
844    /// For each pixel, applies the following function: f(x) = x, if x >= 0
845    /// = a * x if x
846    /// <
847    /// 0
848    /// This is called Leaky ReLU in literature. Some literature defines
849    /// classical ReLU as max(0, x). If you want this behavior, simply pass a = 0
850    ///
851    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronrelu?language=objc)
852    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
853    #[derive(Debug, PartialEq, Eq, Hash)]
854    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
855    pub struct MPSCNNNeuronReLU;
856);
857
858#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
859extern_conformance!(
860    unsafe impl NSCoding for MPSCNNNeuronReLU {}
861);
862
863#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
864extern_conformance!(
865    unsafe impl NSCopying for MPSCNNNeuronReLU {}
866);
867
868#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
869unsafe impl CopyingHelper for MPSCNNNeuronReLU {
870    type Result = Self;
871}
872
873#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
874extern_conformance!(
875    unsafe impl NSObjectProtocol for MPSCNNNeuronReLU {}
876);
877
878#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
879extern_conformance!(
880    unsafe impl NSSecureCoding for MPSCNNNeuronReLU {}
881);
882
883#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
884impl MPSCNNNeuronReLU {
885    extern_methods!(
886        /// Initialize the ReLU neuron filter
887        ///
888        /// Parameter `device`: The device the filter will run on
889        ///
890        /// Parameter `a`: Filter property "a". See class discussion.
891        ///
892        /// Returns: A valid MPSCNNNeuronReLU object or nil, if failure.
893        #[deprecated]
894        #[unsafe(method(initWithDevice:a:))]
895        #[unsafe(method_family = init)]
896        pub unsafe fn initWithDevice_a(
897            this: Allocated<Self>,
898            device: &ProtocolObject<dyn MTLDevice>,
899            a: c_float,
900        ) -> Retained<Self>;
901
902        #[unsafe(method(initWithDevice:))]
903        #[unsafe(method_family = init)]
904        pub unsafe fn initWithDevice(
905            this: Allocated<Self>,
906            device: &ProtocolObject<dyn MTLDevice>,
907        ) -> Retained<Self>;
908    );
909}
910
911/// Methods declared on superclass `MPSCNNNeuron`.
912#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
913impl MPSCNNNeuronReLU {
914    extern_methods!(
915        /// Initialize the neuron filter with a neuron descriptor.
916        ///
917        /// Parameter `device`: The device the filter will run on.
918        ///
919        /// Parameter `neuronDescriptor`: The neuron descriptor.
920        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
921        /// descriptor references an NSData object containing a float array
922        /// with the per feature channel value of PReLu parameter and, in this
923        /// case, the MPSCNNNeuron retains the NSData object.
924        ///
925        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
926        #[unsafe(method(initWithDevice:neuronDescriptor:))]
927        #[unsafe(method_family = init)]
928        pub unsafe fn initWithDevice_neuronDescriptor(
929            this: Allocated<Self>,
930            device: &ProtocolObject<dyn MTLDevice>,
931            neuron_descriptor: &MPSNNNeuronDescriptor,
932        ) -> Retained<Self>;
933
934        /// NSSecureCoding compatability
935        ///
936        /// While the standard NSSecureCoding/NSCoding method
937        /// -initWithCoder: should work, since the file can't
938        /// know which device your data is allocated on, we
939        /// have to guess and may guess incorrectly.  To avoid
940        /// that problem, use initWithCoder:device instead.
941        ///
942        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
943        ///
944        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
945        ///
946        /// Returns: A new MPSKernel object, or nil if failure.
947        ///
948        /// # Safety
949        ///
950        /// `a_decoder` possibly has further requirements.
951        #[unsafe(method(initWithCoder:device:))]
952        #[unsafe(method_family = init)]
953        pub unsafe fn initWithCoder_device(
954            this: Allocated<Self>,
955            a_decoder: &NSCoder,
956            device: &ProtocolObject<dyn MTLDevice>,
957        ) -> Option<Retained<Self>>;
958    );
959}
960
961/// Methods declared on superclass `MPSKernel`.
962#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
963impl MPSCNNNeuronReLU {
964    extern_methods!(
965        /// Called by NSCoder to decode MPSKernels
966        ///
967        /// This isn't the right interface to decode a MPSKernel, but
968        /// it is the one that NSCoder uses. To enable your NSCoder
969        /// (e.g. NSKeyedUnarchiver) to set which device to use
970        /// extend the object to adopt the MPSDeviceProvider
971        /// protocol. Otherwise, the Metal system default device
972        /// will be used.
973        ///
974        /// # Safety
975        ///
976        /// `a_decoder` possibly has further requirements.
977        #[unsafe(method(initWithCoder:))]
978        #[unsafe(method_family = init)]
979        pub unsafe fn initWithCoder(
980            this: Allocated<Self>,
981            a_decoder: &NSCoder,
982        ) -> Option<Retained<Self>>;
983    );
984}
985
986/// Methods declared on superclass `NSObject`.
987#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
988impl MPSCNNNeuronReLU {
989    extern_methods!(
990        #[unsafe(method(init))]
991        #[unsafe(method_family = init)]
992        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
993
994        #[unsafe(method(new))]
995        #[unsafe(method_family = new)]
996        pub unsafe fn new() -> Retained<Self>;
997    );
998}
999
1000extern_class!(
1001    /// Dependencies: This depends on Metal.framework
1002    ///
1003    /// Specifies the parametric ReLU neuron filter.
1004    /// For each pixel, applies the following function: f(x_i) = x_i, if x_i >= 0
1005    /// = a_i * x_i if x_i
1006    /// <
1007    /// 0
1008    /// i in [0...channels-1]
1009    /// i.e. parameters a_i are learned and applied to each channel separately. Compare
1010    /// this to ReLu where parameter a is shared across all channels.
1011    /// See https://arxiv.org/pdf/1502.01852.pdf for details.
1012    ///
1013    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronprelu?language=objc)
1014    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1015    #[derive(Debug, PartialEq, Eq, Hash)]
1016    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1017    pub struct MPSCNNNeuronPReLU;
1018);
1019
1020#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1021extern_conformance!(
1022    unsafe impl NSCoding for MPSCNNNeuronPReLU {}
1023);
1024
1025#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1026extern_conformance!(
1027    unsafe impl NSCopying for MPSCNNNeuronPReLU {}
1028);
1029
1030#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1031unsafe impl CopyingHelper for MPSCNNNeuronPReLU {
1032    type Result = Self;
1033}
1034
1035#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1036extern_conformance!(
1037    unsafe impl NSObjectProtocol for MPSCNNNeuronPReLU {}
1038);
1039
1040#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1041extern_conformance!(
1042    unsafe impl NSSecureCoding for MPSCNNNeuronPReLU {}
1043);
1044
1045#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1046impl MPSCNNNeuronPReLU {
1047    extern_methods!(
1048        /// Initialize the PReLU neuron filter
1049        ///
1050        /// Parameter `device`: The device the filter will run on
1051        ///
1052        /// Parameter `a`: Array of floats containing per channel value of PReLu parameter
1053        ///
1054        /// Parameter `count`: Number of float values in array a.
1055        /// This usually corresponds to number of output channels in convolution layer
1056        ///
1057        /// Returns: A valid MPSCNNNeuronPReLU object or nil, if failure.
1058        ///
1059        /// # Safety
1060        ///
1061        /// `a` must be a valid pointer.
1062        #[deprecated]
1063        #[unsafe(method(initWithDevice:a:count:))]
1064        #[unsafe(method_family = init)]
1065        pub unsafe fn initWithDevice_a_count(
1066            this: Allocated<Self>,
1067            device: &ProtocolObject<dyn MTLDevice>,
1068            a: NonNull<c_float>,
1069            count: NSUInteger,
1070        ) -> Retained<Self>;
1071
1072        #[unsafe(method(initWithDevice:))]
1073        #[unsafe(method_family = init)]
1074        pub unsafe fn initWithDevice(
1075            this: Allocated<Self>,
1076            device: &ProtocolObject<dyn MTLDevice>,
1077        ) -> Retained<Self>;
1078    );
1079}
1080
1081/// Methods declared on superclass `MPSCNNNeuron`.
1082#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1083impl MPSCNNNeuronPReLU {
1084    extern_methods!(
1085        /// Initialize the neuron filter with a neuron descriptor.
1086        ///
1087        /// Parameter `device`: The device the filter will run on.
1088        ///
1089        /// Parameter `neuronDescriptor`: The neuron descriptor.
1090        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1091        /// descriptor references an NSData object containing a float array
1092        /// with the per feature channel value of PReLu parameter and, in this
1093        /// case, the MPSCNNNeuron retains the NSData object.
1094        ///
1095        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1096        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1097        #[unsafe(method_family = init)]
1098        pub unsafe fn initWithDevice_neuronDescriptor(
1099            this: Allocated<Self>,
1100            device: &ProtocolObject<dyn MTLDevice>,
1101            neuron_descriptor: &MPSNNNeuronDescriptor,
1102        ) -> Retained<Self>;
1103
1104        /// NSSecureCoding compatability
1105        ///
1106        /// While the standard NSSecureCoding/NSCoding method
1107        /// -initWithCoder: should work, since the file can't
1108        /// know which device your data is allocated on, we
1109        /// have to guess and may guess incorrectly.  To avoid
1110        /// that problem, use initWithCoder:device instead.
1111        ///
1112        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1113        ///
1114        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1115        ///
1116        /// Returns: A new MPSKernel object, or nil if failure.
1117        ///
1118        /// # Safety
1119        ///
1120        /// `a_decoder` possibly has further requirements.
1121        #[unsafe(method(initWithCoder:device:))]
1122        #[unsafe(method_family = init)]
1123        pub unsafe fn initWithCoder_device(
1124            this: Allocated<Self>,
1125            a_decoder: &NSCoder,
1126            device: &ProtocolObject<dyn MTLDevice>,
1127        ) -> Option<Retained<Self>>;
1128    );
1129}
1130
1131/// Methods declared on superclass `MPSKernel`.
1132#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1133impl MPSCNNNeuronPReLU {
1134    extern_methods!(
1135        /// Called by NSCoder to decode MPSKernels
1136        ///
1137        /// This isn't the right interface to decode a MPSKernel, but
1138        /// it is the one that NSCoder uses. To enable your NSCoder
1139        /// (e.g. NSKeyedUnarchiver) to set which device to use
1140        /// extend the object to adopt the MPSDeviceProvider
1141        /// protocol. Otherwise, the Metal system default device
1142        /// will be used.
1143        ///
1144        /// # Safety
1145        ///
1146        /// `a_decoder` possibly has further requirements.
1147        #[unsafe(method(initWithCoder:))]
1148        #[unsafe(method_family = init)]
1149        pub unsafe fn initWithCoder(
1150            this: Allocated<Self>,
1151            a_decoder: &NSCoder,
1152        ) -> Option<Retained<Self>>;
1153    );
1154}
1155
1156/// Methods declared on superclass `NSObject`.
1157#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1158impl MPSCNNNeuronPReLU {
1159    extern_methods!(
1160        #[unsafe(method(init))]
1161        #[unsafe(method_family = init)]
1162        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1163
1164        #[unsafe(method(new))]
1165        #[unsafe(method_family = new)]
1166        pub unsafe fn new() -> Retained<Self>;
1167    );
1168}
1169
1170extern_class!(
1171    /// Dependencies: This depends on Metal.framework
1172    ///
1173    /// Specifies the sigmoid neuron filter.  For each pixel, applies the following function: f(x) = 1 / (1 + e^-x)
1174    ///
1175    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsigmoid?language=objc)
1176    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1177    #[derive(Debug, PartialEq, Eq, Hash)]
1178    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1179    pub struct MPSCNNNeuronSigmoid;
1180);
1181
1182#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1183extern_conformance!(
1184    unsafe impl NSCoding for MPSCNNNeuronSigmoid {}
1185);
1186
1187#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1188extern_conformance!(
1189    unsafe impl NSCopying for MPSCNNNeuronSigmoid {}
1190);
1191
1192#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1193unsafe impl CopyingHelper for MPSCNNNeuronSigmoid {
1194    type Result = Self;
1195}
1196
1197#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1198extern_conformance!(
1199    unsafe impl NSObjectProtocol for MPSCNNNeuronSigmoid {}
1200);
1201
1202#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1203extern_conformance!(
1204    unsafe impl NSSecureCoding for MPSCNNNeuronSigmoid {}
1205);
1206
1207#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1208impl MPSCNNNeuronSigmoid {
1209    extern_methods!(
1210        /// Initialize a neuron filter
1211        ///
1212        /// Parameter `device`: The device the filter will run on
1213        ///
1214        /// Returns: A valid MPSCNNNeuronSigmoid object or nil, if failure.
1215        #[deprecated]
1216        #[unsafe(method(initWithDevice:))]
1217        #[unsafe(method_family = init)]
1218        pub unsafe fn initWithDevice(
1219            this: Allocated<Self>,
1220            device: &ProtocolObject<dyn MTLDevice>,
1221        ) -> Retained<Self>;
1222    );
1223}
1224
1225/// Methods declared on superclass `MPSCNNNeuron`.
1226#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1227impl MPSCNNNeuronSigmoid {
1228    extern_methods!(
1229        /// Initialize the neuron filter with a neuron descriptor.
1230        ///
1231        /// Parameter `device`: The device the filter will run on.
1232        ///
1233        /// Parameter `neuronDescriptor`: The neuron descriptor.
1234        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1235        /// descriptor references an NSData object containing a float array
1236        /// with the per feature channel value of PReLu parameter and, in this
1237        /// case, the MPSCNNNeuron retains the NSData object.
1238        ///
1239        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1240        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1241        #[unsafe(method_family = init)]
1242        pub unsafe fn initWithDevice_neuronDescriptor(
1243            this: Allocated<Self>,
1244            device: &ProtocolObject<dyn MTLDevice>,
1245            neuron_descriptor: &MPSNNNeuronDescriptor,
1246        ) -> Retained<Self>;
1247
1248        /// NSSecureCoding compatability
1249        ///
1250        /// While the standard NSSecureCoding/NSCoding method
1251        /// -initWithCoder: should work, since the file can't
1252        /// know which device your data is allocated on, we
1253        /// have to guess and may guess incorrectly.  To avoid
1254        /// that problem, use initWithCoder:device instead.
1255        ///
1256        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1257        ///
1258        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1259        ///
1260        /// Returns: A new MPSKernel object, or nil if failure.
1261        ///
1262        /// # Safety
1263        ///
1264        /// `a_decoder` possibly has further requirements.
1265        #[unsafe(method(initWithCoder:device:))]
1266        #[unsafe(method_family = init)]
1267        pub unsafe fn initWithCoder_device(
1268            this: Allocated<Self>,
1269            a_decoder: &NSCoder,
1270            device: &ProtocolObject<dyn MTLDevice>,
1271        ) -> Option<Retained<Self>>;
1272    );
1273}
1274
1275/// Methods declared on superclass `MPSKernel`.
1276#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1277impl MPSCNNNeuronSigmoid {
1278    extern_methods!(
1279        /// Called by NSCoder to decode MPSKernels
1280        ///
1281        /// This isn't the right interface to decode a MPSKernel, but
1282        /// it is the one that NSCoder uses. To enable your NSCoder
1283        /// (e.g. NSKeyedUnarchiver) to set which device to use
1284        /// extend the object to adopt the MPSDeviceProvider
1285        /// protocol. Otherwise, the Metal system default device
1286        /// will be used.
1287        ///
1288        /// # Safety
1289        ///
1290        /// `a_decoder` possibly has further requirements.
1291        #[unsafe(method(initWithCoder:))]
1292        #[unsafe(method_family = init)]
1293        pub unsafe fn initWithCoder(
1294            this: Allocated<Self>,
1295            a_decoder: &NSCoder,
1296        ) -> Option<Retained<Self>>;
1297    );
1298}
1299
1300/// Methods declared on superclass `NSObject`.
1301#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1302impl MPSCNNNeuronSigmoid {
1303    extern_methods!(
1304        #[unsafe(method(init))]
1305        #[unsafe(method_family = init)]
1306        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1307
1308        #[unsafe(method(new))]
1309        #[unsafe(method_family = new)]
1310        pub unsafe fn new() -> Retained<Self>;
1311    );
1312}
1313
1314extern_class!(
1315    /// Dependencies: This depends on Metal.framework
1316    ///
1317    /// Specifies the hard sigmoid neuron filter.  For each pixel, applies the following function: f(x) = clamp((a * x) + b, 0, 1)
1318    ///
1319    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronhardsigmoid?language=objc)
1320    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1321    #[derive(Debug, PartialEq, Eq, Hash)]
1322    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1323    pub struct MPSCNNNeuronHardSigmoid;
1324);
1325
1326#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1327extern_conformance!(
1328    unsafe impl NSCoding for MPSCNNNeuronHardSigmoid {}
1329);
1330
1331#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1332extern_conformance!(
1333    unsafe impl NSCopying for MPSCNNNeuronHardSigmoid {}
1334);
1335
1336#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1337unsafe impl CopyingHelper for MPSCNNNeuronHardSigmoid {
1338    type Result = Self;
1339}
1340
1341#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1342extern_conformance!(
1343    unsafe impl NSObjectProtocol for MPSCNNNeuronHardSigmoid {}
1344);
1345
1346#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1347extern_conformance!(
1348    unsafe impl NSSecureCoding for MPSCNNNeuronHardSigmoid {}
1349);
1350
1351#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1352impl MPSCNNNeuronHardSigmoid {
1353    extern_methods!(
1354        /// Initialize a neuron filter
1355        ///
1356        /// Parameter `device`: The device the filter will run on
1357        ///
1358        /// Parameter `a`: Filter property "a". See class discussion.
1359        ///
1360        /// Parameter `b`: Filter property "b". See class discussion.
1361        ///
1362        /// Returns: A valid MPSCNNNeuronHardSigmoid object or nil, if failure.
1363        #[deprecated]
1364        #[unsafe(method(initWithDevice:a:b:))]
1365        #[unsafe(method_family = init)]
1366        pub unsafe fn initWithDevice_a_b(
1367            this: Allocated<Self>,
1368            device: &ProtocolObject<dyn MTLDevice>,
1369            a: c_float,
1370            b: c_float,
1371        ) -> Retained<Self>;
1372
1373        #[unsafe(method(initWithDevice:))]
1374        #[unsafe(method_family = init)]
1375        pub unsafe fn initWithDevice(
1376            this: Allocated<Self>,
1377            device: &ProtocolObject<dyn MTLDevice>,
1378        ) -> Retained<Self>;
1379    );
1380}
1381
1382/// Methods declared on superclass `MPSCNNNeuron`.
1383#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1384impl MPSCNNNeuronHardSigmoid {
1385    extern_methods!(
1386        /// Initialize the neuron filter with a neuron descriptor.
1387        ///
1388        /// Parameter `device`: The device the filter will run on.
1389        ///
1390        /// Parameter `neuronDescriptor`: The neuron descriptor.
1391        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1392        /// descriptor references an NSData object containing a float array
1393        /// with the per feature channel value of PReLu parameter and, in this
1394        /// case, the MPSCNNNeuron retains the NSData object.
1395        ///
1396        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1397        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1398        #[unsafe(method_family = init)]
1399        pub unsafe fn initWithDevice_neuronDescriptor(
1400            this: Allocated<Self>,
1401            device: &ProtocolObject<dyn MTLDevice>,
1402            neuron_descriptor: &MPSNNNeuronDescriptor,
1403        ) -> Retained<Self>;
1404
1405        /// NSSecureCoding compatability
1406        ///
1407        /// While the standard NSSecureCoding/NSCoding method
1408        /// -initWithCoder: should work, since the file can't
1409        /// know which device your data is allocated on, we
1410        /// have to guess and may guess incorrectly.  To avoid
1411        /// that problem, use initWithCoder:device instead.
1412        ///
1413        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1414        ///
1415        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1416        ///
1417        /// Returns: A new MPSKernel object, or nil if failure.
1418        ///
1419        /// # Safety
1420        ///
1421        /// `a_decoder` possibly has further requirements.
1422        #[unsafe(method(initWithCoder:device:))]
1423        #[unsafe(method_family = init)]
1424        pub unsafe fn initWithCoder_device(
1425            this: Allocated<Self>,
1426            a_decoder: &NSCoder,
1427            device: &ProtocolObject<dyn MTLDevice>,
1428        ) -> Option<Retained<Self>>;
1429    );
1430}
1431
1432/// Methods declared on superclass `MPSKernel`.
1433#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1434impl MPSCNNNeuronHardSigmoid {
1435    extern_methods!(
1436        /// Called by NSCoder to decode MPSKernels
1437        ///
1438        /// This isn't the right interface to decode a MPSKernel, but
1439        /// it is the one that NSCoder uses. To enable your NSCoder
1440        /// (e.g. NSKeyedUnarchiver) to set which device to use
1441        /// extend the object to adopt the MPSDeviceProvider
1442        /// protocol. Otherwise, the Metal system default device
1443        /// will be used.
1444        ///
1445        /// # Safety
1446        ///
1447        /// `a_decoder` possibly has further requirements.
1448        #[unsafe(method(initWithCoder:))]
1449        #[unsafe(method_family = init)]
1450        pub unsafe fn initWithCoder(
1451            this: Allocated<Self>,
1452            a_decoder: &NSCoder,
1453        ) -> Option<Retained<Self>>;
1454    );
1455}
1456
1457/// Methods declared on superclass `NSObject`.
1458#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1459impl MPSCNNNeuronHardSigmoid {
1460    extern_methods!(
1461        #[unsafe(method(init))]
1462        #[unsafe(method_family = init)]
1463        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1464
1465        #[unsafe(method(new))]
1466        #[unsafe(method_family = new)]
1467        pub unsafe fn new() -> Retained<Self>;
1468    );
1469}
1470
1471extern_class!(
1472    /// Dependencies: This depends on Metal.framework
1473    ///
1474    /// Specifies the hyperbolic tangent neuron filter.
1475    /// For each pixel, applies the following function: f(x) = a * tanh(b * x)
1476    ///
1477    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneurontanh?language=objc)
1478    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1479    #[derive(Debug, PartialEq, Eq, Hash)]
1480    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1481    pub struct MPSCNNNeuronTanH;
1482);
1483
1484#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1485extern_conformance!(
1486    unsafe impl NSCoding for MPSCNNNeuronTanH {}
1487);
1488
1489#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1490extern_conformance!(
1491    unsafe impl NSCopying for MPSCNNNeuronTanH {}
1492);
1493
1494#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1495unsafe impl CopyingHelper for MPSCNNNeuronTanH {
1496    type Result = Self;
1497}
1498
1499#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1500extern_conformance!(
1501    unsafe impl NSObjectProtocol for MPSCNNNeuronTanH {}
1502);
1503
1504#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1505extern_conformance!(
1506    unsafe impl NSSecureCoding for MPSCNNNeuronTanH {}
1507);
1508
1509#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1510impl MPSCNNNeuronTanH {
1511    extern_methods!(
1512        /// Initialize the hyperbolic tangent neuron filter
1513        ///
1514        /// Parameter `device`: The device the filter will run on
1515        ///
1516        /// Parameter `a`: Filter property "a". See class discussion.
1517        ///
1518        /// Parameter `b`: Filter property "b". See class discussion.
1519        ///
1520        /// Returns: A valid MPSCNNNeuronTanH object or nil, if failure.
1521        #[deprecated]
1522        #[unsafe(method(initWithDevice:a:b:))]
1523        #[unsafe(method_family = init)]
1524        pub unsafe fn initWithDevice_a_b(
1525            this: Allocated<Self>,
1526            device: &ProtocolObject<dyn MTLDevice>,
1527            a: c_float,
1528            b: c_float,
1529        ) -> Retained<Self>;
1530
1531        #[unsafe(method(initWithDevice:))]
1532        #[unsafe(method_family = init)]
1533        pub unsafe fn initWithDevice(
1534            this: Allocated<Self>,
1535            device: &ProtocolObject<dyn MTLDevice>,
1536        ) -> Retained<Self>;
1537    );
1538}
1539
1540/// Methods declared on superclass `MPSCNNNeuron`.
1541#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1542impl MPSCNNNeuronTanH {
1543    extern_methods!(
1544        /// Initialize the neuron filter with a neuron descriptor.
1545        ///
1546        /// Parameter `device`: The device the filter will run on.
1547        ///
1548        /// Parameter `neuronDescriptor`: The neuron descriptor.
1549        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1550        /// descriptor references an NSData object containing a float array
1551        /// with the per feature channel value of PReLu parameter and, in this
1552        /// case, the MPSCNNNeuron retains the NSData object.
1553        ///
1554        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1555        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1556        #[unsafe(method_family = init)]
1557        pub unsafe fn initWithDevice_neuronDescriptor(
1558            this: Allocated<Self>,
1559            device: &ProtocolObject<dyn MTLDevice>,
1560            neuron_descriptor: &MPSNNNeuronDescriptor,
1561        ) -> Retained<Self>;
1562
1563        /// NSSecureCoding compatability
1564        ///
1565        /// While the standard NSSecureCoding/NSCoding method
1566        /// -initWithCoder: should work, since the file can't
1567        /// know which device your data is allocated on, we
1568        /// have to guess and may guess incorrectly.  To avoid
1569        /// that problem, use initWithCoder:device instead.
1570        ///
1571        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1572        ///
1573        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1574        ///
1575        /// Returns: A new MPSKernel object, or nil if failure.
1576        ///
1577        /// # Safety
1578        ///
1579        /// `a_decoder` possibly has further requirements.
1580        #[unsafe(method(initWithCoder:device:))]
1581        #[unsafe(method_family = init)]
1582        pub unsafe fn initWithCoder_device(
1583            this: Allocated<Self>,
1584            a_decoder: &NSCoder,
1585            device: &ProtocolObject<dyn MTLDevice>,
1586        ) -> Option<Retained<Self>>;
1587    );
1588}
1589
1590/// Methods declared on superclass `MPSKernel`.
1591#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1592impl MPSCNNNeuronTanH {
1593    extern_methods!(
1594        /// Called by NSCoder to decode MPSKernels
1595        ///
1596        /// This isn't the right interface to decode a MPSKernel, but
1597        /// it is the one that NSCoder uses. To enable your NSCoder
1598        /// (e.g. NSKeyedUnarchiver) to set which device to use
1599        /// extend the object to adopt the MPSDeviceProvider
1600        /// protocol. Otherwise, the Metal system default device
1601        /// will be used.
1602        ///
1603        /// # Safety
1604        ///
1605        /// `a_decoder` possibly has further requirements.
1606        #[unsafe(method(initWithCoder:))]
1607        #[unsafe(method_family = init)]
1608        pub unsafe fn initWithCoder(
1609            this: Allocated<Self>,
1610            a_decoder: &NSCoder,
1611        ) -> Option<Retained<Self>>;
1612    );
1613}
1614
1615/// Methods declared on superclass `NSObject`.
1616#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1617impl MPSCNNNeuronTanH {
1618    extern_methods!(
1619        #[unsafe(method(init))]
1620        #[unsafe(method_family = init)]
1621        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1622
1623        #[unsafe(method(new))]
1624        #[unsafe(method_family = new)]
1625        pub unsafe fn new() -> Retained<Self>;
1626    );
1627}
1628
1629extern_class!(
1630    /// Dependencies: This depends on Metal.framework
1631    ///
1632    /// Specifies the absolute neuron filter.  For each pixel, applies the following function: f(x) = | x |
1633    ///
1634    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronabsolute?language=objc)
1635    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1636    #[derive(Debug, PartialEq, Eq, Hash)]
1637    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1638    pub struct MPSCNNNeuronAbsolute;
1639);
1640
1641#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1642extern_conformance!(
1643    unsafe impl NSCoding for MPSCNNNeuronAbsolute {}
1644);
1645
1646#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1647extern_conformance!(
1648    unsafe impl NSCopying for MPSCNNNeuronAbsolute {}
1649);
1650
1651#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1652unsafe impl CopyingHelper for MPSCNNNeuronAbsolute {
1653    type Result = Self;
1654}
1655
1656#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1657extern_conformance!(
1658    unsafe impl NSObjectProtocol for MPSCNNNeuronAbsolute {}
1659);
1660
1661#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1662extern_conformance!(
1663    unsafe impl NSSecureCoding for MPSCNNNeuronAbsolute {}
1664);
1665
1666#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1667impl MPSCNNNeuronAbsolute {
1668    extern_methods!(
1669        /// Initialize a neuron filter
1670        ///
1671        /// Parameter `device`: The device the filter will run on
1672        ///
1673        /// Returns: A valid MPSCNNNeuronAbsolute object or nil, if failure.
1674        #[deprecated]
1675        #[unsafe(method(initWithDevice:))]
1676        #[unsafe(method_family = init)]
1677        pub unsafe fn initWithDevice(
1678            this: Allocated<Self>,
1679            device: &ProtocolObject<dyn MTLDevice>,
1680        ) -> Retained<Self>;
1681    );
1682}
1683
1684/// Methods declared on superclass `MPSCNNNeuron`.
1685#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1686impl MPSCNNNeuronAbsolute {
1687    extern_methods!(
1688        /// Initialize the neuron filter with a neuron descriptor.
1689        ///
1690        /// Parameter `device`: The device the filter will run on.
1691        ///
1692        /// Parameter `neuronDescriptor`: The neuron descriptor.
1693        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1694        /// descriptor references an NSData object containing a float array
1695        /// with the per feature channel value of PReLu parameter and, in this
1696        /// case, the MPSCNNNeuron retains the NSData object.
1697        ///
1698        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1699        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1700        #[unsafe(method_family = init)]
1701        pub unsafe fn initWithDevice_neuronDescriptor(
1702            this: Allocated<Self>,
1703            device: &ProtocolObject<dyn MTLDevice>,
1704            neuron_descriptor: &MPSNNNeuronDescriptor,
1705        ) -> Retained<Self>;
1706
1707        /// NSSecureCoding compatability
1708        ///
1709        /// While the standard NSSecureCoding/NSCoding method
1710        /// -initWithCoder: should work, since the file can't
1711        /// know which device your data is allocated on, we
1712        /// have to guess and may guess incorrectly.  To avoid
1713        /// that problem, use initWithCoder:device instead.
1714        ///
1715        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1716        ///
1717        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1718        ///
1719        /// Returns: A new MPSKernel object, or nil if failure.
1720        ///
1721        /// # Safety
1722        ///
1723        /// `a_decoder` possibly has further requirements.
1724        #[unsafe(method(initWithCoder:device:))]
1725        #[unsafe(method_family = init)]
1726        pub unsafe fn initWithCoder_device(
1727            this: Allocated<Self>,
1728            a_decoder: &NSCoder,
1729            device: &ProtocolObject<dyn MTLDevice>,
1730        ) -> Option<Retained<Self>>;
1731    );
1732}
1733
1734/// Methods declared on superclass `MPSKernel`.
1735#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1736impl MPSCNNNeuronAbsolute {
1737    extern_methods!(
1738        /// Called by NSCoder to decode MPSKernels
1739        ///
1740        /// This isn't the right interface to decode a MPSKernel, but
1741        /// it is the one that NSCoder uses. To enable your NSCoder
1742        /// (e.g. NSKeyedUnarchiver) to set which device to use
1743        /// extend the object to adopt the MPSDeviceProvider
1744        /// protocol. Otherwise, the Metal system default device
1745        /// will be used.
1746        ///
1747        /// # Safety
1748        ///
1749        /// `a_decoder` possibly has further requirements.
1750        #[unsafe(method(initWithCoder:))]
1751        #[unsafe(method_family = init)]
1752        pub unsafe fn initWithCoder(
1753            this: Allocated<Self>,
1754            a_decoder: &NSCoder,
1755        ) -> Option<Retained<Self>>;
1756    );
1757}
1758
1759/// Methods declared on superclass `NSObject`.
1760#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1761impl MPSCNNNeuronAbsolute {
1762    extern_methods!(
1763        #[unsafe(method(init))]
1764        #[unsafe(method_family = init)]
1765        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1766
1767        #[unsafe(method(new))]
1768        #[unsafe(method_family = new)]
1769        pub unsafe fn new() -> Retained<Self>;
1770    );
1771}
1772
1773extern_class!(
1774    /// Dependencies: This depends on Metal.framework
1775    ///
1776    /// Specifies the parametric softplus neuron filter.
1777    /// For each pixel, applies the following function: f(x) = a * log(1 + e^(b * x))
1778    ///
1779    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsoftplus?language=objc)
1780    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1781    #[derive(Debug, PartialEq, Eq, Hash)]
1782    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1783    pub struct MPSCNNNeuronSoftPlus;
1784);
1785
1786#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1787extern_conformance!(
1788    unsafe impl NSCoding for MPSCNNNeuronSoftPlus {}
1789);
1790
1791#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1792extern_conformance!(
1793    unsafe impl NSCopying for MPSCNNNeuronSoftPlus {}
1794);
1795
1796#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1797unsafe impl CopyingHelper for MPSCNNNeuronSoftPlus {
1798    type Result = Self;
1799}
1800
1801#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1802extern_conformance!(
1803    unsafe impl NSObjectProtocol for MPSCNNNeuronSoftPlus {}
1804);
1805
1806#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1807extern_conformance!(
1808    unsafe impl NSSecureCoding for MPSCNNNeuronSoftPlus {}
1809);
1810
1811#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1812impl MPSCNNNeuronSoftPlus {
1813    extern_methods!(
1814        /// Initialize a parametric softplus neuron filter
1815        ///
1816        /// Parameter `device`: The device the filter will run on
1817        ///
1818        /// Parameter `a`: Filter property "a". See class discussion.
1819        ///
1820        /// Parameter `b`: Filter property "b". See class discussion.
1821        ///
1822        /// Returns: A valid MPSCNNNeuronSoftPlus object or nil, if failure.
1823        #[deprecated]
1824        #[unsafe(method(initWithDevice:a:b:))]
1825        #[unsafe(method_family = init)]
1826        pub unsafe fn initWithDevice_a_b(
1827            this: Allocated<Self>,
1828            device: &ProtocolObject<dyn MTLDevice>,
1829            a: c_float,
1830            b: c_float,
1831        ) -> Retained<Self>;
1832
1833        #[unsafe(method(initWithDevice:))]
1834        #[unsafe(method_family = init)]
1835        pub unsafe fn initWithDevice(
1836            this: Allocated<Self>,
1837            device: &ProtocolObject<dyn MTLDevice>,
1838        ) -> Retained<Self>;
1839    );
1840}
1841
1842/// Methods declared on superclass `MPSCNNNeuron`.
1843#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1844impl MPSCNNNeuronSoftPlus {
1845    extern_methods!(
1846        /// Initialize the neuron filter with a neuron descriptor.
1847        ///
1848        /// Parameter `device`: The device the filter will run on.
1849        ///
1850        /// Parameter `neuronDescriptor`: The neuron descriptor.
1851        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1852        /// descriptor references an NSData object containing a float array
1853        /// with the per feature channel value of PReLu parameter and, in this
1854        /// case, the MPSCNNNeuron retains the NSData object.
1855        ///
1856        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
1857        #[unsafe(method(initWithDevice:neuronDescriptor:))]
1858        #[unsafe(method_family = init)]
1859        pub unsafe fn initWithDevice_neuronDescriptor(
1860            this: Allocated<Self>,
1861            device: &ProtocolObject<dyn MTLDevice>,
1862            neuron_descriptor: &MPSNNNeuronDescriptor,
1863        ) -> Retained<Self>;
1864
1865        /// NSSecureCoding compatability
1866        ///
1867        /// While the standard NSSecureCoding/NSCoding method
1868        /// -initWithCoder: should work, since the file can't
1869        /// know which device your data is allocated on, we
1870        /// have to guess and may guess incorrectly.  To avoid
1871        /// that problem, use initWithCoder:device instead.
1872        ///
1873        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
1874        ///
1875        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
1876        ///
1877        /// Returns: A new MPSKernel object, or nil if failure.
1878        ///
1879        /// # Safety
1880        ///
1881        /// `a_decoder` possibly has further requirements.
1882        #[unsafe(method(initWithCoder:device:))]
1883        #[unsafe(method_family = init)]
1884        pub unsafe fn initWithCoder_device(
1885            this: Allocated<Self>,
1886            a_decoder: &NSCoder,
1887            device: &ProtocolObject<dyn MTLDevice>,
1888        ) -> Option<Retained<Self>>;
1889    );
1890}
1891
1892/// Methods declared on superclass `MPSKernel`.
1893#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1894impl MPSCNNNeuronSoftPlus {
1895    extern_methods!(
1896        /// Called by NSCoder to decode MPSKernels
1897        ///
1898        /// This isn't the right interface to decode a MPSKernel, but
1899        /// it is the one that NSCoder uses. To enable your NSCoder
1900        /// (e.g. NSKeyedUnarchiver) to set which device to use
1901        /// extend the object to adopt the MPSDeviceProvider
1902        /// protocol. Otherwise, the Metal system default device
1903        /// will be used.
1904        ///
1905        /// # Safety
1906        ///
1907        /// `a_decoder` possibly has further requirements.
1908        #[unsafe(method(initWithCoder:))]
1909        #[unsafe(method_family = init)]
1910        pub unsafe fn initWithCoder(
1911            this: Allocated<Self>,
1912            a_decoder: &NSCoder,
1913        ) -> Option<Retained<Self>>;
1914    );
1915}
1916
1917/// Methods declared on superclass `NSObject`.
1918#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1919impl MPSCNNNeuronSoftPlus {
1920    extern_methods!(
1921        #[unsafe(method(init))]
1922        #[unsafe(method_family = init)]
1923        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
1924
1925        #[unsafe(method(new))]
1926        #[unsafe(method_family = new)]
1927        pub unsafe fn new() -> Retained<Self>;
1928    );
1929}
1930
1931extern_class!(
1932    /// Dependencies: This depends on Metal.framework
1933    ///
1934    /// Specifies the softsign neuron filter.
1935    /// For each pixel, applies the following function: f(x) = x / (1 + abs(x))
1936    ///
1937    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronsoftsign?language=objc)
1938    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
1939    #[derive(Debug, PartialEq, Eq, Hash)]
1940    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1941    pub struct MPSCNNNeuronSoftSign;
1942);
1943
1944#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1945extern_conformance!(
1946    unsafe impl NSCoding for MPSCNNNeuronSoftSign {}
1947);
1948
1949#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1950extern_conformance!(
1951    unsafe impl NSCopying for MPSCNNNeuronSoftSign {}
1952);
1953
1954#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1955unsafe impl CopyingHelper for MPSCNNNeuronSoftSign {
1956    type Result = Self;
1957}
1958
1959#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1960extern_conformance!(
1961    unsafe impl NSObjectProtocol for MPSCNNNeuronSoftSign {}
1962);
1963
1964#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1965extern_conformance!(
1966    unsafe impl NSSecureCoding for MPSCNNNeuronSoftSign {}
1967);
1968
1969#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1970impl MPSCNNNeuronSoftSign {
1971    extern_methods!(
1972        /// Initialize a softsign neuron filter
1973        ///
1974        /// Parameter `device`: The device the filter will run on
1975        ///
1976        /// Returns: A valid MPSCNNNeuronSoftSign object or nil, if failure.
1977        #[deprecated]
1978        #[unsafe(method(initWithDevice:))]
1979        #[unsafe(method_family = init)]
1980        pub unsafe fn initWithDevice(
1981            this: Allocated<Self>,
1982            device: &ProtocolObject<dyn MTLDevice>,
1983        ) -> Retained<Self>;
1984    );
1985}
1986
1987/// Methods declared on superclass `MPSCNNNeuron`.
1988#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
1989impl MPSCNNNeuronSoftSign {
1990    extern_methods!(
1991        /// Initialize the neuron filter with a neuron descriptor.
1992        ///
1993        /// Parameter `device`: The device the filter will run on.
1994        ///
1995        /// Parameter `neuronDescriptor`: The neuron descriptor.
1996        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
1997        /// descriptor references an NSData object containing a float array
1998        /// with the per feature channel value of PReLu parameter and, in this
1999        /// case, the MPSCNNNeuron retains the NSData object.
2000        ///
2001        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2002        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2003        #[unsafe(method_family = init)]
2004        pub unsafe fn initWithDevice_neuronDescriptor(
2005            this: Allocated<Self>,
2006            device: &ProtocolObject<dyn MTLDevice>,
2007            neuron_descriptor: &MPSNNNeuronDescriptor,
2008        ) -> Retained<Self>;
2009
2010        /// NSSecureCoding compatability
2011        ///
2012        /// While the standard NSSecureCoding/NSCoding method
2013        /// -initWithCoder: should work, since the file can't
2014        /// know which device your data is allocated on, we
2015        /// have to guess and may guess incorrectly.  To avoid
2016        /// that problem, use initWithCoder:device instead.
2017        ///
2018        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2019        ///
2020        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2021        ///
2022        /// Returns: A new MPSKernel object, or nil if failure.
2023        ///
2024        /// # Safety
2025        ///
2026        /// `a_decoder` possibly has further requirements.
2027        #[unsafe(method(initWithCoder:device:))]
2028        #[unsafe(method_family = init)]
2029        pub unsafe fn initWithCoder_device(
2030            this: Allocated<Self>,
2031            a_decoder: &NSCoder,
2032            device: &ProtocolObject<dyn MTLDevice>,
2033        ) -> Option<Retained<Self>>;
2034    );
2035}
2036
2037/// Methods declared on superclass `MPSKernel`.
2038#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2039impl MPSCNNNeuronSoftSign {
2040    extern_methods!(
2041        /// Called by NSCoder to decode MPSKernels
2042        ///
2043        /// This isn't the right interface to decode a MPSKernel, but
2044        /// it is the one that NSCoder uses. To enable your NSCoder
2045        /// (e.g. NSKeyedUnarchiver) to set which device to use
2046        /// extend the object to adopt the MPSDeviceProvider
2047        /// protocol. Otherwise, the Metal system default device
2048        /// will be used.
2049        ///
2050        /// # Safety
2051        ///
2052        /// `a_decoder` possibly has further requirements.
2053        #[unsafe(method(initWithCoder:))]
2054        #[unsafe(method_family = init)]
2055        pub unsafe fn initWithCoder(
2056            this: Allocated<Self>,
2057            a_decoder: &NSCoder,
2058        ) -> Option<Retained<Self>>;
2059    );
2060}
2061
2062/// Methods declared on superclass `NSObject`.
2063#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2064impl MPSCNNNeuronSoftSign {
2065    extern_methods!(
2066        #[unsafe(method(init))]
2067        #[unsafe(method_family = init)]
2068        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2069
2070        #[unsafe(method(new))]
2071        #[unsafe(method_family = new)]
2072        pub unsafe fn new() -> Retained<Self>;
2073    );
2074}
2075
2076extern_class!(
2077    /// Dependencies: This depends on Metal.framework
2078    ///
2079    /// Specifies the parametric ELU neuron filter.
2080    /// For each pixel, applies the following function: f(x) = [ a * (exp(x) - 1), x
2081    /// <
2082    /// 0
2083    /// [ x               , x >= 0
2084    ///
2085    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronelu?language=objc)
2086    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
2087    #[derive(Debug, PartialEq, Eq, Hash)]
2088    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2089    pub struct MPSCNNNeuronELU;
2090);
2091
2092#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2093extern_conformance!(
2094    unsafe impl NSCoding for MPSCNNNeuronELU {}
2095);
2096
2097#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2098extern_conformance!(
2099    unsafe impl NSCopying for MPSCNNNeuronELU {}
2100);
2101
2102#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2103unsafe impl CopyingHelper for MPSCNNNeuronELU {
2104    type Result = Self;
2105}
2106
2107#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2108extern_conformance!(
2109    unsafe impl NSObjectProtocol for MPSCNNNeuronELU {}
2110);
2111
2112#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2113extern_conformance!(
2114    unsafe impl NSSecureCoding for MPSCNNNeuronELU {}
2115);
2116
2117#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2118impl MPSCNNNeuronELU {
2119    extern_methods!(
2120        /// Initialize a parametric ELU neuron filter
2121        ///
2122        /// Parameter `device`: The device the filter will run on
2123        ///
2124        /// Parameter `a`: Filter property "a". See class discussion.
2125        ///
2126        /// Returns: A valid MPSCNNNeuronELU object or nil, if failure.
2127        #[deprecated]
2128        #[unsafe(method(initWithDevice:a:))]
2129        #[unsafe(method_family = init)]
2130        pub unsafe fn initWithDevice_a(
2131            this: Allocated<Self>,
2132            device: &ProtocolObject<dyn MTLDevice>,
2133            a: c_float,
2134        ) -> Retained<Self>;
2135
2136        #[unsafe(method(initWithDevice:))]
2137        #[unsafe(method_family = init)]
2138        pub unsafe fn initWithDevice(
2139            this: Allocated<Self>,
2140            device: &ProtocolObject<dyn MTLDevice>,
2141        ) -> Retained<Self>;
2142    );
2143}
2144
2145/// Methods declared on superclass `MPSCNNNeuron`.
2146#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2147impl MPSCNNNeuronELU {
2148    extern_methods!(
2149        /// Initialize the neuron filter with a neuron descriptor.
2150        ///
2151        /// Parameter `device`: The device the filter will run on.
2152        ///
2153        /// Parameter `neuronDescriptor`: The neuron descriptor.
2154        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
2155        /// descriptor references an NSData object containing a float array
2156        /// with the per feature channel value of PReLu parameter and, in this
2157        /// case, the MPSCNNNeuron retains the NSData object.
2158        ///
2159        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2160        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2161        #[unsafe(method_family = init)]
2162        pub unsafe fn initWithDevice_neuronDescriptor(
2163            this: Allocated<Self>,
2164            device: &ProtocolObject<dyn MTLDevice>,
2165            neuron_descriptor: &MPSNNNeuronDescriptor,
2166        ) -> Retained<Self>;
2167
2168        /// NSSecureCoding compatability
2169        ///
2170        /// While the standard NSSecureCoding/NSCoding method
2171        /// -initWithCoder: should work, since the file can't
2172        /// know which device your data is allocated on, we
2173        /// have to guess and may guess incorrectly.  To avoid
2174        /// that problem, use initWithCoder:device instead.
2175        ///
2176        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2177        ///
2178        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2179        ///
2180        /// Returns: A new MPSKernel object, or nil if failure.
2181        ///
2182        /// # Safety
2183        ///
2184        /// `a_decoder` possibly has further requirements.
2185        #[unsafe(method(initWithCoder:device:))]
2186        #[unsafe(method_family = init)]
2187        pub unsafe fn initWithCoder_device(
2188            this: Allocated<Self>,
2189            a_decoder: &NSCoder,
2190            device: &ProtocolObject<dyn MTLDevice>,
2191        ) -> Option<Retained<Self>>;
2192    );
2193}
2194
2195/// Methods declared on superclass `MPSKernel`.
2196#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2197impl MPSCNNNeuronELU {
2198    extern_methods!(
2199        /// Called by NSCoder to decode MPSKernels
2200        ///
2201        /// This isn't the right interface to decode a MPSKernel, but
2202        /// it is the one that NSCoder uses. To enable your NSCoder
2203        /// (e.g. NSKeyedUnarchiver) to set which device to use
2204        /// extend the object to adopt the MPSDeviceProvider
2205        /// protocol. Otherwise, the Metal system default device
2206        /// will be used.
2207        ///
2208        /// # Safety
2209        ///
2210        /// `a_decoder` possibly has further requirements.
2211        #[unsafe(method(initWithCoder:))]
2212        #[unsafe(method_family = init)]
2213        pub unsafe fn initWithCoder(
2214            this: Allocated<Self>,
2215            a_decoder: &NSCoder,
2216        ) -> Option<Retained<Self>>;
2217    );
2218}
2219
2220/// Methods declared on superclass `NSObject`.
2221#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2222impl MPSCNNNeuronELU {
2223    extern_methods!(
2224        #[unsafe(method(init))]
2225        #[unsafe(method_family = init)]
2226        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2227
2228        #[unsafe(method(new))]
2229        #[unsafe(method_family = new)]
2230        pub unsafe fn new() -> Retained<Self>;
2231    );
2232}
2233
2234extern_class!(
2235    /// Dependencies: This depends on Metal.framework
2236    ///
2237    /// Specifies the ReLUN neuron filter.
2238    /// For each pixel, applies the following function: f(x) = [ x    , x >= 0
2239    /// [ a * x, x
2240    /// <
2241    /// 0
2242    /// [ b    , x >= b
2243    /// As an example, the TensorFlow Relu6 activation layer can be implemented
2244    /// by setting the parameter b to 6.0f:
2245    /// https://www.tensorflow.org/api_docs/cc/class/tensorflow/ops/relu6.
2246    ///
2247    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronrelun?language=objc)
2248    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
2249    #[derive(Debug, PartialEq, Eq, Hash)]
2250    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2251    pub struct MPSCNNNeuronReLUN;
2252);
2253
2254#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2255extern_conformance!(
2256    unsafe impl NSCoding for MPSCNNNeuronReLUN {}
2257);
2258
2259#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2260extern_conformance!(
2261    unsafe impl NSCopying for MPSCNNNeuronReLUN {}
2262);
2263
2264#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2265unsafe impl CopyingHelper for MPSCNNNeuronReLUN {
2266    type Result = Self;
2267}
2268
2269#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2270extern_conformance!(
2271    unsafe impl NSObjectProtocol for MPSCNNNeuronReLUN {}
2272);
2273
2274#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2275extern_conformance!(
2276    unsafe impl NSSecureCoding for MPSCNNNeuronReLUN {}
2277);
2278
2279#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2280impl MPSCNNNeuronReLUN {
2281    extern_methods!(
2282        /// Initialize a ReLUN neuron filter
2283        ///
2284        /// Parameter `device`: The device the filter will run on
2285        ///
2286        /// Parameter `a`: Filter property "a". See class discussion.
2287        ///
2288        /// Parameter `b`: Filter property "b". See class discussion.
2289        ///
2290        /// Returns: A valid MPSCNNNeuronReLUN object or nil, if failure.
2291        #[deprecated]
2292        #[unsafe(method(initWithDevice:a:b:))]
2293        #[unsafe(method_family = init)]
2294        pub unsafe fn initWithDevice_a_b(
2295            this: Allocated<Self>,
2296            device: &ProtocolObject<dyn MTLDevice>,
2297            a: c_float,
2298            b: c_float,
2299        ) -> Retained<Self>;
2300
2301        #[unsafe(method(initWithDevice:))]
2302        #[unsafe(method_family = init)]
2303        pub unsafe fn initWithDevice(
2304            this: Allocated<Self>,
2305            device: &ProtocolObject<dyn MTLDevice>,
2306        ) -> Retained<Self>;
2307    );
2308}
2309
2310/// Methods declared on superclass `MPSCNNNeuron`.
2311#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2312impl MPSCNNNeuronReLUN {
2313    extern_methods!(
2314        /// Initialize the neuron filter with a neuron descriptor.
2315        ///
2316        /// Parameter `device`: The device the filter will run on.
2317        ///
2318        /// Parameter `neuronDescriptor`: The neuron descriptor.
2319        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
2320        /// descriptor references an NSData object containing a float array
2321        /// with the per feature channel value of PReLu parameter and, in this
2322        /// case, the MPSCNNNeuron retains the NSData object.
2323        ///
2324        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2325        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2326        #[unsafe(method_family = init)]
2327        pub unsafe fn initWithDevice_neuronDescriptor(
2328            this: Allocated<Self>,
2329            device: &ProtocolObject<dyn MTLDevice>,
2330            neuron_descriptor: &MPSNNNeuronDescriptor,
2331        ) -> Retained<Self>;
2332
2333        /// NSSecureCoding compatability
2334        ///
2335        /// While the standard NSSecureCoding/NSCoding method
2336        /// -initWithCoder: should work, since the file can't
2337        /// know which device your data is allocated on, we
2338        /// have to guess and may guess incorrectly.  To avoid
2339        /// that problem, use initWithCoder:device instead.
2340        ///
2341        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2342        ///
2343        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2344        ///
2345        /// Returns: A new MPSKernel object, or nil if failure.
2346        ///
2347        /// # Safety
2348        ///
2349        /// `a_decoder` possibly has further requirements.
2350        #[unsafe(method(initWithCoder:device:))]
2351        #[unsafe(method_family = init)]
2352        pub unsafe fn initWithCoder_device(
2353            this: Allocated<Self>,
2354            a_decoder: &NSCoder,
2355            device: &ProtocolObject<dyn MTLDevice>,
2356        ) -> Option<Retained<Self>>;
2357    );
2358}
2359
2360/// Methods declared on superclass `MPSKernel`.
2361#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2362impl MPSCNNNeuronReLUN {
2363    extern_methods!(
2364        /// Called by NSCoder to decode MPSKernels
2365        ///
2366        /// This isn't the right interface to decode a MPSKernel, but
2367        /// it is the one that NSCoder uses. To enable your NSCoder
2368        /// (e.g. NSKeyedUnarchiver) to set which device to use
2369        /// extend the object to adopt the MPSDeviceProvider
2370        /// protocol. Otherwise, the Metal system default device
2371        /// will be used.
2372        ///
2373        /// # Safety
2374        ///
2375        /// `a_decoder` possibly has further requirements.
2376        #[unsafe(method(initWithCoder:))]
2377        #[unsafe(method_family = init)]
2378        pub unsafe fn initWithCoder(
2379            this: Allocated<Self>,
2380            a_decoder: &NSCoder,
2381        ) -> Option<Retained<Self>>;
2382    );
2383}
2384
2385/// Methods declared on superclass `NSObject`.
2386#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2387impl MPSCNNNeuronReLUN {
2388    extern_methods!(
2389        #[unsafe(method(init))]
2390        #[unsafe(method_family = init)]
2391        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2392
2393        #[unsafe(method(new))]
2394        #[unsafe(method_family = new)]
2395        pub unsafe fn new() -> Retained<Self>;
2396    );
2397}
2398
2399extern_class!(
2400    /// Dependencies: This depends on Metal.framework.
2401    ///
2402    /// Specifies the Power neuron filter.
2403    /// For each pixel, applies the following function: f(x) = (a * x + b) ^ c.
2404    ///
2405    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronpower?language=objc)
2406    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
2407    #[derive(Debug, PartialEq, Eq, Hash)]
2408    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2409    pub struct MPSCNNNeuronPower;
2410);
2411
2412#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2413extern_conformance!(
2414    unsafe impl NSCoding for MPSCNNNeuronPower {}
2415);
2416
2417#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2418extern_conformance!(
2419    unsafe impl NSCopying for MPSCNNNeuronPower {}
2420);
2421
2422#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2423unsafe impl CopyingHelper for MPSCNNNeuronPower {
2424    type Result = Self;
2425}
2426
2427#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2428extern_conformance!(
2429    unsafe impl NSObjectProtocol for MPSCNNNeuronPower {}
2430);
2431
2432#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2433extern_conformance!(
2434    unsafe impl NSSecureCoding for MPSCNNNeuronPower {}
2435);
2436
2437#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2438impl MPSCNNNeuronPower {
2439    extern_methods!(
2440        /// Initialize a Power neuron filter.
2441        ///
2442        /// Parameter `device`: The device the filter will run on.
2443        ///
2444        /// Parameter `a`: Filter property "a". See class discussion.
2445        ///
2446        /// Parameter `b`: Filter property "b". See class discussion.
2447        ///
2448        /// Parameter `c`: Filter property "c". See class discussion.
2449        ///
2450        /// Returns: A valid MPSCNNNeuronPower object or nil, if failure.
2451        #[deprecated]
2452        #[unsafe(method(initWithDevice:a:b:c:))]
2453        #[unsafe(method_family = init)]
2454        pub unsafe fn initWithDevice_a_b_c(
2455            this: Allocated<Self>,
2456            device: &ProtocolObject<dyn MTLDevice>,
2457            a: c_float,
2458            b: c_float,
2459            c: c_float,
2460        ) -> Retained<Self>;
2461
2462        #[unsafe(method(initWithDevice:))]
2463        #[unsafe(method_family = init)]
2464        pub unsafe fn initWithDevice(
2465            this: Allocated<Self>,
2466            device: &ProtocolObject<dyn MTLDevice>,
2467        ) -> Retained<Self>;
2468    );
2469}
2470
2471/// Methods declared on superclass `MPSCNNNeuron`.
2472#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2473impl MPSCNNNeuronPower {
2474    extern_methods!(
2475        /// Initialize the neuron filter with a neuron descriptor.
2476        ///
2477        /// Parameter `device`: The device the filter will run on.
2478        ///
2479        /// Parameter `neuronDescriptor`: The neuron descriptor.
2480        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
2481        /// descriptor references an NSData object containing a float array
2482        /// with the per feature channel value of PReLu parameter and, in this
2483        /// case, the MPSCNNNeuron retains the NSData object.
2484        ///
2485        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2486        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2487        #[unsafe(method_family = init)]
2488        pub unsafe fn initWithDevice_neuronDescriptor(
2489            this: Allocated<Self>,
2490            device: &ProtocolObject<dyn MTLDevice>,
2491            neuron_descriptor: &MPSNNNeuronDescriptor,
2492        ) -> Retained<Self>;
2493
2494        /// NSSecureCoding compatability
2495        ///
2496        /// While the standard NSSecureCoding/NSCoding method
2497        /// -initWithCoder: should work, since the file can't
2498        /// know which device your data is allocated on, we
2499        /// have to guess and may guess incorrectly.  To avoid
2500        /// that problem, use initWithCoder:device instead.
2501        ///
2502        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2503        ///
2504        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2505        ///
2506        /// Returns: A new MPSKernel object, or nil if failure.
2507        ///
2508        /// # Safety
2509        ///
2510        /// `a_decoder` possibly has further requirements.
2511        #[unsafe(method(initWithCoder:device:))]
2512        #[unsafe(method_family = init)]
2513        pub unsafe fn initWithCoder_device(
2514            this: Allocated<Self>,
2515            a_decoder: &NSCoder,
2516            device: &ProtocolObject<dyn MTLDevice>,
2517        ) -> Option<Retained<Self>>;
2518    );
2519}
2520
2521/// Methods declared on superclass `MPSKernel`.
2522#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2523impl MPSCNNNeuronPower {
2524    extern_methods!(
2525        /// Called by NSCoder to decode MPSKernels
2526        ///
2527        /// This isn't the right interface to decode a MPSKernel, but
2528        /// it is the one that NSCoder uses. To enable your NSCoder
2529        /// (e.g. NSKeyedUnarchiver) to set which device to use
2530        /// extend the object to adopt the MPSDeviceProvider
2531        /// protocol. Otherwise, the Metal system default device
2532        /// will be used.
2533        ///
2534        /// # Safety
2535        ///
2536        /// `a_decoder` possibly has further requirements.
2537        #[unsafe(method(initWithCoder:))]
2538        #[unsafe(method_family = init)]
2539        pub unsafe fn initWithCoder(
2540            this: Allocated<Self>,
2541            a_decoder: &NSCoder,
2542        ) -> Option<Retained<Self>>;
2543    );
2544}
2545
2546/// Methods declared on superclass `NSObject`.
2547#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2548impl MPSCNNNeuronPower {
2549    extern_methods!(
2550        #[unsafe(method(init))]
2551        #[unsafe(method_family = init)]
2552        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2553
2554        #[unsafe(method(new))]
2555        #[unsafe(method_family = new)]
2556        pub unsafe fn new() -> Retained<Self>;
2557    );
2558}
2559
2560extern_class!(
2561    /// Dependencies: This depends on Metal.framework.
2562    ///
2563    /// Specifies the Exponential neuron filter.
2564    /// For each pixel, applies the following function: f(x) = c ^ (a * x + b).
2565    ///
2566    /// If the value of c is -1.0f, the base (c) is set to e.
2567    ///
2568    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronexponential?language=objc)
2569    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
2570    #[derive(Debug, PartialEq, Eq, Hash)]
2571    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2572    pub struct MPSCNNNeuronExponential;
2573);
2574
2575#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2576extern_conformance!(
2577    unsafe impl NSCoding for MPSCNNNeuronExponential {}
2578);
2579
2580#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2581extern_conformance!(
2582    unsafe impl NSCopying for MPSCNNNeuronExponential {}
2583);
2584
2585#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2586unsafe impl CopyingHelper for MPSCNNNeuronExponential {
2587    type Result = Self;
2588}
2589
2590#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2591extern_conformance!(
2592    unsafe impl NSObjectProtocol for MPSCNNNeuronExponential {}
2593);
2594
2595#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2596extern_conformance!(
2597    unsafe impl NSSecureCoding for MPSCNNNeuronExponential {}
2598);
2599
2600#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2601impl MPSCNNNeuronExponential {
2602    extern_methods!(
2603        /// Initialize a Exponential neuron filter.
2604        ///
2605        /// Parameter `device`: The device the filter will run on.
2606        ///
2607        /// Parameter `a`: Filter property "a". See class discussion.
2608        ///
2609        /// Parameter `b`: Filter property "b". See class discussion.
2610        ///
2611        /// Parameter `c`: Filter property "c". See class discussion.
2612        ///
2613        /// Returns: A valid MPSCNNNeuronExponential object or nil, if failure.
2614        #[deprecated]
2615        #[unsafe(method(initWithDevice:a:b:c:))]
2616        #[unsafe(method_family = init)]
2617        pub unsafe fn initWithDevice_a_b_c(
2618            this: Allocated<Self>,
2619            device: &ProtocolObject<dyn MTLDevice>,
2620            a: c_float,
2621            b: c_float,
2622            c: c_float,
2623        ) -> Retained<Self>;
2624
2625        #[unsafe(method(initWithDevice:))]
2626        #[unsafe(method_family = init)]
2627        pub unsafe fn initWithDevice(
2628            this: Allocated<Self>,
2629            device: &ProtocolObject<dyn MTLDevice>,
2630        ) -> Retained<Self>;
2631    );
2632}
2633
2634/// Methods declared on superclass `MPSCNNNeuron`.
2635#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2636impl MPSCNNNeuronExponential {
2637    extern_methods!(
2638        /// Initialize the neuron filter with a neuron descriptor.
2639        ///
2640        /// Parameter `device`: The device the filter will run on.
2641        ///
2642        /// Parameter `neuronDescriptor`: The neuron descriptor.
2643        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
2644        /// descriptor references an NSData object containing a float array
2645        /// with the per feature channel value of PReLu parameter and, in this
2646        /// case, the MPSCNNNeuron retains the NSData object.
2647        ///
2648        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2649        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2650        #[unsafe(method_family = init)]
2651        pub unsafe fn initWithDevice_neuronDescriptor(
2652            this: Allocated<Self>,
2653            device: &ProtocolObject<dyn MTLDevice>,
2654            neuron_descriptor: &MPSNNNeuronDescriptor,
2655        ) -> Retained<Self>;
2656
2657        /// NSSecureCoding compatability
2658        ///
2659        /// While the standard NSSecureCoding/NSCoding method
2660        /// -initWithCoder: should work, since the file can't
2661        /// know which device your data is allocated on, we
2662        /// have to guess and may guess incorrectly.  To avoid
2663        /// that problem, use initWithCoder:device instead.
2664        ///
2665        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2666        ///
2667        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2668        ///
2669        /// Returns: A new MPSKernel object, or nil if failure.
2670        ///
2671        /// # Safety
2672        ///
2673        /// `a_decoder` possibly has further requirements.
2674        #[unsafe(method(initWithCoder:device:))]
2675        #[unsafe(method_family = init)]
2676        pub unsafe fn initWithCoder_device(
2677            this: Allocated<Self>,
2678            a_decoder: &NSCoder,
2679            device: &ProtocolObject<dyn MTLDevice>,
2680        ) -> Option<Retained<Self>>;
2681    );
2682}
2683
2684/// Methods declared on superclass `MPSKernel`.
2685#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2686impl MPSCNNNeuronExponential {
2687    extern_methods!(
2688        /// Called by NSCoder to decode MPSKernels
2689        ///
2690        /// This isn't the right interface to decode a MPSKernel, but
2691        /// it is the one that NSCoder uses. To enable your NSCoder
2692        /// (e.g. NSKeyedUnarchiver) to set which device to use
2693        /// extend the object to adopt the MPSDeviceProvider
2694        /// protocol. Otherwise, the Metal system default device
2695        /// will be used.
2696        ///
2697        /// # Safety
2698        ///
2699        /// `a_decoder` possibly has further requirements.
2700        #[unsafe(method(initWithCoder:))]
2701        #[unsafe(method_family = init)]
2702        pub unsafe fn initWithCoder(
2703            this: Allocated<Self>,
2704            a_decoder: &NSCoder,
2705        ) -> Option<Retained<Self>>;
2706    );
2707}
2708
2709/// Methods declared on superclass `NSObject`.
2710#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2711impl MPSCNNNeuronExponential {
2712    extern_methods!(
2713        #[unsafe(method(init))]
2714        #[unsafe(method_family = init)]
2715        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2716
2717        #[unsafe(method(new))]
2718        #[unsafe(method_family = new)]
2719        pub unsafe fn new() -> Retained<Self>;
2720    );
2721}
2722
2723extern_class!(
2724    /// Dependencies: This depends on Metal.framework.
2725    ///
2726    /// Specifies the Logarithm neuron filter.
2727    /// For each pixel, applies the following function: f(x) = log_c(a * x + b).
2728    ///
2729    /// If the value of c is -1.0f, the base (c) is set to e.
2730    ///
2731    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpscnnneuronlogarithm?language=objc)
2732    #[unsafe(super(MPSCNNNeuron, MPSCNNKernel, MPSKernel, NSObject))]
2733    #[derive(Debug, PartialEq, Eq, Hash)]
2734    #[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2735    pub struct MPSCNNNeuronLogarithm;
2736);
2737
2738#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2739extern_conformance!(
2740    unsafe impl NSCoding for MPSCNNNeuronLogarithm {}
2741);
2742
2743#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2744extern_conformance!(
2745    unsafe impl NSCopying for MPSCNNNeuronLogarithm {}
2746);
2747
2748#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2749unsafe impl CopyingHelper for MPSCNNNeuronLogarithm {
2750    type Result = Self;
2751}
2752
2753#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2754extern_conformance!(
2755    unsafe impl NSObjectProtocol for MPSCNNNeuronLogarithm {}
2756);
2757
2758#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2759extern_conformance!(
2760    unsafe impl NSSecureCoding for MPSCNNNeuronLogarithm {}
2761);
2762
2763#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2764impl MPSCNNNeuronLogarithm {
2765    extern_methods!(
2766        /// Initialize a Logarithm neuron filter.
2767        ///
2768        /// Parameter `device`: The device the filter will run on.
2769        ///
2770        /// Parameter `a`: Filter property "a". See class discussion.
2771        ///
2772        /// Parameter `b`: Filter property "b". See class discussion.
2773        ///
2774        /// Parameter `c`: Filter property "c". See class discussion.
2775        ///
2776        /// Returns: A valid MPSCNNNeuronLogarithm object or nil, if failure.
2777        #[deprecated]
2778        #[unsafe(method(initWithDevice:a:b:c:))]
2779        #[unsafe(method_family = init)]
2780        pub unsafe fn initWithDevice_a_b_c(
2781            this: Allocated<Self>,
2782            device: &ProtocolObject<dyn MTLDevice>,
2783            a: c_float,
2784            b: c_float,
2785            c: c_float,
2786        ) -> Retained<Self>;
2787
2788        #[unsafe(method(initWithDevice:))]
2789        #[unsafe(method_family = init)]
2790        pub unsafe fn initWithDevice(
2791            this: Allocated<Self>,
2792            device: &ProtocolObject<dyn MTLDevice>,
2793        ) -> Retained<Self>;
2794    );
2795}
2796
2797/// Methods declared on superclass `MPSCNNNeuron`.
2798#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2799impl MPSCNNNeuronLogarithm {
2800    extern_methods!(
2801        /// Initialize the neuron filter with a neuron descriptor.
2802        ///
2803        /// Parameter `device`: The device the filter will run on.
2804        ///
2805        /// Parameter `neuronDescriptor`: The neuron descriptor.
2806        /// For the neuron of type MPSCNNNeuronTypePReLU, the neuron
2807        /// descriptor references an NSData object containing a float array
2808        /// with the per feature channel value of PReLu parameter and, in this
2809        /// case, the MPSCNNNeuron retains the NSData object.
2810        ///
2811        /// Returns: A valid MPSCNNNeuron object or nil, if failure.
2812        #[unsafe(method(initWithDevice:neuronDescriptor:))]
2813        #[unsafe(method_family = init)]
2814        pub unsafe fn initWithDevice_neuronDescriptor(
2815            this: Allocated<Self>,
2816            device: &ProtocolObject<dyn MTLDevice>,
2817            neuron_descriptor: &MPSNNNeuronDescriptor,
2818        ) -> Retained<Self>;
2819
2820        /// NSSecureCoding compatability
2821        ///
2822        /// While the standard NSSecureCoding/NSCoding method
2823        /// -initWithCoder: should work, since the file can't
2824        /// know which device your data is allocated on, we
2825        /// have to guess and may guess incorrectly.  To avoid
2826        /// that problem, use initWithCoder:device instead.
2827        ///
2828        /// Parameter `aDecoder`: The NSCoder subclass with your serialized MPSKernel
2829        ///
2830        /// Parameter `device`: The MTLDevice on which to make the MPSKernel
2831        ///
2832        /// Returns: A new MPSKernel object, or nil if failure.
2833        ///
2834        /// # Safety
2835        ///
2836        /// `a_decoder` possibly has further requirements.
2837        #[unsafe(method(initWithCoder:device:))]
2838        #[unsafe(method_family = init)]
2839        pub unsafe fn initWithCoder_device(
2840            this: Allocated<Self>,
2841            a_decoder: &NSCoder,
2842            device: &ProtocolObject<dyn MTLDevice>,
2843        ) -> Option<Retained<Self>>;
2844    );
2845}
2846
2847/// Methods declared on superclass `MPSKernel`.
2848#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2849impl MPSCNNNeuronLogarithm {
2850    extern_methods!(
2851        /// Called by NSCoder to decode MPSKernels
2852        ///
2853        /// This isn't the right interface to decode a MPSKernel, but
2854        /// it is the one that NSCoder uses. To enable your NSCoder
2855        /// (e.g. NSKeyedUnarchiver) to set which device to use
2856        /// extend the object to adopt the MPSDeviceProvider
2857        /// protocol. Otherwise, the Metal system default device
2858        /// will be used.
2859        ///
2860        /// # Safety
2861        ///
2862        /// `a_decoder` possibly has further requirements.
2863        #[unsafe(method(initWithCoder:))]
2864        #[unsafe(method_family = init)]
2865        pub unsafe fn initWithCoder(
2866            this: Allocated<Self>,
2867            a_decoder: &NSCoder,
2868        ) -> Option<Retained<Self>>;
2869    );
2870}
2871
2872/// Methods declared on superclass `NSObject`.
2873#[cfg(all(feature = "MPSCNNKernel", feature = "MPSCore", feature = "MPSKernel"))]
2874impl MPSCNNNeuronLogarithm {
2875    extern_methods!(
2876        #[unsafe(method(init))]
2877        #[unsafe(method_family = init)]
2878        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
2879
2880        #[unsafe(method(new))]
2881        #[unsafe(method_family = new)]
2882        pub unsafe fn new() -> Retained<Self>;
2883    );
2884}