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
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
//! 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!(
/// The MLCTensorDescriptor specifies a tensor descriptor.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlctensordescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct MLCTensorDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MLCTensorDescriptor {}
);
unsafe impl CopyingHelper for MLCTensorDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MLCTensorDescriptor {}
);
impl MLCTensorDescriptor {
extern_methods!(
#[cfg(feature = "MLCTypes")]
/// The tensor data type. The default is MLCDataTypeFloat32.
#[deprecated]
#[unsafe(method(dataType))]
#[unsafe(method_family = none)]
pub unsafe fn dataType(&self) -> MLCDataType;
/// The number of dimensions in the tensor
#[deprecated]
#[unsafe(method(dimensionCount))]
#[unsafe(method_family = none)]
pub unsafe fn dimensionCount(&self) -> NSUInteger;
/// The size in each dimension
#[deprecated]
#[unsafe(method(shape))]
#[unsafe(method_family = none)]
pub unsafe fn shape(&self) -> Retained<NSArray<NSNumber>>;
/// The stride in bytes in each dimension
#[deprecated]
#[unsafe(method(stride))]
#[unsafe(method_family = none)]
pub unsafe fn stride(&self) -> Retained<NSArray<NSNumber>>;
/// The allocation size in bytes for a tensor.
#[deprecated]
#[unsafe(method(tensorAllocationSizeInBytes))]
#[unsafe(method_family = none)]
pub unsafe fn tensorAllocationSizeInBytes(&self) -> NSUInteger;
/// TODO
#[deprecated]
#[unsafe(method(sequenceLengths))]
#[unsafe(method_family = none)]
pub unsafe fn sequenceLengths(&self) -> Option<Retained<NSArray<NSNumber>>>;
/// Specifies whether the sequences are sorted or not.
#[deprecated]
#[unsafe(method(sortedSequences))]
#[unsafe(method_family = none)]
pub unsafe fn sortedSequences(&self) -> bool;
/// The batch size for each sequence
///
/// We populate this only when sequenceLengths is valid. The length of this array should be
/// the maximum sequence length in sequenceLengths (i.e sequenceLengths[0]).
#[deprecated]
#[unsafe(method(batchSizePerSequenceStep))]
#[unsafe(method_family = none)]
pub unsafe fn batchSizePerSequenceStep(&self) -> Option<Retained<NSArray<NSNumber>>>;
#[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 maximum number of tensor dimensions supported
#[deprecated]
#[unsafe(method(maxTensorDimensions))]
#[unsafe(method_family = none)]
pub unsafe fn maxTensorDimensions() -> NSUInteger;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `shape`: The tensor shape
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
#[deprecated]
#[unsafe(method(descriptorWithShape:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithShape_dataType(
shape: &NSArray<NSNumber>,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `shape`: The tensor shape
///
/// Parameter `sequenceLengths`: The sequence lengths in tensor
///
/// Parameter `sortedSequences`: A boolean to indicate whether sequences are sorted
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create sequence tensors used by recurrent layers.
#[deprecated]
#[unsafe(method(descriptorWithShape:sequenceLengths:sortedSequences:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithShape_sequenceLengths_sortedSequences_dataType(
shape: &NSArray<NSNumber>,
sequence_lengths: &NSArray<NSNumber>,
sorted_sequences: bool,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
/// Create a MLCTensorDescriptor object
///
/// Parameter `width`: The tensor width
///
/// Parameter `height`: The tensor height
///
/// Parameter `featureChannels`: The number of feature channels
///
/// Parameter `batchSize`: The batch size
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
#[deprecated]
#[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize(
width: NSUInteger,
height: NSUInteger,
feature_channels: NSUInteger,
batch_size: NSUInteger,
) -> Option<Retained<Self>>;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `width`: The tensor width
///
/// Parameter `height`: The tensor height
///
/// Parameter `featureChannelCount`: The number of feature channels
///
/// Parameter `batchSize`: The batch size
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
#[deprecated]
#[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize_dataType(
width: NSUInteger,
height: NSUInteger,
feature_channel_count: NSUInteger,
batch_size: NSUInteger,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `width`: The tensor width
///
/// Parameter `height`: The tensor height
///
/// Parameter `inputFeatureChannelCount`: The number of input feature channels
///
/// Parameter `outputFeatureChannelCount`: The number of output feature channels
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create a weight tensor.
#[deprecated]
#[unsafe(method(convolutionWeightsDescriptorWithWidth:height:inputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn convolutionWeightsDescriptorWithWidth_height_inputFeatureChannelCount_outputFeatureChannelCount_dataType(
width: NSUInteger,
height: NSUInteger,
input_feature_channel_count: NSUInteger,
output_feature_channel_count: NSUInteger,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `inputFeatureChannelCount`: The number of input feature channels
///
/// Parameter `outputFeatureChannelCount`: The number of output feature channels
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create a weight tensor for a kernel of size 1.
#[deprecated]
#[unsafe(method(convolutionWeightsDescriptorWithInputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn convolutionWeightsDescriptorWithInputFeatureChannelCount_outputFeatureChannelCount_dataType(
input_feature_channel_count: NSUInteger,
output_feature_channel_count: NSUInteger,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
#[cfg(feature = "MLCTypes")]
/// Create a MLCTensorDescriptor object
///
/// Parameter `featureChannelCount`: The number of input feature channels
///
/// Parameter `dataType`: The tensor data type
///
/// Returns: A new MLCTensorDescriptor object or nil if failure.
///
/// This method is provided as an easy to use API to create a bias tensor.
#[deprecated]
#[unsafe(method(convolutionBiasesDescriptorWithFeatureChannelCount:dataType:))]
#[unsafe(method_family = none)]
pub unsafe fn convolutionBiasesDescriptorWithFeatureChannelCount_dataType(
feature_channel_count: NSUInteger,
data_type: MLCDataType,
) -> Option<Retained<Self>>;
);
}