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 gram matrix layer
    ///
    /// The MLComputeGramMatrix  specifies a layer which computes the uncentered cross-correlation
    /// values between the spatial planes of each feature channel of a tensor. If the input tensor batch is
    /// x = x[b, y, x, c], where 'b' is batch index, 'y' and 'x' are the spatial coordinates and 'c' is the feature channel
    /// index then this layer computes the values:
    ///
    /// y = y[b, 1, f, c] = alpha * sum_{x,y} x[b,y,x,f] * x[b,y,x,c], where 'alpha' is a scaling factor.
    ///
    /// This operation can be interpreted to be computing all combinations of fully connected layers
    /// between the different spatial planes of the input tensor. The results are stored in the feature channel and
    /// 'x'-coordinate indices of the output batch.
    ///
    /// The operation is performed independently for each tensor in a batch.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcgrammatrixlayer?language=objc)
    #[unsafe(super(MLCLayer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MLCLayer")]
    #[deprecated]
    pub struct MLCGramMatrixLayer;
);

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

#[cfg(feature = "MLCLayer")]
impl MLCGramMatrixLayer {
    extern_methods!(
        /// The scale factor
        #[deprecated]
        #[unsafe(method(scale))]
        #[unsafe(method_family = none)]
        pub unsafe fn scale(&self) -> c_float;

        /// Create a GramMatrix layer
        ///
        /// Parameter `scale`: The scaling factor for the output.
        ///
        /// Returns: A new GramMatrix layer
        #[deprecated]
        #[unsafe(method(layerWithScale:))]
        #[unsafe(method_family = none)]
        pub unsafe fn layerWithScale(scale: c_float) -> Retained<Self>;
    );
}

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