Skip to content
This repository was archived by the owner on Jul 1, 2023. It is now read-only.

Commit 2c08006

Browse files
committed
NFC: Lint loss functions.
1 parent 6add73c commit 2c08006

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/DeepLearning/Loss.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,14 @@ import TensorFlow
1818

1919
@differentiable
2020
public func meanSquaredError<Scalar: TensorFlowFloatingPoint>(
21-
predicted: Tensor<Scalar>, expected: Tensor<Scalar>) -> Tensor<Scalar> {
21+
predicted: Tensor<Scalar>, expected: Tensor<Scalar>
22+
) -> Tensor<Scalar> {
2223
return (expected - predicted).squared().mean()
2324
}
2425

2526
@differentiable
2627
public func softmaxCrossEntropy<Scalar: TensorFlowFloatingPoint>(
27-
logits: Tensor<Scalar>, labels: Tensor<Scalar>) -> Tensor<Scalar> {
28+
logits: Tensor<Scalar>, labels: Tensor<Scalar>
29+
) -> Tensor<Scalar> {
2830
return -(labels * logSoftmax(logits)).mean(alongAxes: 0).sum()
2931
}

0 commit comments

Comments
 (0)