objc2-ml-compute 0.3.2

Bindings to the MLCompute framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// The MLCOptimizer specifies a base optimizer.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcoptimizer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated]
    pub struct MLCOptimizer;
);

extern_conformance!(
    unsafe impl NSCopying for MLCOptimizer {}
);

unsafe impl CopyingHelper for MLCOptimizer {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MLCOptimizer {}
);

impl MLCOptimizer {
    extern_methods!(
        /// The learning rate.  This property is 'readwrite' so that callers can implement a 'decay' during training
        #[deprecated]
        #[unsafe(method(learningRate))]
        #[unsafe(method_family = none)]
        pub unsafe fn learningRate(&self) -> c_float;

        /// Setter for [`learningRate`][Self::learningRate].
        #[deprecated]
        #[unsafe(method(setLearningRate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setLearningRate(&self, learning_rate: c_float);

        /// The rescale value applied to gradients during optimizer update
        #[deprecated]
        #[unsafe(method(gradientRescale))]
        #[unsafe(method_family = none)]
        pub unsafe fn gradientRescale(&self) -> c_float;

        /// Whether gradient clipping should be applied or not.
        #[deprecated]
        #[unsafe(method(appliesGradientClipping))]
        #[unsafe(method_family = none)]
        pub unsafe fn appliesGradientClipping(&self) -> bool;

        /// Setter for [`appliesGradientClipping`][Self::appliesGradientClipping].
        #[deprecated]
        #[unsafe(method(setAppliesGradientClipping:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAppliesGradientClipping(&self, applies_gradient_clipping: bool);

        /// The maximum gradient value if gradient clipping is enabled before gradient is rescaled.
        #[deprecated]
        #[unsafe(method(gradientClipMax))]
        #[unsafe(method_family = none)]
        pub unsafe fn gradientClipMax(&self) -> c_float;

        /// The minimum gradient value if gradient clipping is enabled before gradient is rescaled.
        #[deprecated]
        #[unsafe(method(gradientClipMin))]
        #[unsafe(method_family = none)]
        pub unsafe fn gradientClipMin(&self) -> c_float;

        /// The regularization scale.
        #[deprecated]
        #[unsafe(method(regularizationScale))]
        #[unsafe(method_family = none)]
        pub unsafe fn regularizationScale(&self) -> c_float;

        #[cfg(feature = "MLCTypes")]
        /// The regularization type.
        #[deprecated]
        #[unsafe(method(regularizationType))]
        #[unsafe(method_family = none)]
        pub unsafe fn regularizationType(&self) -> MLCRegularizationType;

        #[cfg(feature = "MLCTypes")]
        /// The type of clipping applied to gradient
        #[unsafe(method(gradientClippingType))]
        #[unsafe(method_family = none)]
        pub unsafe fn gradientClippingType(&self) -> MLCGradientClippingType;

        /// The maximum clipping value
        #[unsafe(method(maximumClippingNorm))]
        #[unsafe(method_family = none)]
        pub unsafe fn maximumClippingNorm(&self) -> c_float;

        /// Used only with MLCGradientClippingTypeByGlobalNorm. If non zero, this norm will be used in place of global norm.
        #[unsafe(method(customGlobalNorm))]
        #[unsafe(method_family = none)]
        pub unsafe fn customGlobalNorm(&self) -> c_float;

        #[deprecated]
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[deprecated]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}