def mean_squared_error(weights=1.0, name='MeanSquaredError', scope=None, collect=True):
"""Computes Mean Square Loss.
Args:
weights: Coefficients for the loss a `scalar`.
scope: scope to add the op to.
name: name of the op.
collect: add to losses collection.
Returns:
A scalar `Tensor` representing the loss value.
Raises:
ValueError: If `predictions` shape doesn't match `labels` shape, or `weights` is `None`.
"""
def inner_loss(y_true, y_pred):
losses = math_ops.square(math_ops.subtract(y_pred, y_true))
return losses
return built_loss(inner_loss, weights, name, scope, collect)
评论列表
文章目录