class_docstr: Cross-entropy loss for a multiclass softmax classifier.
  :param model: Model instance, the model on which to apply the loss.
  :param smoothing: float, amount of label smoothing for cross-entropy.
  :param attack: function, given an input x, return an attacked x'.
  :param pass_y: bool, if True pass y to the attack
  :param adv_coeff: Coefficient to put on the cross-entropy for
    adversarial examples, if adversarial examples are used.
    The coefficient on the cross-entropy for clean examples is
    1. - adv_coeff.
  :param attack_params: dict, keyword arguments passed to `attack.generate`
class_docstr_tok: ["Cross-entropy","loss","for","a","multiclass","softmax","classifier",".",":","param","model",":","Model","instance",",","the","model","on","which","to","apply","the","loss",".",":","param","smoothing",":","float",",","amount","of","label","smoothing","for","cross-entropy",".",":","param","attack",":","function",",","given","an","input","x",",","return","an","attacked","x","'",".",":","param","pass_y",":","bool",",","if","True","pass","y","to","the","attack",":","param","adv_coeff",":","Coefficient","to","put","on","the","cross-entropy","for","adversarial","examples",",","if","adversarial","examples","are","used",".","The","coefficient","on","the","cross-entropy","for","clean","examples","is","1",".","-","adv_coeff",".",":","param","attack_params",":","dict",",","keyword","arguments","passed","to","`","attack.generate","`"]
code: def fprop(self, x, y, **kwargs):
      kwargs.update(self.kwargs)
      if self.attack is not None:
          attack_params = copy.copy(self.attack_params)
          if attack_params is None:
              attack_params = {}
          if self.pass_y:
              attack_params["y"] = y
          x = x, self.attack.generate(x, **attack_params)
          coeffs = [1.0 - self.adv_coeff, self.adv_coeff]
          if self.adv_coeff == 1.0:
              x = (x[1],)
              coeffs = (coeffs[1],)
      else:
          x = tuple([x])
          coeffs = [1.0]
      assert np.allclose(sum(coeffs), 1.0)
  
      # Catching RuntimeError: Variable -= value not supported by tf.eager.
      try:
          y -= self.smoothing * (
              y - 1.0 / tf.cast(y.shape[-1], y.dtype)
          )
      except RuntimeError:
          y.assign_sub(
              self.smoothing * (y - 1.0 / tf.cast(y.shape[-1], y.dtype))
          )
  
      logits = [self.model.get_logits(x, **kwargs) for x in x]
      loss = sum(
          coeff
          * tf.reduce_mean(
              softmax_cross_entropy_with_logits(labels=y, logits=logit)
          )
          for coeff, logit in safe_zip(coeffs, logits)
      )
      return loss
  
imports: import copy
  import json
  import os
  import warnings
  import numpy
  import tensorflow
  from cleverhans.attacks import Attack
  from cleverhans.compat import softmax_cross_entropy_with_logits
  from cleverhans.model import Model
  from cleverhans.utils import safe_zip
label_desc: Use image node_id 2 for calling the CrossEntropy obj's underlying member method code with example usage: obj.fprop(x, y) and returns: loss