code: def sparse_cross_entropy(input_,
                           labels,
                           name=PROVIDED,
                           loss_weight=None,
                           per_example_weights=None):
    
    if labels is None:
      raise ValueError('Labels must be set')
  
    if per_example_weights is not None:
      per_example_weights = _convert_and_assert_per_example_weights_compatible(
          input_,
          per_example_weights,
          dtype=input_.dtype)
  
    return apply_regression(
        input_,
        tf.contrib.nn.deprecated_flipped_sparse_softmax_cross_entropy_with_logits,
        labels,
        [],
        name='%s_loss' % name,
        loss_weight=loss_weight,
        per_example_weights=per_example_weights)
docs: Calculates the Cross Entropy of input_ vs labels.
  
    Args:
      input_: A rank 2 `Tensor` or a Pretty Tensor holding the logits.
      labels: A rank 1 integer `Tensor` with class ordinals
      name: The optional name.
      loss_weight: A weight to scale the loss. Used when there are multiple
        losses.
      per_example_weights: A weighting for each example.
    Returns:
      A loss.
    Raises:
      ValueError: if labels is None or the type is not float or double.