This repository was archived by the owner on Jul 1, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -65,6 +65,11 @@ public func hingeLoss<Scalar: TensorFlowFloatingPoint>(
65
65
return max ( Tensor ( 1 ) - expected * predicted, Tensor ( 0 ) ) . mean ( )
66
66
}
67
67
68
+ /// Returns the squared hinge loss between predictions and expectations.
69
+ ///
70
+ /// - Parameters:
71
+ /// - predicted: Predicted outputs from a neural network.
72
+ /// - expected: Expected values, i.e. targets, that correspond to the correct output.
68
73
@differentiable ( wrt: predicted)
69
74
public func squaredHingeLoss< Scalar: TensorFlowFloatingPoint > (
70
75
predicted: Tensor < Scalar > , expected: Tensor < Scalar >
Original file line number Diff line number Diff line change @@ -201,7 +201,7 @@ final class LossTests: XCTestCase {
201
201
( " testHingeLoss " , testHingeLoss) ,
202
202
( " testCategoricalHingeLoss " , testCategoricalHingeLoss) ,
203
203
( " testSquaredHingeLoss " , testSquaredHingeLoss) ,
204
- ( " testPoissonLoss " , testPoissonLoss) ,
204
+ ( " testPoissonLoss " , testPoissonLoss) ,
205
205
( " testSoftmaxCrossEntropyWithProbabilitiesLoss " ,
206
206
testSoftmaxCrossEntropyWithProbabilitiesLoss) ,
207
207
( " testSoftmaxCrossEntropyWithProbabilitiesGrad " ,
You can’t perform that action at this time.
0 commit comments