cross_entropy¶
- dragon.vm.torch.nn.functional.- cross_entropy(
 input,
 target,
 weight=None,
 size_average=None,
 ignore_index=None,
 reduce=None,
 reduction='mean'
 )[source]¶
- Compute the softmax cross entropy with sparse target. - 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.
- ignore_index (int, optional) – The ignored value of target.
- reduce (bool, optional) – Whether to reduce the loss.
- reduction ({'none', 'mean', 'sum', 'valid'}, optional) – The reduce method.
 
 - Returns:
- dragon.vm.torch.Tensor – The loss. 
 - See also 
