oneflow.nn.functional.mse_loss¶
-
oneflow.nn.functional.
mse_loss
(input, target, reduction='mean') → Tensor¶ This operator computes the mean squared error (squared L2 norm) loss between each element in input and target.
see
MSELoss
for details.- Parameters
input (Tensor) – The input Tensor.
target (Tensor) – The target Tensor.
reduction (string, optional) – Specifies the reduction to apply to the output:
'none'
|'mean'
|'sum'
.'none'
: no reduction will be applied,'mean'
: the sum of the output will be divided by the number of elements in the output,'sum'
: the output will be summed. Default:'mean'
Examples:
>>> import oneflow as flow >>> import oneflow.nn.functional as F >>> input = flow.randn(3, 4, requires_grad=True) >>> target = flow.rand(3, 4, requires_grad=False) >>> loss = F.mse_loss(input, target) >>> loss.backward()