L1Loss

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

Compute the element-wise absolute value difference.

The L1Loss function is defined as:

\[\text{L1Loss}(x, y) = |x - y| \]

Examples:

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

__init__

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

Create a L1Loss 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.