MSELoss

class dragon.vm.torch.nn.MSELoss(
  size_average=None,
  reduce=None,
  reduction='mean'
)[source]

Compute the element-wise squared error.

The MSELoss function is defined as:

\[\text{MSELoss}(x, y) = (x - y)^{2} \]

Examples:

m = torch.nn.MSELoss()
loss = m(torch.ones(2, 3) * 2, torch.zeros(2, 3))

__init__

MSELoss.__init__(
  size_average=None,
  reduce=None,
  reduction='mean'
)[source]

Create a MSELoss module.

Parameters:
  • size_average (bool, optional) True to set the reduction to ‘mean’.
  • reduce (bool, optional) True to set the reduction to ‘sum’ or ‘mean’.
  • reduction ({'none', 'mean', 'sum'}, optional) The reduce method.