objc2_ml_compute/generated/MLCLossLayer.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10 /// A loss layer
11 ///
12 /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclosslayer?language=objc)
13 #[unsafe(super(MLCLayer, NSObject))]
14 #[derive(Debug, PartialEq, Eq, Hash)]
15 #[cfg(feature = "MLCLayer")]
16 #[deprecated]
17 pub struct MLCLossLayer;
18);
19
20#[cfg(feature = "MLCLayer")]
21extern_conformance!(
22 unsafe impl NSObjectProtocol for MLCLossLayer {}
23);
24
25#[cfg(feature = "MLCLayer")]
26impl MLCLossLayer {
27 extern_methods!(
28 #[cfg(feature = "MLCLossDescriptor")]
29 /// The loss descriptor
30 #[deprecated]
31 #[unsafe(method(descriptor))]
32 #[unsafe(method_family = none)]
33 pub unsafe fn descriptor(&self) -> Retained<MLCLossDescriptor>;
34
35 #[cfg(feature = "MLCTensor")]
36 /// The loss label weights tensor
37 #[deprecated]
38 #[unsafe(method(weights))]
39 #[unsafe(method_family = none)]
40 pub unsafe fn weights(&self) -> Option<Retained<MLCTensor>>;
41
42 #[cfg(feature = "MLCLossDescriptor")]
43 /// Create a loss layer
44 ///
45 /// Parameter `lossDescriptor`: The loss descriptor
46 ///
47 /// Returns: A new loss layer.
48 #[deprecated]
49 #[unsafe(method(layerWithDescriptor:))]
50 #[unsafe(method_family = none)]
51 pub unsafe fn layerWithDescriptor(loss_descriptor: &MLCLossDescriptor) -> Retained<Self>;
52
53 #[cfg(all(feature = "MLCLossDescriptor", feature = "MLCTensor"))]
54 /// Create a MLComputeLoss layer
55 ///
56 /// Parameter `lossDescriptor`: The loss descriptor
57 ///
58 /// Parameter `weights`: The loss label weights tensor
59 ///
60 /// Returns: A new loss layer.
61 #[deprecated]
62 #[unsafe(method(layerWithDescriptor:weights:))]
63 #[unsafe(method_family = none)]
64 pub unsafe fn layerWithDescriptor_weights(
65 loss_descriptor: &MLCLossDescriptor,
66 weights: &MLCTensor,
67 ) -> Retained<Self>;
68
69 #[cfg(feature = "MLCTypes")]
70 /// Create a loss layer
71 ///
72 /// Parameter `reductionType`: The reduction type to use
73 ///
74 /// Parameter `labelSmoothing`: Label smoothing value
75 ///
76 /// Parameter `classCount`: Number of classes
77 ///
78 /// Parameter `weight`: A scalar floating point value
79 ///
80 /// Returns: A new softmax cross entropy loss layer.
81 #[deprecated]
82 #[unsafe(method(softmaxCrossEntropyLossWithReductionType:labelSmoothing:classCount:weight:))]
83 #[unsafe(method_family = none)]
84 pub unsafe fn softmaxCrossEntropyLossWithReductionType_labelSmoothing_classCount_weight(
85 reduction_type: MLCReductionType,
86 label_smoothing: c_float,
87 class_count: NSUInteger,
88 weight: c_float,
89 ) -> Retained<Self>;
90
91 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
92 /// Create a loss layer
93 ///
94 /// Parameter `reductionType`: The reduction type to use
95 ///
96 /// Parameter `labelSmoothing`: Label smoothing value
97 ///
98 /// Parameter `classCount`: Number of classes
99 ///
100 /// Parameter `weights`: The loss label weights tensor
101 ///
102 /// Returns: A new softmax cross entropy loss layer.
103 #[deprecated]
104 #[unsafe(method(softmaxCrossEntropyLossWithReductionType:labelSmoothing:classCount:weights:))]
105 #[unsafe(method_family = none)]
106 pub unsafe fn softmaxCrossEntropyLossWithReductionType_labelSmoothing_classCount_weights(
107 reduction_type: MLCReductionType,
108 label_smoothing: c_float,
109 class_count: NSUInteger,
110 weights: Option<&MLCTensor>,
111 ) -> Retained<Self>;
112
113 #[cfg(feature = "MLCTypes")]
114 /// Create a loss layer
115 ///
116 /// Parameter `reductionType`: The reduction type to use
117 ///
118 /// Parameter `labelSmoothing`: Label smoothing value
119 ///
120 /// Parameter `classCount`: Number of classes
121 ///
122 /// Parameter `weight`: A scalar floating point value
123 ///
124 /// Returns: A new categorical cross entropy loss layer.
125 #[deprecated]
126 #[unsafe(method(categoricalCrossEntropyLossWithReductionType:labelSmoothing:classCount:weight:))]
127 #[unsafe(method_family = none)]
128 pub unsafe fn categoricalCrossEntropyLossWithReductionType_labelSmoothing_classCount_weight(
129 reduction_type: MLCReductionType,
130 label_smoothing: c_float,
131 class_count: NSUInteger,
132 weight: c_float,
133 ) -> Retained<Self>;
134
135 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
136 /// Create a loss layer
137 ///
138 /// Parameter `reductionType`: The reduction type to use
139 ///
140 /// Parameter `labelSmoothing`: Label smoothing value
141 ///
142 /// Parameter `classCount`: Number of classes
143 ///
144 /// Parameter `weights`: The loss label weights tensor
145 ///
146 /// Returns: A new categorical cross entropy loss layer.
147 #[deprecated]
148 #[unsafe(method(categoricalCrossEntropyLossWithReductionType:labelSmoothing:classCount:weights:))]
149 #[unsafe(method_family = none)]
150 pub unsafe fn categoricalCrossEntropyLossWithReductionType_labelSmoothing_classCount_weights(
151 reduction_type: MLCReductionType,
152 label_smoothing: c_float,
153 class_count: NSUInteger,
154 weights: Option<&MLCTensor>,
155 ) -> Retained<Self>;
156
157 #[cfg(feature = "MLCTypes")]
158 /// Create a loss layer
159 ///
160 /// Parameter `reductionType`: The reduction type to use
161 ///
162 /// Parameter `labelSmoothing`: Label smoothing value
163 ///
164 /// Parameter `weight`: A scalar floating-point value
165 ///
166 /// Returns: A new sigmoid cross entropy loss layer.
167 #[deprecated]
168 #[unsafe(method(sigmoidCrossEntropyLossWithReductionType:labelSmoothing:weight:))]
169 #[unsafe(method_family = none)]
170 pub unsafe fn sigmoidCrossEntropyLossWithReductionType_labelSmoothing_weight(
171 reduction_type: MLCReductionType,
172 label_smoothing: c_float,
173 weight: c_float,
174 ) -> Retained<Self>;
175
176 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
177 /// Create a loss layer
178 ///
179 /// Parameter `reductionType`: The reduction type to use
180 ///
181 /// Parameter `labelSmoothing`: Label smoothing value
182 ///
183 /// Parameter `weights`: The loss label weights tensor
184 ///
185 /// Returns: A new sigmoid cross entropy loss layer.
186 #[deprecated]
187 #[unsafe(method(sigmoidCrossEntropyLossWithReductionType:labelSmoothing:weights:))]
188 #[unsafe(method_family = none)]
189 pub unsafe fn sigmoidCrossEntropyLossWithReductionType_labelSmoothing_weights(
190 reduction_type: MLCReductionType,
191 label_smoothing: c_float,
192 weights: Option<&MLCTensor>,
193 ) -> Retained<Self>;
194
195 #[cfg(feature = "MLCTypes")]
196 /// Create a loss layer
197 ///
198 /// Parameter `reductionType`: The reduction type to use
199 ///
200 /// Parameter `epsilon`: The epsilon parameter
201 ///
202 /// Parameter `weight`: A scalar floating-point value
203 ///
204 /// Returns: A new log loss layer.
205 #[deprecated]
206 #[unsafe(method(logLossWithReductionType:epsilon:weight:))]
207 #[unsafe(method_family = none)]
208 pub unsafe fn logLossWithReductionType_epsilon_weight(
209 reduction_type: MLCReductionType,
210 epsilon: c_float,
211 weight: c_float,
212 ) -> Retained<Self>;
213
214 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
215 /// Create a loss layer
216 ///
217 /// Parameter `reductionType`: The reduction type to use
218 ///
219 /// Parameter `epsilon`: The epsilon parameter
220 ///
221 /// Parameter `weights`: The loss label weights tensor
222 ///
223 /// Returns: A new log loss layer.
224 #[deprecated]
225 #[unsafe(method(logLossWithReductionType:epsilon:weights:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn logLossWithReductionType_epsilon_weights(
228 reduction_type: MLCReductionType,
229 epsilon: c_float,
230 weights: Option<&MLCTensor>,
231 ) -> Retained<Self>;
232
233 #[cfg(feature = "MLCTypes")]
234 /// Create a loss layer
235 ///
236 /// Parameter `reductionType`: The reduction type to use
237 ///
238 /// Parameter `delta`: The delta parameter
239 ///
240 /// Parameter `weight`: A scalar floating-point value
241 ///
242 /// Returns: A new huber loss layer.
243 #[deprecated]
244 #[unsafe(method(huberLossWithReductionType:delta:weight:))]
245 #[unsafe(method_family = none)]
246 pub unsafe fn huberLossWithReductionType_delta_weight(
247 reduction_type: MLCReductionType,
248 delta: c_float,
249 weight: c_float,
250 ) -> Retained<Self>;
251
252 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
253 /// Create a loss layer
254 ///
255 /// Parameter `reductionType`: The reduction type to use
256 ///
257 /// Parameter `delta`: The delta parameter
258 ///
259 /// Parameter `weights`: The loss label weights tensor
260 ///
261 /// Returns: A new huber loss layer.
262 #[deprecated]
263 #[unsafe(method(huberLossWithReductionType:delta:weights:))]
264 #[unsafe(method_family = none)]
265 pub unsafe fn huberLossWithReductionType_delta_weights(
266 reduction_type: MLCReductionType,
267 delta: c_float,
268 weights: Option<&MLCTensor>,
269 ) -> Retained<Self>;
270
271 #[cfg(feature = "MLCTypes")]
272 /// Create a loss layer
273 ///
274 /// Parameter `reductionType`: The reduction type to use
275 ///
276 /// Parameter `weight`: A scalar floating-point value
277 ///
278 /// Returns: A new L1 i.e. mean absolute error loss layer.
279 #[deprecated]
280 #[unsafe(method(meanAbsoluteErrorLossWithReductionType:weight:))]
281 #[unsafe(method_family = none)]
282 pub unsafe fn meanAbsoluteErrorLossWithReductionType_weight(
283 reduction_type: MLCReductionType,
284 weight: c_float,
285 ) -> Retained<Self>;
286
287 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
288 /// Create a loss layer
289 ///
290 /// Parameter `reductionType`: The reduction type to use
291 ///
292 /// Parameter `weights`: The loss label weights tensor
293 ///
294 /// Returns: A new L1 i.e. mean absolute error loss layer.
295 #[deprecated]
296 #[unsafe(method(meanAbsoluteErrorLossWithReductionType:weights:))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn meanAbsoluteErrorLossWithReductionType_weights(
299 reduction_type: MLCReductionType,
300 weights: Option<&MLCTensor>,
301 ) -> Retained<Self>;
302
303 #[cfg(feature = "MLCTypes")]
304 /// Create a loss layer
305 ///
306 /// Parameter `reductionType`: The reduction type to use
307 ///
308 /// Parameter `weight`: A scalar floating-point value
309 ///
310 /// Returns: A new L2 i.e. mean squared error loss layer.
311 #[deprecated]
312 #[unsafe(method(meanSquaredErrorLossWithReductionType:weight:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn meanSquaredErrorLossWithReductionType_weight(
315 reduction_type: MLCReductionType,
316 weight: c_float,
317 ) -> Retained<Self>;
318
319 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
320 /// Create a loss layer
321 ///
322 /// Parameter `reductionType`: The reduction type to use
323 ///
324 /// Parameter `weights`: The loss label weights tensor
325 ///
326 /// Returns: A new L2 i.e. mean squared error loss layer.
327 #[deprecated]
328 #[unsafe(method(meanSquaredErrorLossWithReductionType:weights:))]
329 #[unsafe(method_family = none)]
330 pub unsafe fn meanSquaredErrorLossWithReductionType_weights(
331 reduction_type: MLCReductionType,
332 weights: Option<&MLCTensor>,
333 ) -> Retained<Self>;
334
335 #[cfg(feature = "MLCTypes")]
336 /// Create a loss layer
337 ///
338 /// Parameter `reductionType`: The reduction type to use
339 ///
340 /// Parameter `weight`: A scalar floating-point value
341 ///
342 /// Returns: A new hinge loss layer.
343 #[deprecated]
344 #[unsafe(method(hingeLossWithReductionType:weight:))]
345 #[unsafe(method_family = none)]
346 pub unsafe fn hingeLossWithReductionType_weight(
347 reduction_type: MLCReductionType,
348 weight: c_float,
349 ) -> Retained<Self>;
350
351 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
352 /// Create a loss layer
353 ///
354 /// Parameter `reductionType`: The reduction type to use
355 ///
356 /// Parameter `weights`: The loss label weights tensor
357 ///
358 /// Returns: A new hinge loss layer.
359 #[deprecated]
360 #[unsafe(method(hingeLossWithReductionType:weights:))]
361 #[unsafe(method_family = none)]
362 pub unsafe fn hingeLossWithReductionType_weights(
363 reduction_type: MLCReductionType,
364 weights: Option<&MLCTensor>,
365 ) -> Retained<Self>;
366
367 #[cfg(feature = "MLCTypes")]
368 /// Create a loss layer
369 ///
370 /// Parameter `reductionType`: The reduction type to use
371 ///
372 /// Parameter `weight`: A scalar floating-point value
373 ///
374 /// Returns: A new cosine distance loss layer.
375 #[deprecated]
376 #[unsafe(method(cosineDistanceLossWithReductionType:weight:))]
377 #[unsafe(method_family = none)]
378 pub unsafe fn cosineDistanceLossWithReductionType_weight(
379 reduction_type: MLCReductionType,
380 weight: c_float,
381 ) -> Retained<Self>;
382
383 #[cfg(all(feature = "MLCTensor", feature = "MLCTypes"))]
384 /// Create a loss layer
385 ///
386 /// Parameter `reductionType`: The reduction type to use
387 ///
388 /// Parameter `weights`: The loss label weights tensor
389 ///
390 /// Returns: A new cosine distance loss layer.
391 #[deprecated]
392 #[unsafe(method(cosineDistanceLossWithReductionType:weights:))]
393 #[unsafe(method_family = none)]
394 pub unsafe fn cosineDistanceLossWithReductionType_weights(
395 reduction_type: MLCReductionType,
396 weights: Option<&MLCTensor>,
397 ) -> Retained<Self>;
398 );
399}
400
401/// Methods declared on superclass `MLCLayer`.
402#[cfg(feature = "MLCLayer")]
403impl MLCLossLayer {
404 extern_methods!(
405 #[deprecated]
406 #[unsafe(method(new))]
407 #[unsafe(method_family = new)]
408 pub unsafe fn new() -> Retained<Self>;
409
410 #[deprecated]
411 #[unsafe(method(init))]
412 #[unsafe(method_family = init)]
413 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
414 );
415}