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