objc2_ml_compute/generated/
MLCEmbeddingLayer.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8extern_class!(
9    /// An embedding layer which stores the words embedding
10    ///
11    /// For details refer to: https://pytorch.org/docs/stable/nn.html#embedding
12    /// 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,
13    /// 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
14    /// and respectively the gradient result of the first layer of the second graph can be passed to this graph for weight update.
15    ///
16    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcembeddinglayer?language=objc)
17    #[unsafe(super(MLCLayer, NSObject))]
18    #[derive(Debug, PartialEq, Eq, Hash)]
19    #[cfg(feature = "MLCLayer")]
20    #[deprecated]
21    pub struct MLCEmbeddingLayer;
22);
23
24#[cfg(feature = "MLCLayer")]
25extern_conformance!(
26    unsafe impl NSObjectProtocol for MLCEmbeddingLayer {}
27);
28
29#[cfg(feature = "MLCLayer")]
30impl MLCEmbeddingLayer {
31    extern_methods!(
32        #[cfg(feature = "MLCEmbeddingDescriptor")]
33        #[deprecated]
34        #[unsafe(method(descriptor))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn descriptor(&self) -> Retained<MLCEmbeddingDescriptor>;
37
38        #[cfg(feature = "MLCTensor")]
39        /// The array of word embeddings
40        #[deprecated]
41        #[unsafe(method(weights))]
42        #[unsafe(method_family = none)]
43        pub unsafe fn weights(&self) -> Retained<MLCTensor>;
44
45        #[cfg(feature = "MLCTensorParameter")]
46        /// The weights tensor parameter used for optimizer update
47        #[deprecated]
48        #[unsafe(method(weightsParameter))]
49        #[unsafe(method_family = none)]
50        pub unsafe fn weightsParameter(&self) -> Retained<MLCTensorParameter>;
51
52        #[cfg(all(feature = "MLCEmbeddingDescriptor", feature = "MLCTensor"))]
53        #[deprecated]
54        #[unsafe(method(layerWithDescriptor:weights:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn layerWithDescriptor_weights(
57            descriptor: &MLCEmbeddingDescriptor,
58            weights: &MLCTensor,
59        ) -> Retained<Self>;
60    );
61}
62
63/// Methods declared on superclass `MLCLayer`.
64#[cfg(feature = "MLCLayer")]
65impl MLCEmbeddingLayer {
66    extern_methods!(
67        #[deprecated]
68        #[unsafe(method(new))]
69        #[unsafe(method_family = new)]
70        pub unsafe fn new() -> Retained<Self>;
71
72        #[deprecated]
73        #[unsafe(method(init))]
74        #[unsafe(method_family = init)]
75        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
76    );
77}