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::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// An embedding layer which stores the words embedding
    ///
    /// For details refer to: https://pytorch.org/docs/stable/nn.html#embedding
    /// Only supported on CPU and can only be used as the first layer in a graph. If needs to be used with another graph compiled for a GPU device,
    /// a second graph containing the embedding layer can be created first. The result of this layer can then be fed as an input to the second graph
    /// and respectively the gradient result of the first layer of the second graph can be passed to this graph for weight update.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcembeddinglayer?language=objc)
    #[unsafe(super(MLCLayer, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "MLCLayer")]
    #[deprecated]
    pub struct MLCEmbeddingLayer;
);

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

#[cfg(feature = "MLCLayer")]
impl MLCEmbeddingLayer {
    extern_methods!(
        #[cfg(feature = "MLCEmbeddingDescriptor")]
        #[deprecated]
        #[unsafe(method(descriptor))]
        #[unsafe(method_family = none)]
        pub unsafe fn descriptor(&self) -> Retained<MLCEmbeddingDescriptor>;

        #[cfg(feature = "MLCTensor")]
        /// The array of word embeddings
        #[deprecated]
        #[unsafe(method(weights))]
        #[unsafe(method_family = none)]
        pub unsafe fn weights(&self) -> Retained<MLCTensor>;

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

        #[cfg(all(feature = "MLCEmbeddingDescriptor", feature = "MLCTensor"))]
        #[deprecated]
        #[unsafe(method(layerWithDescriptor:weights:))]
        #[unsafe(method_family = none)]
        pub unsafe fn layerWithDescriptor_weights(
            descriptor: &MLCEmbeddingDescriptor,
            weights: &MLCTensor,
        ) -> Retained<Self>;
    );
}

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