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
214
215
216
217
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// A LSTM layer
///
/// The hidden and cell state for inputs and outputs have a layout of [numberOfLayers, numberOfDirections, batchSize, hiddenSize].
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclstmlayer?language=objc)
#[unsafe(super(MLCLayer, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "MLCLayer")]
#[deprecated]
pub struct MLCLSTMLayer;
);
#[cfg(feature = "MLCLayer")]
extern_conformance!(
unsafe impl NSObjectProtocol for MLCLSTMLayer {}
);
#[cfg(feature = "MLCLayer")]
impl MLCLSTMLayer {
extern_methods!(
#[cfg(feature = "MLCLSTMDescriptor")]
/// The LSTM descriptor
#[deprecated]
#[unsafe(method(descriptor))]
#[unsafe(method_family = none)]
pub unsafe fn descriptor(&self) -> Retained<MLCLSTMDescriptor>;
#[cfg(feature = "MLCActivationDescriptor")]
/// The array of gate activations for input, hidden, cell and output gates
///
/// The default gate activations are: sigmoid, sigmoid, tanh, sigmoid
#[deprecated]
#[unsafe(method(gateActivations))]
#[unsafe(method_family = none)]
pub unsafe fn gateActivations(&self) -> Retained<NSArray<MLCActivationDescriptor>>;
#[cfg(feature = "MLCActivationDescriptor")]
/// The output activation descriptor
#[deprecated]
#[unsafe(method(outputResultActivation))]
#[unsafe(method_family = none)]
pub unsafe fn outputResultActivation(&self) -> Retained<MLCActivationDescriptor>;
#[cfg(feature = "MLCTensor")]
/// The array of tensors describing the input weights for the input, hidden, cell and output gates
#[deprecated]
#[unsafe(method(inputWeights))]
#[unsafe(method_family = none)]
pub unsafe fn inputWeights(&self) -> Retained<NSArray<MLCTensor>>;
#[cfg(feature = "MLCTensor")]
/// The array of tensors describing the hidden weights for the input, hidden, cell and output gates
#[deprecated]
#[unsafe(method(hiddenWeights))]
#[unsafe(method_family = none)]
pub unsafe fn hiddenWeights(&self) -> Retained<NSArray<MLCTensor>>;
#[cfg(feature = "MLCTensor")]
/// The array of tensors describing the peephole weights for the input, hidden, cell and output gates
#[deprecated]
#[unsafe(method(peepholeWeights))]
#[unsafe(method_family = none)]
pub unsafe fn peepholeWeights(&self) -> Option<Retained<NSArray<MLCTensor>>>;
#[cfg(feature = "MLCTensor")]
/// The array of tensors describing the bias terms for the input, hidden, cell and output gates
#[deprecated]
#[unsafe(method(biases))]
#[unsafe(method_family = none)]
pub unsafe fn biases(&self) -> Option<Retained<NSArray<MLCTensor>>>;
#[cfg(feature = "MLCTensorParameter")]
/// The input weights tensor parameters used for optimizer update
#[deprecated]
#[unsafe(method(inputWeightsParameters))]
#[unsafe(method_family = none)]
pub unsafe fn inputWeightsParameters(&self) -> Retained<NSArray<MLCTensorParameter>>;
#[cfg(feature = "MLCTensorParameter")]
/// The hidden weights tensor parameters used for optimizer update
#[deprecated]
#[unsafe(method(hiddenWeightsParameters))]
#[unsafe(method_family = none)]
pub unsafe fn hiddenWeightsParameters(&self) -> Retained<NSArray<MLCTensorParameter>>;
#[cfg(feature = "MLCTensorParameter")]
/// The peephole weights tensor parameters used for optimizer update
#[deprecated]
#[unsafe(method(peepholeWeightsParameters))]
#[unsafe(method_family = none)]
pub unsafe fn peepholeWeightsParameters(
&self,
) -> Option<Retained<NSArray<MLCTensorParameter>>>;
#[cfg(feature = "MLCTensorParameter")]
/// The bias tensor parameter used for optimizer update
#[deprecated]
#[unsafe(method(biasesParameters))]
#[unsafe(method_family = none)]
pub unsafe fn biasesParameters(&self) -> Option<Retained<NSArray<MLCTensorParameter>>>;
#[cfg(all(feature = "MLCLSTMDescriptor", feature = "MLCTensor"))]
/// Create a LSTM layer
///
/// Parameter `descriptor`: The LSTM descriptor
///
/// Parameter `inputWeights`: An array of (layerCount * 4) tensors describing the input weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Parameter `hiddenWeights`: An array of (layerCount * 4) tensors describing the hidden weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Returns: A new LSTM layer.
#[deprecated]
#[unsafe(method(layerWithDescriptor:inputWeights:hiddenWeights:biases:))]
#[unsafe(method_family = none)]
pub unsafe fn layerWithDescriptor_inputWeights_hiddenWeights_biases(
descriptor: &MLCLSTMDescriptor,
input_weights: &NSArray<MLCTensor>,
hidden_weights: &NSArray<MLCTensor>,
biases: Option<&NSArray<MLCTensor>>,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "MLCLSTMDescriptor", feature = "MLCTensor"))]
/// Create a LSTM layer
///
/// Parameter `descriptor`: The LSTM descriptor
///
/// Parameter `inputWeights`: An array of (layerCount * 4) tensors describing the input weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Parameter `hiddenWeights`: An array of (layerCount * 4) tensors describing the hidden weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Parameter `peepholeWeights`: An array of (layerCount * 4) tensors describing the peephole weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Returns: A new LSTM layer.
#[deprecated]
#[unsafe(method(layerWithDescriptor:inputWeights:hiddenWeights:peepholeWeights:biases:))]
#[unsafe(method_family = none)]
pub unsafe fn layerWithDescriptor_inputWeights_hiddenWeights_peepholeWeights_biases(
descriptor: &MLCLSTMDescriptor,
input_weights: &NSArray<MLCTensor>,
hidden_weights: &NSArray<MLCTensor>,
peephole_weights: Option<&NSArray<MLCTensor>>,
biases: Option<&NSArray<MLCTensor>>,
) -> Option<Retained<Self>>;
#[cfg(all(
feature = "MLCActivationDescriptor",
feature = "MLCLSTMDescriptor",
feature = "MLCTensor"
))]
/// Create a LSTM layer
///
/// Parameter `descriptor`: The LSTM descriptor
///
/// Parameter `inputWeights`: An array of (layerCount * 4) tensors describing the input weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
/// For bidirectional LSTM, the forward time weights for all stacked layers will come first followed by backward time weights
///
/// Parameter `hiddenWeights`: An array of (layerCount * 4) tensors describing the hidden weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
/// For bidirectional LSTM, the forward time weights for all stacked layers will come first followed by backward time weights
///
/// Parameter `peepholeWeights`: An array of (layerCount * 4) tensors describing the peephole weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
///
/// Parameter `biases`: An array of (layerCount * 4) tensors describing the input weights for the
/// input, hidden, cell and output gates for layer0, layer1.. layer(n-1) for layerCount=n.
/// For bidirectional LSTM, the forward time bias terms for all stacked layers will come first followed by backward time bias terms
///
/// Parameter `gateActivations`: An array of 4 neuron descriptors for the input, hidden, cell and output gate activations.
///
/// Parameter `outputResultActivation`: The neuron descriptor used for the activation function applied to output result. Default is tanh.
///
/// Returns: A new LSTM layer.
#[deprecated]
#[unsafe(method(layerWithDescriptor:inputWeights:hiddenWeights:peepholeWeights:biases:gateActivations:outputResultActivation:))]
#[unsafe(method_family = none)]
pub unsafe fn layerWithDescriptor_inputWeights_hiddenWeights_peepholeWeights_biases_gateActivations_outputResultActivation(
descriptor: &MLCLSTMDescriptor,
input_weights: &NSArray<MLCTensor>,
hidden_weights: &NSArray<MLCTensor>,
peephole_weights: Option<&NSArray<MLCTensor>>,
biases: Option<&NSArray<MLCTensor>>,
gate_activations: &NSArray<MLCActivationDescriptor>,
output_result_activation: &MLCActivationDescriptor,
) -> Option<Retained<Self>>;
);
}
/// Methods declared on superclass `MLCLayer`.
#[cfg(feature = "MLCLayer")]
impl MLCLSTMLayer {
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>;
);
}