def METHOD_NAME(self, tensors, use_weights, reduction):
    input, target_indices, target_onehot = tensors
    if use_weights:
        num_classes = target_onehot.shape[1]
        weights = torch.rand(size=[num_classes])
    else:
        weights = None
    loss_indices = soft_cross_entropy(input, target_indices, weight=weights, reduction=reduction, ignore_index=-1)
    loss_onehot = soft_cross_entropy(input, target_onehot, weight=weights, reduction=reduction)
    loss_reference = F.cross_entropy(input, target_indices, weight=weights, reduction=reduction, ignore_index=-1)
    torch.testing.assert_close(loss_indices, loss_onehot)
    torch.testing.assert_close(loss_indices, loss_reference)