code: def generate(self, x, g, **kwargs):
      
  
      # Parse and save attack-specific parameters
      assert self.parse_params(**kwargs)
  
      g_feat = self.model.fprop(g)[self.layer]
  
      # Initialize loop variables
      eta = tf.random_uniform(
          tf.shape(x), -self.eps, self.eps, dtype=self.tf_dtype)
      eta = clip_eta(eta, self.ord, self.eps)
  
      def cond(i, _):
        return tf.less(i, self.nb_iter)
  
      def body(i, e):
        new_eta = self.attack_single_step(x, e, g_feat)
        return i + 1, new_eta
  
      _, eta = tf.while_loop(cond, body, (tf.zeros([]), eta), back_prop=True,
                             maximum_iterations=self.nb_iter)
  
      # Define adversarial example (and clip if necessary)
      adv_x = x + eta
      if self.clip_min is not None and self.clip_max is not None:
        adv_x = tf.clip_by_value(adv_x, self.clip_min, self.clip_max)
  
      return adv_x
docs: Generate symbolic graph for adversarial examples and return.
  
      :param x: The model's symbolic inputs.
      :param g: The target value of the symbolic representation
      :param kwargs: See `parse_params`