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

Add consistent parameter naming in Loss docs #245

Merged
merged 1 commit into from
Jun 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Sources/TensorFlow/Loss.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,35 @@
// See the License for the specific language governing permissions and
// limitations under the License.

/// Returns the L1 loss between predictions and labels.
/// Returns the L1 loss between predictions and expectations.
///
/// - Parameters:
/// - predicted: Predicted outputs from a neural network.
/// - labels: Expected values, i.e. targets, that correspond to the correct output.
/// - expected: Expected values, i.e. targets, that correspond to the correct output.
@differentiable(wrt: predicted)
public func l1Loss<Scalar: TensorFlowFloatingPoint>(
predicted: Tensor<Scalar>, expected: Tensor<Scalar>
) -> Tensor<Scalar> {
return abs(expected - predicted).sum()
}

/// Returns the L2 loss between predictions and labels.
/// Returns the L2 loss between predictions and expectations.
///
/// - Parameters:
/// - predicted: Predicted outputs from a neural network.
/// - labels: Expected values, i.e. targets, that correspond to the correct output.
/// - expected: Expected values, i.e. targets, that correspond to the correct output.
@differentiable(wrt: predicted)
public func l2Loss<Scalar: TensorFlowFloatingPoint>(
predicted: Tensor<Scalar>, expected: Tensor<Scalar>
) -> Tensor<Scalar> {
return (expected - predicted).squared().sum()
}

/// Returns the mean squared error between predictions and labels.
/// Returns the mean squared error between predictions and expectations.
///
/// - Parameters:
/// - predicted: Predicted outputs from a neural network.
/// - labels: Expected values, i.e. targets, that correspond to the correct output.
/// - expected: Expected values, i.e. targets, that correspond to the correct output.
@differentiable(wrt: predicted)
public func meanSquaredError<Scalar: TensorFlowFloatingPoint>(
predicted: Tensor<Scalar>, expected: Tensor<Scalar>
Expand Down