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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
//! 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 MLCLSTMDescriptor specifies a LSTM descriptor
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclstmdescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct MLCLSTMDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MLCLSTMDescriptor {}
);
unsafe impl CopyingHelper for MLCLSTMDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MLCLSTMDescriptor {}
);
impl MLCLSTMDescriptor {
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>;
/// The number of expected feature channels in the input
#[deprecated]
#[unsafe(method(inputSize))]
#[unsafe(method_family = none)]
pub unsafe fn inputSize(&self) -> NSUInteger;
/// The number of feature channels in the hidden state
#[deprecated]
#[unsafe(method(hiddenSize))]
#[unsafe(method_family = none)]
pub unsafe fn hiddenSize(&self) -> NSUInteger;
/// The number of recurrent layers. Default is 1.
#[deprecated]
#[unsafe(method(layerCount))]
#[unsafe(method_family = none)]
pub unsafe fn layerCount(&self) -> NSUInteger;
/// If NO, the layer does not use bias terms. Default is YES.
#[deprecated]
#[unsafe(method(usesBiases))]
#[unsafe(method_family = none)]
pub unsafe fn usesBiases(&self) -> bool;
/// LSTM only supports batchFirst=YES. This means the input and output will have shape [batch size, time steps, feature]. Default is YES.
#[deprecated]
#[unsafe(method(batchFirst))]
#[unsafe(method_family = none)]
pub unsafe fn batchFirst(&self) -> bool;
/// If YES, becomes a bidirectional LSTM. Default is NO.
#[deprecated]
#[unsafe(method(isBidirectional))]
#[unsafe(method_family = none)]
pub unsafe fn isBidirectional(&self) -> bool;
/// if YES return output for all sequences else return output only for the last sequences. Default: YES
#[deprecated]
#[unsafe(method(returnsSequences))]
#[unsafe(method_family = none)]
pub unsafe fn returnsSequences(&self) -> bool;
/// If non-zero, intrdouces a dropout layer on the outputs of each LSTM layer
/// except the last layer, with dropout probablity equal to dropout. Default is 0.0.
#[deprecated]
#[unsafe(method(dropout))]
#[unsafe(method_family = none)]
pub unsafe fn dropout(&self) -> c_float;
#[cfg(feature = "MLCTypes")]
/// MLCLSTMResultModeOutput returns output data. MLCLSTMResultModeOutputAndStates returns
/// output data, last hidden state h_n, and last cell state c_n. Default MLCLSTMResultModeOutput.
#[deprecated]
#[unsafe(method(resultMode))]
#[unsafe(method_family = none)]
pub unsafe fn resultMode(&self) -> MLCLSTMResultMode;
/// Creates a LSTM descriptor with batchFirst = YES
///
/// Parameter `inputSize`: The number of expected features in the input
///
/// Parameter `hiddenSize`: The number of features in the hidden state
///
/// Parameter `layerCount`: Number of recurrent layers
///
/// Returns: A valid MLCLSTMDescriptor object or nil, if failure.
#[deprecated]
#[unsafe(method(descriptorWithInputSize:hiddenSize:layerCount:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithInputSize_hiddenSize_layerCount(
input_size: NSUInteger,
hidden_size: NSUInteger,
layer_count: NSUInteger,
) -> Retained<Self>;
/// Creates a LSTM descriptor descriptor with batchFirst = YES
///
/// Parameter `inputSize`: The number of expected features in the input
///
/// Parameter `hiddenSize`: The number of features in the hidden state
///
/// Parameter `layerCount`: Number of recurrent layers
///
/// Parameter `usesBiases`: If NO, the layer does not use bias weights. Default: YES
///
/// Parameter `isBidirectional`: If YES, becomes a bi-directional LSTM. Default: NO
///
/// Parameter `dropout`: If non-zero, introduces a dropout layer on the outputs of each LSTM layer except the last layer
/// with dropout probability equal to dropout.
///
/// Returns: A valid MLCLSTMDescriptor object or nil, if failure.
#[deprecated]
#[unsafe(method(descriptorWithInputSize:hiddenSize:layerCount:usesBiases:isBidirectional:dropout:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithInputSize_hiddenSize_layerCount_usesBiases_isBidirectional_dropout(
input_size: NSUInteger,
hidden_size: NSUInteger,
layer_count: NSUInteger,
uses_biases: bool,
is_bidirectional: bool,
dropout: c_float,
) -> Retained<Self>;
#[deprecated]
#[unsafe(method(descriptorWithInputSize:hiddenSize:layerCount:usesBiases:batchFirst:isBidirectional:dropout:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithInputSize_hiddenSize_layerCount_usesBiases_batchFirst_isBidirectional_dropout(
input_size: NSUInteger,
hidden_size: NSUInteger,
layer_count: NSUInteger,
uses_biases: bool,
batch_first: bool,
is_bidirectional: bool,
dropout: c_float,
) -> Retained<Self>;
#[deprecated]
#[unsafe(method(descriptorWithInputSize:hiddenSize:layerCount:usesBiases:batchFirst:isBidirectional:returnsSequences:dropout:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithInputSize_hiddenSize_layerCount_usesBiases_batchFirst_isBidirectional_returnsSequences_dropout(
input_size: NSUInteger,
hidden_size: NSUInteger,
layer_count: NSUInteger,
uses_biases: bool,
batch_first: bool,
is_bidirectional: bool,
returns_sequences: bool,
dropout: c_float,
) -> Retained<Self>;
#[cfg(feature = "MLCTypes")]
/// Creates a LSTM descriptor.
///
/// Parameter `inputSize`: The number of expected features in the input
///
/// Parameter `hiddenSize`: The number of features in the hidden state
///
/// Parameter `layerCount`: Number of recurrent layers
///
/// Parameter `usesBiases`: If NO, the layer does not use bias weights. Default: YES
///
/// Parameter `batchFirst`: LSTM only supports batchFirst=YES. This means the input and output will have shape [batch size, time steps, feature]. Default is YES.
///
/// Parameter `isBidirectional`: If YES, becomes a bi-directional LSTM. Default: NO
///
/// Parameter `returnsSequences`: if YES return output for all sequences else return output only for the last sequences. Default: YES
///
/// Parameter `dropout`: If non-zero, introduces a dropout layer on the outputs of each LSTM layer except the last layer
/// with dropout probability equal to dropout.
///
/// Parameter `resultMode`: expected result tensors. MLCLSTMResultModeOutput returns output data. MLCLSTMResultModeOutputAndStates returns
/// output data, last hidden state h_n, and last cell state c_n. Default: MLCLSTMResultModeOutput.
///
/// Returns: A valid MLCLSTMDescriptor object or nil, if failure.
#[deprecated]
#[unsafe(method(descriptorWithInputSize:hiddenSize:layerCount:usesBiases:batchFirst:isBidirectional:returnsSequences:dropout:resultMode:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithInputSize_hiddenSize_layerCount_usesBiases_batchFirst_isBidirectional_returnsSequences_dropout_resultMode(
input_size: NSUInteger,
hidden_size: NSUInteger,
layer_count: NSUInteger,
uses_biases: bool,
batch_first: bool,
is_bidirectional: bool,
returns_sequences: bool,
dropout: c_float,
result_mode: MLCLSTMResultMode,
) -> Retained<Self>;
);
}