objc2_ml_compute/generated/
MLCTypes.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// A callback completion handler you execute when a graph finishes execution.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgraphcompletionhandler?language=objc)
13#[cfg(all(feature = "MLCTensor", feature = "block2"))]
14pub type MLCGraphCompletionHandler =
15    *mut block2::DynBlock<dyn Fn(*mut MLCTensor, *mut NSError, NSTimeInterval)>;
16
17/// A tensor data type.
18///
19/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcdatatype?language=objc)
20// NS_ENUM
21#[repr(transparent)]
22#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
23pub struct MLCDataType(pub i32);
24impl MLCDataType {
25    #[doc(alias = "MLCDataTypeInvalid")]
26    pub const Invalid: Self = Self(0);
27    /// The 32-bit floating-point data type.
28    #[doc(alias = "MLCDataTypeFloat32")]
29    pub const Float32: Self = Self(1);
30    /// The 16-bit floating-point data type.
31    #[doc(alias = "MLCDataTypeFloat16")]
32    pub const Float16: Self = Self(3);
33    /// The Boolean data type.
34    #[doc(alias = "MLCDataTypeBoolean")]
35    pub const Boolean: Self = Self(4);
36    /// The 64-bit integer data type.
37    #[doc(alias = "MLCDataTypeInt64")]
38    pub const Int64: Self = Self(5);
39    /// The 32-bit integer data type.
40    #[doc(alias = "MLCDataTypeInt32")]
41    pub const Int32: Self = Self(7);
42    /// The 8-bit integer data type.
43    #[doc(alias = "MLCDataTypeInt8")]
44    pub const Int8: Self = Self(8);
45    /// The 8-bit unsigned integer data type.
46    #[doc(alias = "MLCDataTypeUInt8")]
47    pub const UInt8: Self = Self(9);
48    /// The 8-bit unsigned integer data type.
49    #[doc(alias = "MLCDataTypeCount")]
50    pub const Count: Self = Self(10);
51}
52
53unsafe impl Encode for MLCDataType {
54    const ENCODING: Encoding = i32::ENCODING;
55}
56
57unsafe impl RefEncode for MLCDataType {
58    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
59}
60
61/// An initializer type you use to create a tensor with random data.
62///
63/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcrandominitializertype?language=objc)
64// NS_ENUM
65#[repr(transparent)]
66#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
67pub struct MLCRandomInitializerType(pub i32);
68impl MLCRandomInitializerType {
69    #[doc(alias = "MLCRandomInitializerTypeInvalid")]
70    pub const Invalid: Self = Self(0);
71    /// The uniform random initializer type.
72    #[doc(alias = "MLCRandomInitializerTypeUniform")]
73    pub const Uniform: Self = Self(1);
74    /// The glorot uniform random initializer type.
75    #[doc(alias = "MLCRandomInitializerTypeGlorotUniform")]
76    pub const GlorotUniform: Self = Self(2);
77    /// The Xavier random initializer type.
78    #[doc(alias = "MLCRandomInitializerTypeXavier")]
79    pub const Xavier: Self = Self(3);
80    /// The Xavier random initializer type.
81    #[doc(alias = "MLCRandomInitializerTypeCount")]
82    pub const Count: Self = Self(4);
83}
84
85unsafe impl Encode for MLCRandomInitializerType {
86    const ENCODING: Encoding = i32::ENCODING;
87}
88
89unsafe impl RefEncode for MLCRandomInitializerType {
90    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
91}
92
93/// A device type for execution of a neural network.
94///
95/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcdevicetype?language=objc)
96// NS_ENUM
97#[repr(transparent)]
98#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
99pub struct MLCDeviceType(pub i32);
100impl MLCDeviceType {
101    /// The CPU device
102    #[doc(alias = "MLCDeviceTypeCPU")]
103    pub const CPU: Self = Self(0);
104    /// The GPU device.
105    #[doc(alias = "MLCDeviceTypeGPU")]
106    pub const GPU: Self = Self(1);
107    /// The any device type.  When selected, the framework will automatically use the appropriate devices to achieve the best
108    /// performance.
109    #[doc(alias = "MLCDeviceTypeAny")]
110    pub const Any: Self = Self(2);
111    /// The  Apple Neural Engine device.  When selected, the framework will use the  Neural Engine to execute all layers that can be executed on it.
112    /// Layers that cannot be executed on the ANE will run on the CPU or GPU.   The Neural Engine device must be explicitly selected.  MLDeviceTypeAny
113    /// will not select the Neural Engine device.  In addition, this device can be used with inference graphs only.  This device cannot be used with a
114    /// training graph or an inference graph that shares layers with a training graph.
115    #[doc(alias = "MLCDeviceTypeANE")]
116    pub const ANE: Self = Self(3);
117    /// The  Apple Neural Engine device.  When selected, the framework will use the  Neural Engine to execute all layers that can be executed on it.
118    /// Layers that cannot be executed on the ANE will run on the CPU or GPU.   The Neural Engine device must be explicitly selected.  MLDeviceTypeAny
119    /// will not select the Neural Engine device.  In addition, this device can be used with inference graphs only.  This device cannot be used with a
120    /// training graph or an inference graph that shares layers with a training graph.
121    #[doc(alias = "MLCDeviceTypeCount")]
122    pub const Count: Self = Self(4);
123}
124
125unsafe impl Encode for MLCDeviceType {
126    const ENCODING: Encoding = i32::ENCODING;
127}
128
129unsafe impl RefEncode for MLCDeviceType {
130    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
131}
132
133/// A bitmask that specifies the options you use when compiling a graph.
134///
135/// This is passed as an argument to the compileWithOptions method avalable on MLCTrainingGraph and MLCInferenceGraph
136///
137/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgraphcompilationoptions?language=objc)
138// NS_OPTIONS
139#[repr(transparent)]
140#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
141pub struct MLCGraphCompilationOptions(pub u64);
142bitflags::bitflags! {
143    impl MLCGraphCompilationOptions: u64 {
144/// No graph compilation options.
145        #[doc(alias = "MLCGraphCompilationOptionsNone")]
146        const None = 0x00;
147/// The option to debug layers during graph compilation.
148///
149///
150/// Include this option to disable various optimizations such as layer fusion, and ensure the framework synchronizes
151/// the resulting forward and gradients tensors host memory with device memory, for layers marked as debuggable.
152        #[doc(alias = "MLCGraphCompilationOptionsDebugLayers")]
153        const DebugLayers = 0x01;
154/// The option to disable layer fusion during graph compilation.
155///
156///
157/// Include this option to disable fusion of layers, which is an important optimization that helps performance and
158/// memory footprint.
159        #[doc(alias = "MLCGraphCompilationOptionsDisableLayerFusion")]
160        const DisableLayerFusion = 0x02;
161/// The option to link graphs during graph compilation.
162///
163///
164/// Include this option when you link together one or more sub-graphs when executing the forward, gradient, and
165/// optimizer update. For example, if the full computation graph includes a layer that the framework doesn’t support, you’ll
166/// need to create multiple sub-graphs and link them together using
167/// `MLCGraphCompilationOptionsLinkGraphs.`When doing so,
168/// include this option when you call
169/// `-compileWithOptions:`for graphs you want to link together.
170        #[doc(alias = "MLCGraphCompilationOptionsLinkGraphs")]
171        const LinkGraphs = 0x04;
172/// The option to compute all gradients during graph compilation.
173///
174///
175/// Include this option to compute gradients for layers with or without parameters that only take input tensors.
176/// For example, if the first layer of a graph is a convolution layer, the framework only computes the gradients for weights
177/// and biases associated with the convolution layer, but not the gradients for the input. Include this option if you want to
178/// compute all gradients for the input.
179        #[doc(alias = "MLCGraphCompilationOptionsComputeAllGradients")]
180        const ComputeAllGradients = 0x08;
181    }
182}
183
184unsafe impl Encode for MLCGraphCompilationOptions {
185    const ENCODING: Encoding = u64::ENCODING;
186}
187
188unsafe impl RefEncode for MLCGraphCompilationOptions {
189    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
190}
191
192/// A bitmask that specifies the options you’ll use when executing a graph.
193///
194/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcexecutionoptions?language=objc)
195// NS_OPTIONS
196#[repr(transparent)]
197#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
198pub struct MLCExecutionOptions(pub u64);
199bitflags::bitflags! {
200    impl MLCExecutionOptions: u64 {
201        #[doc(alias = "MLCExecutionOptionsNone")]
202        const None = 0x00;
203/// The option to skip writing input data to device memory.
204///
205///
206/// this option to prevent writing the input tensors to device memory associated with these tensors when the framework
207/// executes the graph.
208        #[doc(alias = "MLCExecutionOptionsSkipWritingInputDataToDevice")]
209        const SkipWritingInputDataToDevice = 0x01;
210/// The option to execute the graph synchronously.
211///
212///
213/// Include this option to wait until execution of the graph on specified device finishes before returning from the
214/// `execute`method.
215        #[doc(alias = "MLCExecutionOptionsSynchronous")]
216        const Synchronous = 0x02;
217/// The option to return profiling information in the callback before returning from execution.
218///
219///
220/// Include this option to return profliling information in the graph execute completion handler callback, including
221/// device execution time.
222        #[doc(alias = "MLCExecutionOptionsProfiling")]
223        const Profiling = 0x04;
224/// The option to execute the forward pass for inference only.
225///
226///
227/// If you include this option and execute a training graph using one of the
228/// `execute`methods, such as
229/// `-executeWithInputsData:lossLabelsData:lossLabelWeightsData:batchSize:options:completionHandler:`, the framework only
230/// executes the forward pass of the training graph, and it executes that forward pass for inference only.
231///
232/// If you include this option and execute a training graph using one of the executeForward methods, such as
233/// `-executeForwardWithBatchSize:options:completionHandler:),`the framework executes the forward pass for inference only.
234        #[doc(alias = "MLCExecutionOptionsForwardForInference")]
235        const ForwardForInference = 0x08;
236/// The option to enable additional per layer profiling information currently emitted using signposts.
237///
238///
239/// The option to enable per layer profiling information emitted as signposts. The per layer information
240/// can be visualized using the Logging Instrument in Xcode's Instruments. This information may not be available for all MLCDevice.
241        #[doc(alias = "MLCExecutionOptionsPerLayerProfiling")]
242        const PerLayerProfiling = 0x10;
243    }
244}
245
246unsafe impl Encode for MLCExecutionOptions {
247    const ENCODING: Encoding = u64::ENCODING;
248}
249
250unsafe impl RefEncode for MLCExecutionOptions {
251    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
252}
253
254/// The list of supported arithmetic operations.
255///
256/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcarithmeticoperation?language=objc)
257// NS_ENUM
258#[repr(transparent)]
259#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
260pub struct MLCArithmeticOperation(pub i32);
261impl MLCArithmeticOperation {
262    /// An operation that calculates the elementwise sum of its two inputs.
263    #[doc(alias = "MLCArithmeticOperationAdd")]
264    pub const Add: Self = Self(0);
265    /// An operation that calculates the elementwise difference of its two inputs.
266    #[doc(alias = "MLCArithmeticOperationSubtract")]
267    pub const Subtract: Self = Self(1);
268    /// An operation that calculates the elementwise product of its two inputs.
269    #[doc(alias = "MLCArithmeticOperationMultiply")]
270    pub const Multiply: Self = Self(2);
271    /// An operation that calculates the elementwise division of its two inputs.
272    #[doc(alias = "MLCArithmeticOperationDivide")]
273    pub const Divide: Self = Self(3);
274    /// An operation that calculates the elementwise floor of its two inputs.
275    #[doc(alias = "MLCArithmeticOperationFloor")]
276    pub const Floor: Self = Self(4);
277    /// An operation that calculates the elementwise round of its inputs.
278    #[doc(alias = "MLCArithmeticOperationRound")]
279    pub const Round: Self = Self(5);
280    /// An operation that calculates the elementwise ceiling of its inputs.
281    #[doc(alias = "MLCArithmeticOperationCeil")]
282    pub const Ceil: Self = Self(6);
283    /// An operation that calculates the elementwise square root of its inputs.
284    #[doc(alias = "MLCArithmeticOperationSqrt")]
285    pub const Sqrt: Self = Self(7);
286    /// An operation that calculates the elementwise reciprocal of the square root of its inputs.
287    #[doc(alias = "MLCArithmeticOperationRsqrt")]
288    pub const Rsqrt: Self = Self(8);
289    /// An operation that calculates the elementwise sine of its inputs.
290    #[doc(alias = "MLCArithmeticOperationSin")]
291    pub const Sin: Self = Self(9);
292    /// An operation that calculates the elementwise cosine of its inputs.
293    #[doc(alias = "MLCArithmeticOperationCos")]
294    pub const Cos: Self = Self(10);
295    /// An operation that calculates the elementwise tangent of its inputs.
296    #[doc(alias = "MLCArithmeticOperationTan")]
297    pub const Tan: Self = Self(11);
298    /// An operation that calculates the elementwise inverse sine of its inputs.
299    #[doc(alias = "MLCArithmeticOperationAsin")]
300    pub const Asin: Self = Self(12);
301    /// An operation that calculates the elementwise inverse cosine of its inputs.
302    #[doc(alias = "MLCArithmeticOperationAcos")]
303    pub const Acos: Self = Self(13);
304    /// An operation that calculates the elementwise inverse tangent of its inputs.
305    #[doc(alias = "MLCArithmeticOperationAtan")]
306    pub const Atan: Self = Self(14);
307    /// An operation that calculates the elementwise hyperbolic sine of its inputs.
308    #[doc(alias = "MLCArithmeticOperationSinh")]
309    pub const Sinh: Self = Self(15);
310    /// An operation that calculates the elementwise hyperbolic cosine of its inputs.
311    #[doc(alias = "MLCArithmeticOperationCosh")]
312    pub const Cosh: Self = Self(16);
313    /// An operation that calculates the elementwise hyperbolic tangent of its inputs.
314    #[doc(alias = "MLCArithmeticOperationTanh")]
315    pub const Tanh: Self = Self(17);
316    /// An operation that calculates the elementwise inverse hyperbolic sine of its inputs.
317    #[doc(alias = "MLCArithmeticOperationAsinh")]
318    pub const Asinh: Self = Self(18);
319    /// An operation that calculates the elementwise inverse hyperbolic cosine of its inputs.
320    #[doc(alias = "MLCArithmeticOperationAcosh")]
321    pub const Acosh: Self = Self(19);
322    /// An operation that calculates the elementwise inverse hyperbolic tangent of its inputs.
323    #[doc(alias = "MLCArithmeticOperationAtanh")]
324    pub const Atanh: Self = Self(20);
325    /// An operation that calculates the elementwise first input raised to the power of its second input.
326    #[doc(alias = "MLCArithmeticOperationPow")]
327    pub const Pow: Self = Self(21);
328    /// An operation that calculates the elementwise result of e raised to the power of its input.
329    #[doc(alias = "MLCArithmeticOperationExp")]
330    pub const Exp: Self = Self(22);
331    /// An operation that calculates the elementwise result of 2 raised to the power of its input.
332    #[doc(alias = "MLCArithmeticOperationExp2")]
333    pub const Exp2: Self = Self(23);
334    /// An operation that calculates the elementwise natural logarithm of its input.
335    #[doc(alias = "MLCArithmeticOperationLog")]
336    pub const Log: Self = Self(24);
337    /// An operation that calculates the elementwise base 2 logarithm of its input.
338    #[doc(alias = "MLCArithmeticOperationLog2")]
339    pub const Log2: Self = Self(25);
340    /// An operation that calculates the elementwise product of its two inputs.  Returns 0 if y in x * y is zero, even if x is NaN or INF
341    #[doc(alias = "MLCArithmeticOperationMultiplyNoNaN")]
342    pub const MultiplyNoNaN: Self = Self(26);
343    /// An operations that calculates the elementwise division of its two inputs.  Returns 0 if the denominator is 0.
344    #[doc(alias = "MLCArithmeticOperationDivideNoNaN")]
345    pub const DivideNoNaN: Self = Self(27);
346    /// An operation that calculates the elementwise min of two inputs.
347    #[doc(alias = "MLCArithmeticOperationMin")]
348    pub const Min: Self = Self(28);
349    /// An operations that calculates the elementwise max of two inputs.
350    #[doc(alias = "MLCArithmeticOperationMax")]
351    pub const Max: Self = Self(29);
352    /// An operations that calculates the elementwise max of two inputs.
353    #[doc(alias = "MLCArithmeticOperationCount")]
354    pub const Count: Self = Self(30);
355}
356
357unsafe impl Encode for MLCArithmeticOperation {
358    const ENCODING: Encoding = i32::ENCODING;
359}
360
361unsafe impl RefEncode for MLCArithmeticOperation {
362    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
363}
364
365/// A loss function.
366///
367/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclosstype?language=objc)
368// NS_ENUM
369#[repr(transparent)]
370#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
371pub struct MLCLossType(pub i32);
372impl MLCLossType {
373    /// The mean absolute error loss.
374    #[doc(alias = "MLCLossTypeMeanAbsoluteError")]
375    pub const MeanAbsoluteError: Self = Self(0);
376    /// The mean squared error loss.
377    #[doc(alias = "MLCLossTypeMeanSquaredError")]
378    pub const MeanSquaredError: Self = Self(1);
379    /// The softmax cross entropy loss.
380    #[doc(alias = "MLCLossTypeSoftmaxCrossEntropy")]
381    pub const SoftmaxCrossEntropy: Self = Self(2);
382    /// The sigmoid cross entropy loss.
383    #[doc(alias = "MLCLossTypeSigmoidCrossEntropy")]
384    pub const SigmoidCrossEntropy: Self = Self(3);
385    /// The categorical cross entropy loss.
386    #[doc(alias = "MLCLossTypeCategoricalCrossEntropy")]
387    pub const CategoricalCrossEntropy: Self = Self(4);
388    /// The hinge loss.
389    #[doc(alias = "MLCLossTypeHinge")]
390    pub const Hinge: Self = Self(5);
391    /// The Huber loss.
392    #[doc(alias = "MLCLossTypeHuber")]
393    pub const Huber: Self = Self(6);
394    /// The cosine distance loss.
395    #[doc(alias = "MLCLossTypeCosineDistance")]
396    pub const CosineDistance: Self = Self(7);
397    /// The log loss.
398    #[doc(alias = "MLCLossTypeLog")]
399    pub const Log: Self = Self(8);
400    /// The log loss.
401    #[doc(alias = "MLCLossTypeCount")]
402    pub const Count: Self = Self(9);
403}
404
405unsafe impl Encode for MLCLossType {
406    const ENCODING: Encoding = i32::ENCODING;
407}
408
409unsafe impl RefEncode for MLCLossType {
410    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
411}
412
413/// An activation type that you specify for an activation descriptor.
414///
415/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcactivationtype?language=objc)
416// NS_ENUM
417#[repr(transparent)]
418#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
419pub struct MLCActivationType(pub i32);
420impl MLCActivationType {
421    /// The identity activation type.
422    #[doc(alias = "MLCActivationTypeNone")]
423    pub const None: Self = Self(0);
424    /// The ReLU activation type.
425    ///
426    /// This activation type implements the following function:
427    ///
428    /// ```text
429    ///   f(x) = x >= 0 ? x : a * x
430    /// ```
431    #[doc(alias = "MLCActivationTypeReLU")]
432    pub const ReLU: Self = Self(1);
433    /// The linear activation type.
434    ///
435    /// This activation type implements the following function:
436    ///
437    /// ```text
438    ///   f(x) = a * x + b
439    /// ```
440    #[doc(alias = "MLCActivationTypeLinear")]
441    pub const Linear: Self = Self(2);
442    /// The sigmoid activation type.
443    ///
444    /// This activation type implements the following function:
445    ///
446    /// ```text
447    ///   f(x) = 1 / (1 + e⁻ˣ)
448    /// ```
449    #[doc(alias = "MLCActivationTypeSigmoid")]
450    pub const Sigmoid: Self = Self(3);
451    /// The hard sigmoid activation type.
452    ///
453    /// This activation type implements the following function:
454    ///
455    /// ```text
456    ///   f(x) = clamp((x * a) + b, 0, 1)
457    /// ```
458    #[doc(alias = "MLCActivationTypeHardSigmoid")]
459    pub const HardSigmoid: Self = Self(4);
460    /// The hyperbolic tangent (TanH) activation type.
461    ///
462    /// This activation type implements the following function:
463    ///
464    /// ```text
465    ///   f(x) = a * tanh(b * x)
466    /// ```
467    #[doc(alias = "MLCActivationTypeTanh")]
468    pub const Tanh: Self = Self(5);
469    /// The absolute activation type.
470    ///
471    /// This activation type implements the following function:
472    ///
473    /// ```text
474    ///   f(x) = fabs(x)
475    /// ```
476    #[doc(alias = "MLCActivationTypeAbsolute")]
477    pub const Absolute: Self = Self(6);
478    /// The parametric soft plus activation type.
479    ///
480    /// This activation type implements the following function:
481    ///
482    /// ```text
483    ///   f(x) = a * log(1 + e^(b * x))
484    /// ```
485    #[doc(alias = "MLCActivationTypeSoftPlus")]
486    pub const SoftPlus: Self = Self(7);
487    /// The parametric soft sign activation type.
488    ///
489    /// This activation type implements the following function:
490    ///
491    /// ```text
492    ///   f(x) = x / (1 + abs(x))
493    ///   \endcod
494    ///      
495    ///
496    /// ```
497    #[doc(alias = "MLCActivationTypeSoftSign")]
498    pub const SoftSign: Self = Self(8);
499    /// The parametric ELU activation type.
500    ///
501    /// This activation type implements the following function:
502    ///
503    /// ```text
504    ///   f(x) = x >= 0 ? x : a * (exp(x) - 1)
505    /// ```
506    #[doc(alias = "MLCActivationTypeELU")]
507    pub const ELU: Self = Self(9);
508    /// The ReLUN activation type.
509    ///
510    /// This activation type implements the following function:
511    ///
512    /// ```text
513    ///   f(x) = min((x >= 0 ? x : a * x), b)
514    /// ```
515    #[doc(alias = "MLCActivationTypeReLUN")]
516    pub const ReLUN: Self = Self(10);
517    /// The log sigmoid activation type.
518    ///
519    /// This activation type implements the following function:
520    ///
521    /// ```text
522    ///   f(x) = log(1 / (1 + exp(-x)))
523    /// ```
524    #[doc(alias = "MLCActivationTypeLogSigmoid")]
525    pub const LogSigmoid: Self = Self(11);
526    /// The SELU activation type.
527    ///
528    /// This activation type implements the following function:
529    ///
530    /// ```text
531    ///   f(x) = scale * (max(0, x) + min(0, α * (exp(x) − 1)))
532    /// ```
533    ///
534    /// where:
535    ///
536    /// ```text
537    ///   α = 1.6732632423543772848170429916717
538    ///   scale = 1.0507009873554804934193349852946
539    /// ```
540    #[doc(alias = "MLCActivationTypeSELU")]
541    pub const SELU: Self = Self(12);
542    /// The CELU activation type.
543    ///
544    /// This activation type implements the following function:
545    ///
546    /// ```text
547    ///   f(x) = max(0, x) + min(0, a * (exp(x / a) − 1))
548    /// ```
549    #[doc(alias = "MLCActivationTypeCELU")]
550    pub const CELU: Self = Self(13);
551    /// The hard shrink activation type.
552    ///
553    /// This activation type implements the following function:
554    ///
555    /// ```text
556    ///   f(x) = x, if x > a or x < −a, else 0
557    /// ```
558    #[doc(alias = "MLCActivationTypeHardShrink")]
559    pub const HardShrink: Self = Self(14);
560    /// The soft shrink activation type.
561    ///
562    /// This activation type implements the following function:
563    ///
564    /// ```text
565    ///   f(x) = x - a, if x > a, x + a, if x < −a, else 0
566    /// ```
567    #[doc(alias = "MLCActivationTypeSoftShrink")]
568    pub const SoftShrink: Self = Self(15);
569    /// The hyperbolic tangent (TanH) shrink activation type.
570    ///
571    /// This activation type implements the following function:
572    ///
573    /// ```text
574    ///   f(x) = x - tanh(x)
575    /// ```
576    #[doc(alias = "MLCActivationTypeTanhShrink")]
577    pub const TanhShrink: Self = Self(16);
578    /// The threshold activation type.
579    ///
580    /// This activation type implements the following function:
581    ///
582    /// ```text
583    ///   f(x) = x, if x > a, else b
584    /// ```
585    #[doc(alias = "MLCActivationTypeThreshold")]
586    pub const Threshold: Self = Self(17);
587    /// The GELU activation type.
588    ///
589    /// This activation type implements the following function:
590    ///
591    /// ```text
592    ///   f(x) = x * CDF(x)
593    /// ```
594    #[doc(alias = "MLCActivationTypeGELU")]
595    pub const GELU: Self = Self(18);
596    /// The hardswish activation type.
597    ///
598    /// This activation type implements the following function:
599    ///
600    /// ```text
601    ///   f(x) = 0, if x <= -3
602    ///   f(x) = x, if x >= +3
603    ///   f(x) = x * (x + 3)/6, otherwise
604    /// ```
605    #[doc(alias = "MLCActivationTypeHardSwish")]
606    pub const HardSwish: Self = Self(19);
607    /// The clamp activation type.
608    ///
609    /// This activation type implements the following function:
610    ///
611    /// ```text
612    ///   f(x) = min(max(x, a), b)
613    /// ```
614    #[doc(alias = "MLCActivationTypeClamp")]
615    pub const Clamp: Self = Self(20);
616    /// The clamp activation type.
617    ///
618    /// This activation type implements the following function:
619    ///
620    /// ```text
621    ///   f(x) = min(max(x, a), b)
622    /// ```
623    #[doc(alias = "MLCActivationTypeCount")]
624    pub const Count: Self = Self(21);
625}
626
627unsafe impl Encode for MLCActivationType {
628    const ENCODING: Encoding = i32::ENCODING;
629}
630
631unsafe impl RefEncode for MLCActivationType {
632    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
633}
634
635/// A convolution type that you specify for a convolution descriptor.
636///
637/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcconvolutiontype?language=objc)
638// NS_ENUM
639#[repr(transparent)]
640#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
641pub struct MLCConvolutionType(pub i32);
642impl MLCConvolutionType {
643    /// The standard convolution type.
644    #[doc(alias = "MLCConvolutionTypeStandard")]
645    pub const Standard: Self = Self(0);
646    /// The transposed convolution type.
647    #[doc(alias = "MLCConvolutionTypeTransposed")]
648    pub const Transposed: Self = Self(1);
649    /// The depthwise convolution type.
650    #[doc(alias = "MLCConvolutionTypeDepthwise")]
651    pub const Depthwise: Self = Self(2);
652}
653
654unsafe impl Encode for MLCConvolutionType {
655    const ENCODING: Encoding = i32::ENCODING;
656}
657
658unsafe impl RefEncode for MLCConvolutionType {
659    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
660}
661
662/// A padding policy that you specify for a convolution or pooling layer.
663///
664/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcpaddingpolicy?language=objc)
665// NS_ENUM
666#[repr(transparent)]
667#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
668pub struct MLCPaddingPolicy(pub i32);
669impl MLCPaddingPolicy {
670    /// The "same" padding policy.
671    #[doc(alias = "MLCPaddingPolicySame")]
672    pub const Same: Self = Self(0);
673    /// The "valid" padding policy.
674    #[doc(alias = "MLCPaddingPolicyValid")]
675    pub const Valid: Self = Self(1);
676    /// The choice to use explicitly specified padding sizes.
677    #[doc(alias = "MLCPaddingPolicyUsePaddingSize")]
678    pub const UsePaddingSize: Self = Self(2);
679}
680
681unsafe impl Encode for MLCPaddingPolicy {
682    const ENCODING: Encoding = i32::ENCODING;
683}
684
685unsafe impl RefEncode for MLCPaddingPolicy {
686    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
687}
688
689/// A padding type that you specify for a padding layer.
690///
691/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcpaddingtype?language=objc)
692// NS_ENUM
693#[repr(transparent)]
694#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
695pub struct MLCPaddingType(pub i32);
696impl MLCPaddingType {
697    /// The zero padding type.
698    #[doc(alias = "MLCPaddingTypeZero")]
699    pub const Zero: Self = Self(0);
700    /// The reflect padding type.
701    #[doc(alias = "MLCPaddingTypeReflect")]
702    pub const Reflect: Self = Self(1);
703    /// The symmetric padding type.
704    #[doc(alias = "MLCPaddingTypeSymmetric")]
705    pub const Symmetric: Self = Self(2);
706    /// The constant padding type.
707    #[doc(alias = "MLCPaddingTypeConstant")]
708    pub const Constant: Self = Self(3);
709}
710
711unsafe impl Encode for MLCPaddingType {
712    const ENCODING: Encoding = i32::ENCODING;
713}
714
715unsafe impl RefEncode for MLCPaddingType {
716    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
717}
718
719/// A pooling function type for a pooling layer.
720///
721/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcpoolingtype?language=objc)
722// NS_ENUM
723#[repr(transparent)]
724#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
725pub struct MLCPoolingType(pub i32);
726impl MLCPoolingType {
727    /// The max pooling type.
728    #[doc(alias = "MLCPoolingTypeMax")]
729    pub const Max: Self = Self(1);
730    /// The average pooling type.
731    #[doc(alias = "MLCPoolingTypeAverage")]
732    pub const Average: Self = Self(2);
733    /// The L2-norm pooling type.
734    #[doc(alias = "MLCPoolingTypeL2Norm")]
735    pub const L2Norm: Self = Self(3);
736    /// The L2-norm pooling type.
737    #[doc(alias = "MLCPoolingTypeCount")]
738    pub const Count: Self = Self(4);
739}
740
741unsafe impl Encode for MLCPoolingType {
742    const ENCODING: Encoding = i32::ENCODING;
743}
744
745unsafe impl RefEncode for MLCPoolingType {
746    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
747}
748
749/// A reduction operation type.
750///
751/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcreductiontype?language=objc)
752// NS_ENUM
753#[repr(transparent)]
754#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
755pub struct MLCReductionType(pub i32);
756impl MLCReductionType {
757    /// No reduction.
758    #[doc(alias = "MLCReductionTypeNone")]
759    pub const None: Self = Self(0);
760    /// The sum reduction.
761    #[doc(alias = "MLCReductionTypeSum")]
762    pub const Sum: Self = Self(1);
763    /// The mean reduction.
764    #[doc(alias = "MLCReductionTypeMean")]
765    pub const Mean: Self = Self(2);
766    /// The max reduction.
767    #[doc(alias = "MLCReductionTypeMax")]
768    pub const Max: Self = Self(3);
769    /// The min reduction.
770    #[doc(alias = "MLCReductionTypeMin")]
771    pub const Min: Self = Self(4);
772    /// The argmax reduction.
773    #[doc(alias = "MLCReductionTypeArgMax")]
774    pub const ArgMax: Self = Self(5);
775    /// The argmin reduction.
776    #[doc(alias = "MLCReductionTypeArgMin")]
777    pub const ArgMin: Self = Self(6);
778    /// The L1norm reduction.
779    #[doc(alias = "MLCReductionTypeL1Norm")]
780    pub const L1Norm: Self = Self(7);
781    /// Any(X) = X_0 || X_1 || ... X_n
782    #[doc(alias = "MLCReductionTypeAny")]
783    pub const Any: Self = Self(8);
784    /// Alf(X) = X_0
785    /// &
786    /// &
787    /// X_1
788    /// &
789    /// &
790    /// ... X_n
791    #[doc(alias = "MLCReductionTypeAll")]
792    pub const All: Self = Self(9);
793    /// Alf(X) = X_0
794    /// &
795    /// &
796    /// X_1
797    /// &
798    /// &
799    /// ... X_n
800    #[doc(alias = "MLCReductionTypeCount")]
801    pub const Count: Self = Self(10);
802}
803
804unsafe impl Encode for MLCReductionType {
805    const ENCODING: Encoding = i32::ENCODING;
806}
807
808unsafe impl RefEncode for MLCReductionType {
809    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
810}
811
812/// [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcregularizationtype?language=objc)
813// NS_ENUM
814#[repr(transparent)]
815#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
816pub struct MLCRegularizationType(pub i32);
817impl MLCRegularizationType {
818    /// No regularization.
819    #[doc(alias = "MLCRegularizationTypeNone")]
820    pub const None: Self = Self(0);
821    /// The L1 regularization.
822    #[doc(alias = "MLCRegularizationTypeL1")]
823    pub const L1: Self = Self(1);
824    /// The L2 regularization.
825    #[doc(alias = "MLCRegularizationTypeL2")]
826    pub const L2: Self = Self(2);
827}
828
829unsafe impl Encode for MLCRegularizationType {
830    const ENCODING: Encoding = i32::ENCODING;
831}
832
833unsafe impl RefEncode for MLCRegularizationType {
834    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
835}
836
837/// A sampling mode for an upsample layer.
838///
839/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcsamplemode?language=objc)
840// NS_ENUM
841#[repr(transparent)]
842#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
843pub struct MLCSampleMode(pub i32);
844impl MLCSampleMode {
845    /// The nearest sample mode.
846    #[doc(alias = "MLCSampleModeNearest")]
847    pub const Nearest: Self = Self(0);
848    /// The linear sample mode.
849    #[doc(alias = "MLCSampleModeLinear")]
850    pub const Linear: Self = Self(1);
851}
852
853unsafe impl Encode for MLCSampleMode {
854    const ENCODING: Encoding = i32::ENCODING;
855}
856
857unsafe impl RefEncode for MLCSampleMode {
858    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
859}
860
861/// A softmax operation.
862///
863/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcsoftmaxoperation?language=objc)
864// NS_ENUM
865#[repr(transparent)]
866#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
867pub struct MLCSoftmaxOperation(pub i32);
868impl MLCSoftmaxOperation {
869    /// The standard softmax operation.
870    #[doc(alias = "MLCSoftmaxOperationSoftmax")]
871    pub const Softmax: Self = Self(0);
872    /// The log softmax operation.
873    #[doc(alias = "MLCSoftmaxOperationLogSoftmax")]
874    pub const LogSoftmax: Self = Self(1);
875}
876
877unsafe impl Encode for MLCSoftmaxOperation {
878    const ENCODING: Encoding = i32::ENCODING;
879}
880
881unsafe impl RefEncode for MLCSoftmaxOperation {
882    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
883}
884
885/// A result mode for an LSTM layer.
886///
887/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclstmresultmode?language=objc)
888// NS_ENUM
889#[repr(transparent)]
890#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
891pub struct MLCLSTMResultMode(pub u64);
892impl MLCLSTMResultMode {
893    /// The output result mode. When selected for an LSTM layer, the layer will produce a single result tensor representing the final output of the LSTM.
894    #[doc(alias = "MLCLSTMResultModeOutput")]
895    pub const Output: Self = Self(0);
896    /// The output and states result mode. When selected for an LSTM layer, the layer will produce three result tensors representing the final output of
897    /// the LSTM, the last hidden state, and the cell state, respectively.
898    #[doc(alias = "MLCLSTMResultModeOutputAndStates")]
899    pub const OutputAndStates: Self = Self(1);
900}
901
902unsafe impl Encode for MLCLSTMResultMode {
903    const ENCODING: Encoding = u64::ENCODING;
904}
905
906unsafe impl RefEncode for MLCLSTMResultMode {
907    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
908}
909
910/// A comparison operation.
911///
912/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlccomparisonoperation?language=objc)
913// NS_ENUM
914#[repr(transparent)]
915#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
916pub struct MLCComparisonOperation(pub i32);
917impl MLCComparisonOperation {
918    #[doc(alias = "MLCComparisonOperationEqual")]
919    pub const Equal: Self = Self(0);
920    #[doc(alias = "MLCComparisonOperationNotEqual")]
921    pub const NotEqual: Self = Self(1);
922    #[doc(alias = "MLCComparisonOperationLess")]
923    pub const Less: Self = Self(2);
924    #[doc(alias = "MLCComparisonOperationGreater")]
925    pub const Greater: Self = Self(3);
926    #[doc(alias = "MLCComparisonOperationLessOrEqual")]
927    pub const LessOrEqual: Self = Self(4);
928    #[doc(alias = "MLCComparisonOperationGreaterOrEqual")]
929    pub const GreaterOrEqual: Self = Self(5);
930    #[doc(alias = "MLCComparisonOperationLogicalAND")]
931    pub const LogicalAND: Self = Self(6);
932    #[doc(alias = "MLCComparisonOperationLogicalOR")]
933    pub const LogicalOR: Self = Self(7);
934    #[doc(alias = "MLCComparisonOperationLogicalNOT")]
935    pub const LogicalNOT: Self = Self(8);
936    #[doc(alias = "MLCComparisonOperationLogicalNAND")]
937    pub const LogicalNAND: Self = Self(9);
938    #[doc(alias = "MLCComparisonOperationLogicalNOR")]
939    pub const LogicalNOR: Self = Self(10);
940    #[doc(alias = "MLCComparisonOperationLogicalXOR")]
941    pub const LogicalXOR: Self = Self(11);
942    #[doc(alias = "MLCComparisonOperationCount")]
943    pub const Count: Self = Self(12);
944}
945
946unsafe impl Encode for MLCComparisonOperation {
947    const ENCODING: Encoding = i32::ENCODING;
948}
949
950unsafe impl RefEncode for MLCComparisonOperation {
951    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
952}
953
954/// The type of clipping applied to gradient
955///
956/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgradientclippingtype?language=objc)
957// NS_ENUM
958#[repr(transparent)]
959#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
960pub struct MLCGradientClippingType(pub i32);
961impl MLCGradientClippingType {
962    #[doc(alias = "MLCGradientClippingTypeByValue")]
963    pub const ByValue: Self = Self(0);
964    #[doc(alias = "MLCGradientClippingTypeByNorm")]
965    pub const ByNorm: Self = Self(1);
966    #[doc(alias = "MLCGradientClippingTypeByGlobalNorm")]
967    pub const ByGlobalNorm: Self = Self(2);
968}
969
970unsafe impl Encode for MLCGradientClippingType {
971    const ENCODING: Encoding = i32::ENCODING;
972}
973
974unsafe impl RefEncode for MLCGradientClippingType {
975    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
976}
977
978impl MLCActivationType {
979    /// Returns a textual description of the activation type, suitable for debugging.
980    #[doc(alias = "MLCActivationTypeDebugDescription")]
981    #[inline]
982    pub unsafe fn debug_description(self: MLCActivationType) -> Retained<NSString> {
983        extern "C-unwind" {
984            fn MLCActivationTypeDebugDescription(
985                activation_type: MLCActivationType,
986            ) -> *mut NSString;
987        }
988        let ret = unsafe { MLCActivationTypeDebugDescription(self) };
989        unsafe { Retained::retain_autoreleased(ret) }
990            .expect("function was marked as returning non-null, but actually returned NULL")
991    }
992}
993
994impl MLCArithmeticOperation {
995    /// Returns a textual description of the arithmetic operation, suitable for debugging.
996    #[doc(alias = "MLCArithmeticOperationDebugDescription")]
997    #[inline]
998    pub unsafe fn debug_description(self: MLCArithmeticOperation) -> Retained<NSString> {
999        extern "C-unwind" {
1000            fn MLCArithmeticOperationDebugDescription(
1001                operation: MLCArithmeticOperation,
1002            ) -> *mut NSString;
1003        }
1004        let ret = unsafe { MLCArithmeticOperationDebugDescription(self) };
1005        unsafe { Retained::retain_autoreleased(ret) }
1006            .expect("function was marked as returning non-null, but actually returned NULL")
1007    }
1008}
1009
1010impl MLCPaddingPolicy {
1011    /// Returns a textual description of the padding policy, suitable for debugging.
1012    #[doc(alias = "MLCPaddingPolicyDebugDescription")]
1013    #[inline]
1014    pub unsafe fn debug_description(self: MLCPaddingPolicy) -> Retained<NSString> {
1015        extern "C-unwind" {
1016            fn MLCPaddingPolicyDebugDescription(padding_policy: MLCPaddingPolicy) -> *mut NSString;
1017        }
1018        let ret = unsafe { MLCPaddingPolicyDebugDescription(self) };
1019        unsafe { Retained::retain_autoreleased(ret) }
1020            .expect("function was marked as returning non-null, but actually returned NULL")
1021    }
1022}
1023
1024impl MLCLossType {
1025    /// Returns a textual description of the loss type, suitable for debugging.
1026    #[doc(alias = "MLCLossTypeDebugDescription")]
1027    #[inline]
1028    pub unsafe fn debug_description(self: MLCLossType) -> Retained<NSString> {
1029        extern "C-unwind" {
1030            fn MLCLossTypeDebugDescription(loss_type: MLCLossType) -> *mut NSString;
1031        }
1032        let ret = unsafe { MLCLossTypeDebugDescription(self) };
1033        unsafe { Retained::retain_autoreleased(ret) }
1034            .expect("function was marked as returning non-null, but actually returned NULL")
1035    }
1036}
1037
1038impl MLCReductionType {
1039    /// Returns a textual description of the reduction type, suitable for debugging.
1040    #[doc(alias = "MLCReductionTypeDebugDescription")]
1041    #[inline]
1042    pub unsafe fn debug_description(self: MLCReductionType) -> Retained<NSString> {
1043        extern "C-unwind" {
1044            fn MLCReductionTypeDebugDescription(reduction_type: MLCReductionType) -> *mut NSString;
1045        }
1046        let ret = unsafe { MLCReductionTypeDebugDescription(self) };
1047        unsafe { Retained::retain_autoreleased(ret) }
1048            .expect("function was marked as returning non-null, but actually returned NULL")
1049    }
1050}
1051
1052impl MLCPaddingType {
1053    /// Returns a textual description of the padding type, suitable for debugging.
1054    #[doc(alias = "MLCPaddingTypeDebugDescription")]
1055    #[inline]
1056    pub unsafe fn debug_description(self: MLCPaddingType) -> Retained<NSString> {
1057        extern "C-unwind" {
1058            fn MLCPaddingTypeDebugDescription(padding_type: MLCPaddingType) -> *mut NSString;
1059        }
1060        let ret = unsafe { MLCPaddingTypeDebugDescription(self) };
1061        unsafe { Retained::retain_autoreleased(ret) }
1062            .expect("function was marked as returning non-null, but actually returned NULL")
1063    }
1064}
1065
1066impl MLCConvolutionType {
1067    /// Returns a textual description of the convolution type, suitable for debugging.
1068    #[doc(alias = "MLCConvolutionTypeDebugDescription")]
1069    #[inline]
1070    pub unsafe fn debug_description(self: MLCConvolutionType) -> Retained<NSString> {
1071        extern "C-unwind" {
1072            fn MLCConvolutionTypeDebugDescription(
1073                convolution_type: MLCConvolutionType,
1074            ) -> *mut NSString;
1075        }
1076        let ret = unsafe { MLCConvolutionTypeDebugDescription(self) };
1077        unsafe { Retained::retain_autoreleased(ret) }
1078            .expect("function was marked as returning non-null, but actually returned NULL")
1079    }
1080}
1081
1082impl MLCPoolingType {
1083    /// Returns a textual description of the pooling type, suitable for debugging.
1084    #[doc(alias = "MLCPoolingTypeDebugDescription")]
1085    #[inline]
1086    pub unsafe fn debug_description(self: MLCPoolingType) -> Retained<NSString> {
1087        extern "C-unwind" {
1088            fn MLCPoolingTypeDebugDescription(pooling_type: MLCPoolingType) -> *mut NSString;
1089        }
1090        let ret = unsafe { MLCPoolingTypeDebugDescription(self) };
1091        unsafe { Retained::retain_autoreleased(ret) }
1092            .expect("function was marked as returning non-null, but actually returned NULL")
1093    }
1094}
1095
1096impl MLCSoftmaxOperation {
1097    /// Returns a textual description of the softmax operation, suitable for debugging.
1098    #[doc(alias = "MLCSoftmaxOperationDebugDescription")]
1099    #[inline]
1100    pub unsafe fn debug_description(self: MLCSoftmaxOperation) -> Retained<NSString> {
1101        extern "C-unwind" {
1102            fn MLCSoftmaxOperationDebugDescription(operation: MLCSoftmaxOperation)
1103                -> *mut NSString;
1104        }
1105        let ret = unsafe { MLCSoftmaxOperationDebugDescription(self) };
1106        unsafe { Retained::retain_autoreleased(ret) }
1107            .expect("function was marked as returning non-null, but actually returned NULL")
1108    }
1109}
1110
1111impl MLCSampleMode {
1112    /// Returns a textual description of the sample mode, suitable for debugging.
1113    #[doc(alias = "MLCSampleModeDebugDescription")]
1114    #[inline]
1115    pub unsafe fn debug_description(self: MLCSampleMode) -> Retained<NSString> {
1116        extern "C-unwind" {
1117            fn MLCSampleModeDebugDescription(mode: MLCSampleMode) -> *mut NSString;
1118        }
1119        let ret = unsafe { MLCSampleModeDebugDescription(self) };
1120        unsafe { Retained::retain_autoreleased(ret) }
1121            .expect("function was marked as returning non-null, but actually returned NULL")
1122    }
1123}
1124
1125impl MLCLSTMResultMode {
1126    /// Returns a textual description of the LSTM result mode, suitable for debugging.
1127    #[doc(alias = "MLCLSTMResultModeDebugDescription")]
1128    #[inline]
1129    pub unsafe fn debug_description(self: MLCLSTMResultMode) -> Retained<NSString> {
1130        extern "C-unwind" {
1131            fn MLCLSTMResultModeDebugDescription(mode: MLCLSTMResultMode) -> *mut NSString;
1132        }
1133        let ret = unsafe { MLCLSTMResultModeDebugDescription(self) };
1134        unsafe { Retained::retain_autoreleased(ret) }
1135            .expect("function was marked as returning non-null, but actually returned NULL")
1136    }
1137}
1138
1139impl MLCComparisonOperation {
1140    /// Returns a textual description of the comparison operation, suitable for debugging.
1141    #[doc(alias = "MLCComparisonOperationDebugDescription")]
1142    #[inline]
1143    pub unsafe fn debug_description(self: MLCComparisonOperation) -> Retained<NSString> {
1144        extern "C-unwind" {
1145            fn MLCComparisonOperationDebugDescription(
1146                operation: MLCComparisonOperation,
1147            ) -> *mut NSString;
1148        }
1149        let ret = unsafe { MLCComparisonOperationDebugDescription(self) };
1150        unsafe { Retained::retain_autoreleased(ret) }
1151            .expect("function was marked as returning non-null, but actually returned NULL")
1152    }
1153}
1154
1155impl MLCGradientClippingType {
1156    /// Returns a textual description of the gradient clipping type, suitable for debugging.
1157    #[doc(alias = "MLCGradientClippingTypeDebugDescription")]
1158    #[inline]
1159    pub unsafe fn debug_description(self: MLCGradientClippingType) -> Retained<NSString> {
1160        extern "C-unwind" {
1161            fn MLCGradientClippingTypeDebugDescription(
1162                gradient_clipping_type: MLCGradientClippingType,
1163            ) -> *mut NSString;
1164        }
1165        let ret = unsafe { MLCGradientClippingTypeDebugDescription(self) };
1166        unsafe { Retained::retain_autoreleased(ret) }
1167            .expect("function was marked as returning non-null, but actually returned NULL")
1168    }
1169}
1170
1171#[deprecated = "renamed to `MLCActivationType::debug_description`"]
1172#[inline]
1173pub unsafe extern "C-unwind" fn MLCActivationTypeDebugDescription(
1174    activation_type: MLCActivationType,
1175) -> Retained<NSString> {
1176    extern "C-unwind" {
1177        fn MLCActivationTypeDebugDescription(activation_type: MLCActivationType) -> *mut NSString;
1178    }
1179    let ret = unsafe { MLCActivationTypeDebugDescription(activation_type) };
1180    unsafe { Retained::retain_autoreleased(ret) }
1181        .expect("function was marked as returning non-null, but actually returned NULL")
1182}
1183
1184#[deprecated = "renamed to `MLCArithmeticOperation::debug_description`"]
1185#[inline]
1186pub unsafe extern "C-unwind" fn MLCArithmeticOperationDebugDescription(
1187    operation: MLCArithmeticOperation,
1188) -> Retained<NSString> {
1189    extern "C-unwind" {
1190        fn MLCArithmeticOperationDebugDescription(
1191            operation: MLCArithmeticOperation,
1192        ) -> *mut NSString;
1193    }
1194    let ret = unsafe { MLCArithmeticOperationDebugDescription(operation) };
1195    unsafe { Retained::retain_autoreleased(ret) }
1196        .expect("function was marked as returning non-null, but actually returned NULL")
1197}
1198
1199#[deprecated = "renamed to `MLCPaddingPolicy::debug_description`"]
1200#[inline]
1201pub unsafe extern "C-unwind" fn MLCPaddingPolicyDebugDescription(
1202    padding_policy: MLCPaddingPolicy,
1203) -> Retained<NSString> {
1204    extern "C-unwind" {
1205        fn MLCPaddingPolicyDebugDescription(padding_policy: MLCPaddingPolicy) -> *mut NSString;
1206    }
1207    let ret = unsafe { MLCPaddingPolicyDebugDescription(padding_policy) };
1208    unsafe { Retained::retain_autoreleased(ret) }
1209        .expect("function was marked as returning non-null, but actually returned NULL")
1210}
1211
1212#[deprecated = "renamed to `MLCLossType::debug_description`"]
1213#[inline]
1214pub unsafe extern "C-unwind" fn MLCLossTypeDebugDescription(
1215    loss_type: MLCLossType,
1216) -> Retained<NSString> {
1217    extern "C-unwind" {
1218        fn MLCLossTypeDebugDescription(loss_type: MLCLossType) -> *mut NSString;
1219    }
1220    let ret = unsafe { MLCLossTypeDebugDescription(loss_type) };
1221    unsafe { Retained::retain_autoreleased(ret) }
1222        .expect("function was marked as returning non-null, but actually returned NULL")
1223}
1224
1225#[deprecated = "renamed to `MLCReductionType::debug_description`"]
1226#[inline]
1227pub unsafe extern "C-unwind" fn MLCReductionTypeDebugDescription(
1228    reduction_type: MLCReductionType,
1229) -> Retained<NSString> {
1230    extern "C-unwind" {
1231        fn MLCReductionTypeDebugDescription(reduction_type: MLCReductionType) -> *mut NSString;
1232    }
1233    let ret = unsafe { MLCReductionTypeDebugDescription(reduction_type) };
1234    unsafe { Retained::retain_autoreleased(ret) }
1235        .expect("function was marked as returning non-null, but actually returned NULL")
1236}
1237
1238#[deprecated = "renamed to `MLCPaddingType::debug_description`"]
1239#[inline]
1240pub unsafe extern "C-unwind" fn MLCPaddingTypeDebugDescription(
1241    padding_type: MLCPaddingType,
1242) -> Retained<NSString> {
1243    extern "C-unwind" {
1244        fn MLCPaddingTypeDebugDescription(padding_type: MLCPaddingType) -> *mut NSString;
1245    }
1246    let ret = unsafe { MLCPaddingTypeDebugDescription(padding_type) };
1247    unsafe { Retained::retain_autoreleased(ret) }
1248        .expect("function was marked as returning non-null, but actually returned NULL")
1249}
1250
1251#[deprecated = "renamed to `MLCConvolutionType::debug_description`"]
1252#[inline]
1253pub unsafe extern "C-unwind" fn MLCConvolutionTypeDebugDescription(
1254    convolution_type: MLCConvolutionType,
1255) -> Retained<NSString> {
1256    extern "C-unwind" {
1257        fn MLCConvolutionTypeDebugDescription(
1258            convolution_type: MLCConvolutionType,
1259        ) -> *mut NSString;
1260    }
1261    let ret = unsafe { MLCConvolutionTypeDebugDescription(convolution_type) };
1262    unsafe { Retained::retain_autoreleased(ret) }
1263        .expect("function was marked as returning non-null, but actually returned NULL")
1264}
1265
1266#[deprecated = "renamed to `MLCPoolingType::debug_description`"]
1267#[inline]
1268pub unsafe extern "C-unwind" fn MLCPoolingTypeDebugDescription(
1269    pooling_type: MLCPoolingType,
1270) -> Retained<NSString> {
1271    extern "C-unwind" {
1272        fn MLCPoolingTypeDebugDescription(pooling_type: MLCPoolingType) -> *mut NSString;
1273    }
1274    let ret = unsafe { MLCPoolingTypeDebugDescription(pooling_type) };
1275    unsafe { Retained::retain_autoreleased(ret) }
1276        .expect("function was marked as returning non-null, but actually returned NULL")
1277}
1278
1279#[deprecated = "renamed to `MLCSoftmaxOperation::debug_description`"]
1280#[inline]
1281pub unsafe extern "C-unwind" fn MLCSoftmaxOperationDebugDescription(
1282    operation: MLCSoftmaxOperation,
1283) -> Retained<NSString> {
1284    extern "C-unwind" {
1285        fn MLCSoftmaxOperationDebugDescription(operation: MLCSoftmaxOperation) -> *mut NSString;
1286    }
1287    let ret = unsafe { MLCSoftmaxOperationDebugDescription(operation) };
1288    unsafe { Retained::retain_autoreleased(ret) }
1289        .expect("function was marked as returning non-null, but actually returned NULL")
1290}
1291
1292#[deprecated = "renamed to `MLCSampleMode::debug_description`"]
1293#[inline]
1294pub unsafe extern "C-unwind" fn MLCSampleModeDebugDescription(
1295    mode: MLCSampleMode,
1296) -> Retained<NSString> {
1297    extern "C-unwind" {
1298        fn MLCSampleModeDebugDescription(mode: MLCSampleMode) -> *mut NSString;
1299    }
1300    let ret = unsafe { MLCSampleModeDebugDescription(mode) };
1301    unsafe { Retained::retain_autoreleased(ret) }
1302        .expect("function was marked as returning non-null, but actually returned NULL")
1303}
1304
1305#[deprecated = "renamed to `MLCLSTMResultMode::debug_description`"]
1306#[inline]
1307pub unsafe extern "C-unwind" fn MLCLSTMResultModeDebugDescription(
1308    mode: MLCLSTMResultMode,
1309) -> Retained<NSString> {
1310    extern "C-unwind" {
1311        fn MLCLSTMResultModeDebugDescription(mode: MLCLSTMResultMode) -> *mut NSString;
1312    }
1313    let ret = unsafe { MLCLSTMResultModeDebugDescription(mode) };
1314    unsafe { Retained::retain_autoreleased(ret) }
1315        .expect("function was marked as returning non-null, but actually returned NULL")
1316}
1317
1318#[deprecated = "renamed to `MLCComparisonOperation::debug_description`"]
1319#[inline]
1320pub unsafe extern "C-unwind" fn MLCComparisonOperationDebugDescription(
1321    operation: MLCComparisonOperation,
1322) -> Retained<NSString> {
1323    extern "C-unwind" {
1324        fn MLCComparisonOperationDebugDescription(
1325            operation: MLCComparisonOperation,
1326        ) -> *mut NSString;
1327    }
1328    let ret = unsafe { MLCComparisonOperationDebugDescription(operation) };
1329    unsafe { Retained::retain_autoreleased(ret) }
1330        .expect("function was marked as returning non-null, but actually returned NULL")
1331}
1332
1333#[deprecated = "renamed to `MLCGradientClippingType::debug_description`"]
1334#[inline]
1335pub unsafe extern "C-unwind" fn MLCGradientClippingTypeDebugDescription(
1336    gradient_clipping_type: MLCGradientClippingType,
1337) -> Retained<NSString> {
1338    extern "C-unwind" {
1339        fn MLCGradientClippingTypeDebugDescription(
1340            gradient_clipping_type: MLCGradientClippingType,
1341        ) -> *mut NSString;
1342    }
1343    let ret = unsafe { MLCGradientClippingTypeDebugDescription(gradient_clipping_type) };
1344    unsafe { Retained::retain_autoreleased(ret) }
1345        .expect("function was marked as returning non-null, but actually returned NULL")
1346}