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