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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// The MLCLossDescriptor specifies a loss filter descriptor.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/mlcompute/mlclossdescriptor?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[deprecated]
pub struct MLCLossDescriptor;
);
extern_conformance!(
unsafe impl NSCopying for MLCLossDescriptor {}
);
unsafe impl CopyingHelper for MLCLossDescriptor {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for MLCLossDescriptor {}
);
impl MLCLossDescriptor {
extern_methods!(
#[cfg(feature = "MLCTypes")]
/// Specifies the loss function.
#[deprecated]
#[unsafe(method(lossType))]
#[unsafe(method_family = none)]
pub unsafe fn lossType(&self) -> MLCLossType;
#[cfg(feature = "MLCTypes")]
/// The reduction operation performed by the loss function.
#[deprecated]
#[unsafe(method(reductionType))]
#[unsafe(method_family = none)]
pub unsafe fn reductionType(&self) -> MLCReductionType;
/// The scale factor to apply to each element of a result. The default value is 1.0.
#[deprecated]
#[unsafe(method(weight))]
#[unsafe(method_family = none)]
pub unsafe fn weight(&self) -> c_float;
/// The label smoothing parameter. The default value is 0.0.
///
/// This parameter is valid only for the loss functions of the following type(s):
/// MLCLossTypeSoftmaxCrossEntropy and MLCLossTypeSigmoidCrossEntropy.
#[deprecated]
#[unsafe(method(labelSmoothing))]
#[unsafe(method_family = none)]
pub unsafe fn labelSmoothing(&self) -> c_float;
/// The number of classes parameter. The default value is 1.
///
/// This parameter is valid only for the loss function MLCLossTypeSoftmaxCrossEntropy.
#[deprecated]
#[unsafe(method(classCount))]
#[unsafe(method_family = none)]
pub unsafe fn classCount(&self) -> NSUInteger;
/// The epsilon parameter. The default value is 1e-7.
///
/// This parameter is valid only for the loss function MLCLossTypeLog.
#[deprecated]
#[unsafe(method(epsilon))]
#[unsafe(method_family = none)]
pub unsafe fn epsilon(&self) -> c_float;
/// The delta parameter. The default value is 1.0f.
///
/// This parameter is valid only for the loss function MLCLossTypeHuber.
#[deprecated]
#[unsafe(method(delta))]
#[unsafe(method_family = none)]
pub unsafe fn delta(&self) -> c_float;
#[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>;
#[cfg(feature = "MLCTypes")]
/// Create a loss descriptor object
///
/// Parameter `lossType`: The loss function.
///
/// Parameter `reductionType`: The reduction operation
///
/// Returns: A new MLCLossDescriptor object
#[deprecated]
#[unsafe(method(descriptorWithType:reductionType:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithType_reductionType(
loss_type: MLCLossType,
reduction_type: MLCReductionType,
) -> Retained<Self>;
#[cfg(feature = "MLCTypes")]
/// Create a loss descriptor object
///
/// Parameter `lossType`: The loss function.
///
/// Parameter `reductionType`: The reduction operation
///
/// Parameter `weight`: The scale factor to apply to each element of a result.
///
/// Returns: A new MLCLossDescriptor object
#[deprecated]
#[unsafe(method(descriptorWithType:reductionType:weight:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithType_reductionType_weight(
loss_type: MLCLossType,
reduction_type: MLCReductionType,
weight: c_float,
) -> Retained<Self>;
#[cfg(feature = "MLCTypes")]
/// Create a loss descriptor object
///
/// Parameter `lossType`: The loss function.
///
/// Parameter `reductionType`: The reduction operation
///
/// Parameter `weight`: The scale factor to apply to each element of a result.
///
/// Parameter `labelSmoothing`: The label smoothing parameter.
///
/// Parameter `classCount`: The number of classes parameter.
///
/// Returns: A new MLCLossDescriptor object
#[deprecated]
#[unsafe(method(descriptorWithType:reductionType:weight:labelSmoothing:classCount:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithType_reductionType_weight_labelSmoothing_classCount(
loss_type: MLCLossType,
reduction_type: MLCReductionType,
weight: c_float,
label_smoothing: c_float,
class_count: NSUInteger,
) -> Retained<Self>;
#[cfg(feature = "MLCTypes")]
/// Create a loss descriptor object
///
/// Parameter `lossType`: The loss function.
///
/// Parameter `reductionType`: The reduction operation
///
/// Parameter `weight`: The scale factor to apply to each element of a result.
///
/// Parameter `labelSmoothing`: The label smoothing parameter.
///
/// Parameter `classCount`: The number of classes parameter.
///
/// Parameter `epsilon`: The epsilon used by LogLoss
///
/// Parameter `delta`: The delta parameter used by Huber loss
///
/// Returns: A new MLCLossDescriptor object
#[deprecated]
#[unsafe(method(descriptorWithType:reductionType:weight:labelSmoothing:classCount:epsilon:delta:))]
#[unsafe(method_family = none)]
pub unsafe fn descriptorWithType_reductionType_weight_labelSmoothing_classCount_epsilon_delta(
loss_type: MLCLossType,
reduction_type: MLCReductionType,
weight: c_float,
label_smoothing: c_float,
class_count: NSUInteger,
epsilon: c_float,
delta: c_float,
) -> Retained<Self>;
);
}