class_docstr: Abstract base class for all attack classes.
class_docstr_tok: ["Abstract","base","class","for","all","attack","classes","."]
docstr: Generate adversarial examples and return them as a NumPy array.
  Sub-classes *should not* implement this method unless they must
  perform special handling of arguments.
  
  :param x_val: A NumPy array with the original inputs.
  :param **kwargs: optional parameters used by child classes.
  :return: A NumPy array holding the adversarial examples.
docstr_tok: ["Generate","adversarial","examples","and","return","them","as","a","NumPy","array",".","Sub-classes","*","should","not","*","implement","this","method","unless","they","must","perform","special","handling","of","arguments",".",":","param","x_val",":","A","NumPy","array","with","the","original","inputs",".",":","param","*","*","kwargs",":","optional","parameters","used","by","child","classes",".",":","return",":","A","NumPy","array","holding","the","adversarial","examples","."]
code: def generate_np(self, x_val, **kwargs):
      """
      Generate adversarial examples and return them as a NumPy array.
      Sub-classes *should not* implement this method unless they must
      perform special handling of arguments.
  
      :param x_val: A NumPy array with the original inputs.
      :param **kwargs: optional parameters used by child classes.
      :return: A NumPy array holding the adversarial examples.
      """
  
      if self.sess is None:
          raise ValueError(
              "Cannot use `generate_np` when no `sess` was" " provided"
          )
  
      packed = self.construct_variables(kwargs)
      fixed, feedable, _, hash_key = packed
  
      if hash_key not in self.graphs:
          self.construct_graph(fixed, feedable, x_val, hash_key)
      else:
          # remove the None arguments, they are just left blank
          for k in list(feedable.keys()):
              if feedable[k] is None:
                  del feedable[k]
  
      x, new_kwargs, x_adv = self.graphs[hash_key]
  
      feed_dict = {x: x_val}
  
      for name in feedable:
          feed_dict[new_kwargs[name]] = feedable[name]
  
      return self.sess.run(x_adv, feed_dict)
  
file_path: cleverhans/cleverhans_v3.1.0/cleverhans/attacks/attack.py
imports: from abc import ABCMeta
  import collections
  import warnings
  import numpy
  import tensorflow
  from cleverhans.compat import reduce_max
  from cleverhans.model import Model
  from cleverhans import utils
label_desc: Use image node_id 4 for calling the Attack obj's underlying member method code with example usage: obj.generate_np(x_val) and returns: self