objc2_ml_compute/generated/
MLCAdamWOptimizer.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 MLCAdamWOptimizer specifies the AdamW optimizer.
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcadamwoptimizer?language=objc)
14    #[unsafe(super(MLCOptimizer, NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[cfg(feature = "MLCOptimizer")]
17    #[deprecated]
18    pub struct MLCAdamWOptimizer;
19);
20
21#[cfg(feature = "MLCOptimizer")]
22extern_conformance!(
23    unsafe impl NSCopying for MLCAdamWOptimizer {}
24);
25
26#[cfg(feature = "MLCOptimizer")]
27unsafe impl CopyingHelper for MLCAdamWOptimizer {
28    type Result = Self;
29}
30
31#[cfg(feature = "MLCOptimizer")]
32extern_conformance!(
33    unsafe impl NSObjectProtocol for MLCAdamWOptimizer {}
34);
35
36#[cfg(feature = "MLCOptimizer")]
37impl MLCAdamWOptimizer {
38    extern_methods!(
39        /// Coefficent used for computing running averages of gradient.
40        ///
41        /// The default is 0.9.
42        #[deprecated]
43        #[unsafe(method(beta1))]
44        #[unsafe(method_family = none)]
45        pub unsafe fn beta1(&self) -> c_float;
46
47        /// Coefficent used for computing running averages of square of gradient.
48        ///
49        /// The default is 0.999.
50        #[deprecated]
51        #[unsafe(method(beta2))]
52        #[unsafe(method_family = none)]
53        pub unsafe fn beta2(&self) -> c_float;
54
55        /// A term added to improve numerical stability.
56        ///
57        /// The default is 1e-8.
58        #[deprecated]
59        #[unsafe(method(epsilon))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn epsilon(&self) -> c_float;
62
63        /// Whether to use the AMSGrad variant of this algorithm
64        ///
65        /// The default is false
66        #[deprecated]
67        #[unsafe(method(usesAMSGrad))]
68        #[unsafe(method_family = none)]
69        pub unsafe fn usesAMSGrad(&self) -> bool;
70
71        /// The current timestep used for the update.
72        ///
73        /// The default is 1.
74        #[deprecated]
75        #[unsafe(method(timeStep))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn timeStep(&self) -> NSUInteger;
78
79        #[cfg(feature = "MLCOptimizerDescriptor")]
80        /// Create an MLCAdamWOptimizer object with defaults
81        ///
82        /// Returns: A new MLCAdamWOptimizer object.
83        #[deprecated]
84        #[unsafe(method(optimizerWithDescriptor:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn optimizerWithDescriptor(
87            optimizer_descriptor: &MLCOptimizerDescriptor,
88        ) -> Retained<Self>;
89
90        #[cfg(feature = "MLCOptimizerDescriptor")]
91        /// Create an MLCAdamWOptimizer object
92        ///
93        /// Parameter `optimizerDescriptor`: The optimizer descriptor object
94        ///
95        /// Parameter `beta1`: The beta1 value
96        ///
97        /// Parameter `beta2`: The beta2 value
98        ///
99        /// Parameter `epsilon`: The epsilon value to use to improve numerical stability
100        ///
101        /// Parameter `usesAMSGrad`: Whether to use the AMSGrad variant of this algorithm from the paper (https://arxiv.org/abs/1904.09237)
102        ///
103        /// Parameter `timeStep`: The initial timestep to use for the update
104        ///
105        /// Returns: A new MLCAdamWOptimizer object.
106        #[deprecated]
107        #[unsafe(method(optimizerWithDescriptor:beta1:beta2:epsilon:usesAMSGrad:timeStep:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn optimizerWithDescriptor_beta1_beta2_epsilon_usesAMSGrad_timeStep(
110            optimizer_descriptor: &MLCOptimizerDescriptor,
111            beta1: c_float,
112            beta2: c_float,
113            epsilon: c_float,
114            uses_ams_grad: bool,
115            time_step: NSUInteger,
116        ) -> Retained<Self>;
117    );
118}
119
120/// Methods declared on superclass `MLCOptimizer`.
121#[cfg(feature = "MLCOptimizer")]
122impl MLCAdamWOptimizer {
123    extern_methods!(
124        #[deprecated]
125        #[unsafe(method(new))]
126        #[unsafe(method_family = new)]
127        pub unsafe fn new() -> Retained<Self>;
128
129        #[deprecated]
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
133    );
134}