objc2_ml_compute/generated/MLCLossDescriptor.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::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11 /// The MLCLossDescriptor specifies a loss filter descriptor.
12 ///
13 /// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclossdescriptor?language=objc)
14 #[unsafe(super(NSObject))]
15 #[derive(Debug, PartialEq, Eq, Hash)]
16 #[deprecated]
17 pub struct MLCLossDescriptor;
18);
19
20extern_conformance!(
21 unsafe impl NSCopying for MLCLossDescriptor {}
22);
23
24unsafe impl CopyingHelper for MLCLossDescriptor {
25 type Result = Self;
26}
27
28extern_conformance!(
29 unsafe impl NSObjectProtocol for MLCLossDescriptor {}
30);
31
32impl MLCLossDescriptor {
33 extern_methods!(
34 #[cfg(feature = "MLCTypes")]
35 /// Specifies the loss function.
36 #[deprecated]
37 #[unsafe(method(lossType))]
38 #[unsafe(method_family = none)]
39 pub unsafe fn lossType(&self) -> MLCLossType;
40
41 #[cfg(feature = "MLCTypes")]
42 /// The reduction operation performed by the loss function.
43 #[deprecated]
44 #[unsafe(method(reductionType))]
45 #[unsafe(method_family = none)]
46 pub unsafe fn reductionType(&self) -> MLCReductionType;
47
48 /// The scale factor to apply to each element of a result. The default value is 1.0.
49 #[deprecated]
50 #[unsafe(method(weight))]
51 #[unsafe(method_family = none)]
52 pub unsafe fn weight(&self) -> c_float;
53
54 /// The label smoothing parameter. The default value is 0.0.
55 ///
56 /// This parameter is valid only for the loss functions of the following type(s):
57 /// MLCLossTypeSoftmaxCrossEntropy and MLCLossTypeSigmoidCrossEntropy.
58 #[deprecated]
59 #[unsafe(method(labelSmoothing))]
60 #[unsafe(method_family = none)]
61 pub unsafe fn labelSmoothing(&self) -> c_float;
62
63 /// The number of classes parameter. The default value is 1.
64 ///
65 /// This parameter is valid only for the loss function MLCLossTypeSoftmaxCrossEntropy.
66 #[deprecated]
67 #[unsafe(method(classCount))]
68 #[unsafe(method_family = none)]
69 pub unsafe fn classCount(&self) -> NSUInteger;
70
71 /// The epsilon parameter. The default value is 1e-7.
72 ///
73 /// This parameter is valid only for the loss function MLCLossTypeLog.
74 #[deprecated]
75 #[unsafe(method(epsilon))]
76 #[unsafe(method_family = none)]
77 pub unsafe fn epsilon(&self) -> c_float;
78
79 /// The delta parameter. The default value is 1.0f.
80 ///
81 /// This parameter is valid only for the loss function MLCLossTypeHuber.
82 #[deprecated]
83 #[unsafe(method(delta))]
84 #[unsafe(method_family = none)]
85 pub unsafe fn delta(&self) -> c_float;
86
87 #[deprecated]
88 #[unsafe(method(new))]
89 #[unsafe(method_family = new)]
90 pub unsafe fn new() -> Retained<Self>;
91
92 #[deprecated]
93 #[unsafe(method(init))]
94 #[unsafe(method_family = init)]
95 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
96
97 #[cfg(feature = "MLCTypes")]
98 /// Create a loss descriptor object
99 ///
100 /// Parameter `lossType`: The loss function.
101 ///
102 /// Parameter `reductionType`: The reduction operation
103 ///
104 /// Returns: A new MLCLossDescriptor object
105 #[deprecated]
106 #[unsafe(method(descriptorWithType:reductionType:))]
107 #[unsafe(method_family = none)]
108 pub unsafe fn descriptorWithType_reductionType(
109 loss_type: MLCLossType,
110 reduction_type: MLCReductionType,
111 ) -> Retained<Self>;
112
113 #[cfg(feature = "MLCTypes")]
114 /// Create a loss descriptor object
115 ///
116 /// Parameter `lossType`: The loss function.
117 ///
118 /// Parameter `reductionType`: The reduction operation
119 ///
120 /// Parameter `weight`: The scale factor to apply to each element of a result.
121 ///
122 /// Returns: A new MLCLossDescriptor object
123 #[deprecated]
124 #[unsafe(method(descriptorWithType:reductionType:weight:))]
125 #[unsafe(method_family = none)]
126 pub unsafe fn descriptorWithType_reductionType_weight(
127 loss_type: MLCLossType,
128 reduction_type: MLCReductionType,
129 weight: c_float,
130 ) -> Retained<Self>;
131
132 #[cfg(feature = "MLCTypes")]
133 /// Create a loss descriptor object
134 ///
135 /// Parameter `lossType`: The loss function.
136 ///
137 /// Parameter `reductionType`: The reduction operation
138 ///
139 /// Parameter `weight`: The scale factor to apply to each element of a result.
140 ///
141 /// Parameter `labelSmoothing`: The label smoothing parameter.
142 ///
143 /// Parameter `classCount`: The number of classes parameter.
144 ///
145 /// Returns: A new MLCLossDescriptor object
146 #[deprecated]
147 #[unsafe(method(descriptorWithType:reductionType:weight:labelSmoothing:classCount:))]
148 #[unsafe(method_family = none)]
149 pub unsafe fn descriptorWithType_reductionType_weight_labelSmoothing_classCount(
150 loss_type: MLCLossType,
151 reduction_type: MLCReductionType,
152 weight: c_float,
153 label_smoothing: c_float,
154 class_count: NSUInteger,
155 ) -> Retained<Self>;
156
157 #[cfg(feature = "MLCTypes")]
158 /// Create a loss descriptor object
159 ///
160 /// Parameter `lossType`: The loss function.
161 ///
162 /// Parameter `reductionType`: The reduction operation
163 ///
164 /// Parameter `weight`: The scale factor to apply to each element of a result.
165 ///
166 /// Parameter `labelSmoothing`: The label smoothing parameter.
167 ///
168 /// Parameter `classCount`: The number of classes parameter.
169 ///
170 /// Parameter `epsilon`: The epsilon used by LogLoss
171 ///
172 /// Parameter `delta`: The delta parameter used by Huber loss
173 ///
174 /// Returns: A new MLCLossDescriptor object
175 #[deprecated]
176 #[unsafe(method(descriptorWithType:reductionType:weight:labelSmoothing:classCount:epsilon:delta:))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn descriptorWithType_reductionType_weight_labelSmoothing_classCount_epsilon_delta(
179 loss_type: MLCLossType,
180 reduction_type: MLCReductionType,
181 weight: c_float,
182 label_smoothing: c_float,
183 class_count: NSUInteger,
184 epsilon: c_float,
185 delta: c_float,
186 ) -> Retained<Self>;
187 );
188}