code: def softmax_cross_entropy_with_logits(sentinel=None,
                                        labels=None,
                                        logits=None,
                                        dim=-1):
    
    # Make sure that all arguments were passed as named arguments.
    if sentinel is not None:
      name = "softmax_cross_entropy_with_logits"
      raise ValueError("Only call `%s` with "
                       "named arguments (labels=..., logits=..., ...)"
                       % name)
    if labels is None or logits is None:
      raise ValueError("Both labels and logits must be provided.")
  
    try:
      f = tf.nn.softmax_cross_entropy_with_logits_v2
    except AttributeError:
      raise RuntimeError("This version of TensorFlow is no longer supported. See cleverhans/README.md")
  
    labels = tf.stop_gradient(labels)
    loss = f(labels=labels, logits=logits, dim=dim)
  
    return loss
docs: Wrapper around tf.nn.softmax_cross_entropy_with_logits_v2 to handle
    deprecated warning