Rate this Page
โ˜… โ˜… โ˜… โ˜… โ˜…

torch.nn.functional.mse_loss#

torch.nn.functional.mse_loss(input, target, size_average=None, reduce=None, reduction='mean', weight=None)[source]#

Compute the element-wise mean squared error, with optional weighting.

See MSELoss for details.

Parameters
  • input (Tensor) โ€“ Predicted values.

  • target (Tensor) โ€“ Ground truth values.

  • size_average (bool, optional) โ€“ Deprecated (see reduction).

  • reduce (bool, optional) โ€“ Deprecated (see reduction).

  • reduction (str, optional) โ€“ Specifies the reduction to apply to the output: โ€˜noneโ€™ | โ€˜meanโ€™ | โ€˜sumโ€™. โ€˜meanโ€™: the mean of the output is taken. โ€˜sumโ€™: the output will be summed. โ€˜noneโ€™: no reduction will be applied. Default: โ€˜meanโ€™.

  • weight (Tensor, optional) โ€“ Weights for each sample. Default: None.

Returns

Mean Squared Error loss (optionally weighted).

Return type

Tensor