objc2_ml_compute/generated/
MLCOptimizer.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
10extern_class!(
11    /// The MLCOptimizer specifies a base optimizer.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcoptimizer?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[deprecated]
17    pub struct MLCOptimizer;
18);
19
20extern_conformance!(
21    unsafe impl NSCopying for MLCOptimizer {}
22);
23
24unsafe impl CopyingHelper for MLCOptimizer {
25    type Result = Self;
26}
27
28extern_conformance!(
29    unsafe impl NSObjectProtocol for MLCOptimizer {}
30);
31
32impl MLCOptimizer {
33    extern_methods!(
34        /// The learning rate.  This property is 'readwrite' so that callers can implement a 'decay' during training
35        #[deprecated]
36        #[unsafe(method(learningRate))]
37        #[unsafe(method_family = none)]
38        pub unsafe fn learningRate(&self) -> c_float;
39
40        /// Setter for [`learningRate`][Self::learningRate].
41        #[deprecated]
42        #[unsafe(method(setLearningRate:))]
43        #[unsafe(method_family = none)]
44        pub unsafe fn setLearningRate(&self, learning_rate: c_float);
45
46        /// The rescale value applied to gradients during optimizer update
47        #[deprecated]
48        #[unsafe(method(gradientRescale))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn gradientRescale(&self) -> c_float;
51
52        /// Whether gradient clipping should be applied or not.
53        #[deprecated]
54        #[unsafe(method(appliesGradientClipping))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn appliesGradientClipping(&self) -> bool;
57
58        /// Setter for [`appliesGradientClipping`][Self::appliesGradientClipping].
59        #[deprecated]
60        #[unsafe(method(setAppliesGradientClipping:))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn setAppliesGradientClipping(&self, applies_gradient_clipping: bool);
63
64        /// The maximum gradient value if gradient clipping is enabled before gradient is rescaled.
65        #[deprecated]
66        #[unsafe(method(gradientClipMax))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn gradientClipMax(&self) -> c_float;
69
70        /// The minimum gradient value if gradient clipping is enabled before gradient is rescaled.
71        #[deprecated]
72        #[unsafe(method(gradientClipMin))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn gradientClipMin(&self) -> c_float;
75
76        /// The regularization scale.
77        #[deprecated]
78        #[unsafe(method(regularizationScale))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn regularizationScale(&self) -> c_float;
81
82        #[cfg(feature = "MLCTypes")]
83        /// The regularization type.
84        #[deprecated]
85        #[unsafe(method(regularizationType))]
86        #[unsafe(method_family = none)]
87        pub unsafe fn regularizationType(&self) -> MLCRegularizationType;
88
89        #[cfg(feature = "MLCTypes")]
90        /// The type of clipping applied to gradient
91        #[unsafe(method(gradientClippingType))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn gradientClippingType(&self) -> MLCGradientClippingType;
94
95        /// The maximum clipping value
96        #[unsafe(method(maximumClippingNorm))]
97        #[unsafe(method_family = none)]
98        pub unsafe fn maximumClippingNorm(&self) -> c_float;
99
100        /// Used only with MLCGradientClippingTypeByGlobalNorm. If non zero, this norm will be used in place of global norm.
101        #[unsafe(method(customGlobalNorm))]
102        #[unsafe(method_family = none)]
103        pub unsafe fn customGlobalNorm(&self) -> c_float;
104
105        #[deprecated]
106        #[unsafe(method(new))]
107        #[unsafe(method_family = new)]
108        pub unsafe fn new() -> Retained<Self>;
109
110        #[deprecated]
111        #[unsafe(method(init))]
112        #[unsafe(method_family = init)]
113        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
114    );
115}