objc2_ml_compute/generated/MLCTensorDescriptor.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// The MLCTensorDescriptor specifies a tensor descriptor.
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlctensordescriptor?language=objc)
13 #[unsafe(super(NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[deprecated]
16 pub struct MLCTensorDescriptor;
17);
18
19extern_conformance!(
20 unsafe impl NSCopying for MLCTensorDescriptor {}
21);
22
23unsafe impl CopyingHelper for MLCTensorDescriptor {
24 type Result = Self;
25}
26
27extern_conformance!(
28 unsafe impl NSObjectProtocol for MLCTensorDescriptor {}
29);
30
31impl MLCTensorDescriptor {
32 extern_methods!(
33 #[cfg(feature = "MLCTypes")]
34 /// The tensor data type. The default is MLCDataTypeFloat32.
35 #[deprecated]
36 #[unsafe(method(dataType))]
37 #[unsafe(method_family = none)]
38 pub unsafe fn dataType(&self) -> MLCDataType;
39
40 /// The number of dimensions in the tensor
41 #[deprecated]
42 #[unsafe(method(dimensionCount))]
43 #[unsafe(method_family = none)]
44 pub unsafe fn dimensionCount(&self) -> NSUInteger;
45
46 /// The size in each dimension
47 #[deprecated]
48 #[unsafe(method(shape))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn shape(&self) -> Retained<NSArray<NSNumber>>;
51
52 /// The stride in bytes in each dimension
53 #[deprecated]
54 #[unsafe(method(stride))]
55 #[unsafe(method_family = none)]
56 pub unsafe fn stride(&self) -> Retained<NSArray<NSNumber>>;
57
58 /// The allocation size in bytes for a tensor.
59 #[deprecated]
60 #[unsafe(method(tensorAllocationSizeInBytes))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn tensorAllocationSizeInBytes(&self) -> NSUInteger;
63
64 /// TODO
65 #[deprecated]
66 #[unsafe(method(sequenceLengths))]
67 #[unsafe(method_family = none)]
68 pub unsafe fn sequenceLengths(&self) -> Option<Retained<NSArray<NSNumber>>>;
69
70 /// Specifies whether the sequences are sorted or not.
71 #[deprecated]
72 #[unsafe(method(sortedSequences))]
73 #[unsafe(method_family = none)]
74 pub unsafe fn sortedSequences(&self) -> bool;
75
76 /// The batch size for each sequence
77 ///
78 /// We populate this only when sequenceLengths is valid. The length of this array should be
79 /// the maximum sequence length in sequenceLengths (i.e sequenceLengths[0]).
80 #[deprecated]
81 #[unsafe(method(batchSizePerSequenceStep))]
82 #[unsafe(method_family = none)]
83 pub unsafe fn batchSizePerSequenceStep(&self) -> Option<Retained<NSArray<NSNumber>>>;
84
85 #[deprecated]
86 #[unsafe(method(new))]
87 #[unsafe(method_family = new)]
88 pub unsafe fn new() -> Retained<Self>;
89
90 #[deprecated]
91 #[unsafe(method(init))]
92 #[unsafe(method_family = init)]
93 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
94
95 /// The maximum number of tensor dimensions supported
96 #[deprecated]
97 #[unsafe(method(maxTensorDimensions))]
98 #[unsafe(method_family = none)]
99 pub unsafe fn maxTensorDimensions() -> NSUInteger;
100
101 #[cfg(feature = "MLCTypes")]
102 /// Create a MLCTensorDescriptor object
103 ///
104 /// Parameter `shape`: The tensor shape
105 ///
106 /// Parameter `dataType`: The tensor data type
107 ///
108 /// Returns: A new MLCTensorDescriptor object or nil if failure.
109 #[deprecated]
110 #[unsafe(method(descriptorWithShape:dataType:))]
111 #[unsafe(method_family = none)]
112 pub unsafe fn descriptorWithShape_dataType(
113 shape: &NSArray<NSNumber>,
114 data_type: MLCDataType,
115 ) -> Option<Retained<Self>>;
116
117 #[cfg(feature = "MLCTypes")]
118 /// Create a MLCTensorDescriptor object
119 ///
120 /// Parameter `shape`: The tensor shape
121 ///
122 /// Parameter `sequenceLengths`: The sequence lengths in tensor
123 ///
124 /// Parameter `sortedSequences`: A boolean to indicate whether sequences are sorted
125 ///
126 /// Parameter `dataType`: The tensor data type
127 ///
128 /// Returns: A new MLCTensorDescriptor object or nil if failure.
129 ///
130 /// This method is provided as an easy to use API to create sequence tensors used by recurrent layers.
131 #[deprecated]
132 #[unsafe(method(descriptorWithShape:sequenceLengths:sortedSequences:dataType:))]
133 #[unsafe(method_family = none)]
134 pub unsafe fn descriptorWithShape_sequenceLengths_sortedSequences_dataType(
135 shape: &NSArray<NSNumber>,
136 sequence_lengths: &NSArray<NSNumber>,
137 sorted_sequences: bool,
138 data_type: MLCDataType,
139 ) -> Option<Retained<Self>>;
140
141 /// Create a MLCTensorDescriptor object
142 ///
143 /// Parameter `width`: The tensor width
144 ///
145 /// Parameter `height`: The tensor height
146 ///
147 /// Parameter `featureChannels`: The number of feature channels
148 ///
149 /// Parameter `batchSize`: The batch size
150 ///
151 /// Returns: A new MLCTensorDescriptor object or nil if failure.
152 ///
153 /// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
154 #[deprecated]
155 #[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:))]
156 #[unsafe(method_family = none)]
157 pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize(
158 width: NSUInteger,
159 height: NSUInteger,
160 feature_channels: NSUInteger,
161 batch_size: NSUInteger,
162 ) -> Option<Retained<Self>>;
163
164 #[cfg(feature = "MLCTypes")]
165 /// Create a MLCTensorDescriptor object
166 ///
167 /// Parameter `width`: The tensor width
168 ///
169 /// Parameter `height`: The tensor height
170 ///
171 /// Parameter `featureChannelCount`: The number of feature channels
172 ///
173 /// Parameter `batchSize`: The batch size
174 ///
175 /// Parameter `dataType`: The tensor data type
176 ///
177 /// Returns: A new MLCTensorDescriptor object or nil if failure.
178 ///
179 /// This method is provided as an easy to use API to create [NCHW] tensors used by convolutional layers.
180 #[deprecated]
181 #[unsafe(method(descriptorWithWidth:height:featureChannelCount:batchSize:dataType:))]
182 #[unsafe(method_family = none)]
183 pub unsafe fn descriptorWithWidth_height_featureChannelCount_batchSize_dataType(
184 width: NSUInteger,
185 height: NSUInteger,
186 feature_channel_count: NSUInteger,
187 batch_size: NSUInteger,
188 data_type: MLCDataType,
189 ) -> Option<Retained<Self>>;
190
191 #[cfg(feature = "MLCTypes")]
192 /// Create a MLCTensorDescriptor object
193 ///
194 /// Parameter `width`: The tensor width
195 ///
196 /// Parameter `height`: The tensor height
197 ///
198 /// Parameter `inputFeatureChannelCount`: The number of input feature channels
199 ///
200 /// Parameter `outputFeatureChannelCount`: The number of output feature channels
201 ///
202 /// Parameter `dataType`: The tensor data type
203 ///
204 /// Returns: A new MLCTensorDescriptor object or nil if failure.
205 ///
206 /// This method is provided as an easy to use API to create a weight tensor.
207 #[deprecated]
208 #[unsafe(method(convolutionWeightsDescriptorWithWidth:height:inputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
209 #[unsafe(method_family = none)]
210 pub unsafe fn convolutionWeightsDescriptorWithWidth_height_inputFeatureChannelCount_outputFeatureChannelCount_dataType(
211 width: NSUInteger,
212 height: NSUInteger,
213 input_feature_channel_count: NSUInteger,
214 output_feature_channel_count: NSUInteger,
215 data_type: MLCDataType,
216 ) -> Option<Retained<Self>>;
217
218 #[cfg(feature = "MLCTypes")]
219 /// Create a MLCTensorDescriptor object
220 ///
221 /// Parameter `inputFeatureChannelCount`: The number of input feature channels
222 ///
223 /// Parameter `outputFeatureChannelCount`: The number of output feature channels
224 ///
225 /// Parameter `dataType`: The tensor data type
226 ///
227 /// Returns: A new MLCTensorDescriptor object or nil if failure.
228 ///
229 /// This method is provided as an easy to use API to create a weight tensor for a kernel of size 1.
230 #[deprecated]
231 #[unsafe(method(convolutionWeightsDescriptorWithInputFeatureChannelCount:outputFeatureChannelCount:dataType:))]
232 #[unsafe(method_family = none)]
233 pub unsafe fn convolutionWeightsDescriptorWithInputFeatureChannelCount_outputFeatureChannelCount_dataType(
234 input_feature_channel_count: NSUInteger,
235 output_feature_channel_count: NSUInteger,
236 data_type: MLCDataType,
237 ) -> Option<Retained<Self>>;
238
239 #[cfg(feature = "MLCTypes")]
240 /// Create a MLCTensorDescriptor object
241 ///
242 /// Parameter `featureChannelCount`: The number of input feature channels
243 ///
244 /// Parameter `dataType`: The tensor data type
245 ///
246 /// Returns: A new MLCTensorDescriptor object or nil if failure.
247 ///
248 /// This method is provided as an easy to use API to create a bias tensor.
249 #[deprecated]
250 #[unsafe(method(convolutionBiasesDescriptorWithFeatureChannelCount:dataType:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn convolutionBiasesDescriptorWithFeatureChannelCount_dataType(
253 feature_channel_count: NSUInteger,
254 data_type: MLCDataType,
255 ) -> Option<Retained<Self>>;
256 );
257}