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 crate::*;

extern_class!(
    /// A group normalizaion layer.  For more information, refer to https://pytorch.org/docs/stable/nn.html#groupnorm
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgroupnormalizationlayer?language=objc)
    #[unsafe(super(MLCLayer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MLCLayer")]
    #[deprecated]
    pub struct MLCGroupNormalizationLayer;
);

#[cfg(feature = "MLCLayer")]
extern_conformance!(
    unsafe impl NSObjectProtocol for MLCGroupNormalizationLayer {}
);

#[cfg(feature = "MLCLayer")]
impl MLCGroupNormalizationLayer {
    extern_methods!(
        /// The number of feature channels
        #[deprecated]
        #[unsafe(method(featureChannelCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn featureChannelCount(&self) -> NSUInteger;

        /// The number of groups to separate the channels into
        #[deprecated]
        #[unsafe(method(groupCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn groupCount(&self) -> NSUInteger;

        #[cfg(feature = "MLCTensor")]
        /// The beta tensor
        #[deprecated]
        #[unsafe(method(beta))]
        #[unsafe(method_family = none)]
        pub unsafe fn beta(&self) -> Option<Retained<MLCTensor>>;

        #[cfg(feature = "MLCTensor")]
        /// The gamma tensor
        #[deprecated]
        #[unsafe(method(gamma))]
        #[unsafe(method_family = none)]
        pub unsafe fn gamma(&self) -> Option<Retained<MLCTensor>>;

        #[cfg(feature = "MLCTensorParameter")]
        /// The beta tensor parameter used for optimizer update
        #[deprecated]
        #[unsafe(method(betaParameter))]
        #[unsafe(method_family = none)]
        pub unsafe fn betaParameter(&self) -> Option<Retained<MLCTensorParameter>>;

        #[cfg(feature = "MLCTensorParameter")]
        /// The gamma tensor parameter used for optimizer update
        #[deprecated]
        #[unsafe(method(gammaParameter))]
        #[unsafe(method_family = none)]
        pub unsafe fn gammaParameter(&self) -> Option<Retained<MLCTensorParameter>>;

        /// A value used for numerical stability
        #[deprecated]
        #[unsafe(method(varianceEpsilon))]
        #[unsafe(method_family = none)]
        pub unsafe fn varianceEpsilon(&self) -> c_float;

        #[cfg(feature = "MLCTensor")]
        /// Create a group normalization layer
        ///
        /// Parameter `featureChannelCount`: The number of feature channels
        ///
        /// Parameter `beta`: Training parameter
        ///
        /// Parameter `gamma`: Training parameter
        ///
        /// Parameter `groupCount`: The number of groups to divide the feature channels into
        ///
        /// Parameter `varianceEpsilon`: A small numerical value added to variance for stability
        ///
        /// Returns: A new group normalization layer.
        #[deprecated]
        #[unsafe(method(layerWithFeatureChannelCount:groupCount:beta:gamma:varianceEpsilon:))]
        #[unsafe(method_family = none)]
        pub unsafe fn layerWithFeatureChannelCount_groupCount_beta_gamma_varianceEpsilon(
            feature_channel_count: NSUInteger,
            group_count: NSUInteger,
            beta: Option<&MLCTensor>,
            gamma: Option<&MLCTensor>,
            variance_epsilon: c_float,
        ) -> Option<Retained<Self>>;
    );
}

/// Methods declared on superclass `MLCLayer`.
#[cfg(feature = "MLCLayer")]
impl MLCGroupNormalizationLayer {
    extern_methods!(
        #[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>;
    );
}