softmax_cross_entropy_with_logits

dragon.vm.torch.nn.functional.softmax_cross_entropy_with_logits(
  input,
  target,
  weight=None,
  size_average=None,
  reduce=None,
  reduction='mean',
  pos_weight=None
)[source]

Compute the softmax cross entropy with contiguous targets.

The CrossEntropy function is defined as:

\[\text{CrossEntropy}(p_{t}) = -\log(p_{t}) \]
Parameters:
  • input (dragon.vm.torch.Tensor) – The input tensor.
  • target (dragon.vm.torch.Tensor) – The target tensor.
  • weight (dragon.vm.torch.Tensor, optional) – The weight for each class.
  • size_average (bool, optional) – Whether to average the loss.
  • reduce (bool, optional) – Whether to reduce the loss.
  • reduction ({'none', 'mean', 'sum'}, optional) – The reduce method.
  • pos_weight (dragon.vm.torch.Tensor, optional) – The weight for positive examples.
Returns:

dragon.vm.torch.Tensor – The output tensor.