Skip to main content

objc2_ml_compute/generated/
MLCMultiheadAttentionDescriptor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// The MLCMultiheadAttentionDescriptor specifies a Multi-Head Attention descriptor
12    ///
13    /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlcmultiheadattentiondescriptor?language=objc)
14    #[unsafe(super(NSObject))]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    #[deprecated]
17    pub struct MLCMultiheadAttentionDescriptor;
18);
19
20extern_conformance!(
21    unsafe impl NSCopying for MLCMultiheadAttentionDescriptor {}
22);
23
24unsafe impl CopyingHelper for MLCMultiheadAttentionDescriptor {
25    type Result = Self;
26}
27
28extern_conformance!(
29    unsafe impl NSObjectProtocol for MLCMultiheadAttentionDescriptor {}
30);
31
32impl MLCMultiheadAttentionDescriptor {
33    extern_methods!(
34        #[deprecated]
35        #[unsafe(method(new))]
36        #[unsafe(method_family = new)]
37        pub unsafe fn new() -> Retained<Self>;
38
39        #[deprecated]
40        #[unsafe(method(init))]
41        #[unsafe(method_family = init)]
42        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
43
44        /// model or embedding dimension
45        #[deprecated]
46        #[unsafe(method(modelDimension))]
47        #[unsafe(method_family = none)]
48        pub unsafe fn modelDimension(&self) -> NSUInteger;
49
50        /// total dimension of key space, Default = modelDimension
51        #[deprecated]
52        #[unsafe(method(keyDimension))]
53        #[unsafe(method_family = none)]
54        pub unsafe fn keyDimension(&self) -> NSUInteger;
55
56        /// total dimension of value space, Default = modelDimension
57        #[deprecated]
58        #[unsafe(method(valueDimension))]
59        #[unsafe(method_family = none)]
60        pub unsafe fn valueDimension(&self) -> NSUInteger;
61
62        /// number of parallel attention heads
63        #[deprecated]
64        #[unsafe(method(headCount))]
65        #[unsafe(method_family = none)]
66        pub unsafe fn headCount(&self) -> NSUInteger;
67
68        /// a droupout layer applied to the output projection weights. Default = 0.0
69        #[deprecated]
70        #[unsafe(method(dropout))]
71        #[unsafe(method_family = none)]
72        pub unsafe fn dropout(&self) -> c_float;
73
74        /// if true, bias is used for query/key/value/output projections. Default = true
75        #[deprecated]
76        #[unsafe(method(hasBiases))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn hasBiases(&self) -> bool;
79
80        /// if true, an array of biases is added to key and value respectively. Default = false
81        #[deprecated]
82        #[unsafe(method(hasAttentionBiases))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn hasAttentionBiases(&self) -> bool;
85
86        /// if true, a row of zeroes is added to projected key and value. Default = false
87        #[deprecated]
88        #[unsafe(method(addsZeroAttention))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn addsZeroAttention(&self) -> bool;
91
92        /// A multi-head attention layer descriptor
93        ///
94        /// Parameter `modelDimension`: total dimension of model space
95        ///
96        /// Parameter `keyDimension`: total dimension of key space. Default = modelDimension
97        ///
98        /// Parameter `valueDimension`: total dimension of value space. Default = modelDimension
99        ///
100        /// Parameter `headCount`: number of parallel attention heads
101        ///
102        /// Parameter `dropout`: optional, a dropout layer applied to the output projection weights. Default = 0.0f
103        ///
104        /// Parameter `hasBiases`: if true, bias will be added to query/key/value/output projections. Default = YES
105        ///
106        /// Parameter `hasAttentionBiases`: if true, an array of biases is added to key and value respectively. Default = NO
107        ///
108        /// Parameter `addsZeroAttention`: if true, a row of zeroes is added to projected key and value. Default = NO
109        ///
110        /// Returns: A new MultiheadAttention layer descriptor
111        #[deprecated]
112        #[unsafe(method(descriptorWithModelDimension:keyDimension:valueDimension:headCount:dropout:hasBiases:hasAttentionBiases:addsZeroAttention:))]
113        #[unsafe(method_family = none)]
114        pub unsafe fn descriptorWithModelDimension_keyDimension_valueDimension_headCount_dropout_hasBiases_hasAttentionBiases_addsZeroAttention(
115            model_dimension: NSUInteger,
116            key_dimension: NSUInteger,
117            value_dimension: NSUInteger,
118            head_count: NSUInteger,
119            dropout: c_float,
120            has_biases: bool,
121            has_attention_biases: bool,
122            adds_zero_attention: bool,
123        ) -> Option<Retained<Self>>;
124
125        /// A multi-head attention layer descriptor
126        ///
127        /// Parameter `modelDimension`: total dimension of model space
128        ///
129        /// Parameter `headCount`: number of parallel attention heads
130        ///
131        /// Returns: A valid MultiheadAttention layer descriptor
132        #[deprecated]
133        #[unsafe(method(descriptorWithModelDimension:headCount:))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn descriptorWithModelDimension_headCount(
136            model_dimension: NSUInteger,
137            head_count: NSUInteger,
138        ) -> Retained<Self>;
139    );
140}