class_docstr: This implements the SPSA adversary, as in https://arxiv.org/abs/1802.05666
  (Uesato et al. 2018). SPSA is a gradient-free optimization method, which
  is useful when the model is non-differentiable, or more generally, the
  gradients do not point in useful directions.
  
  :param model: cleverhans.model.Model
  :param sess: optional tf.Session
  :param dtypestr: dtype of the data
  :param kwargs: passed through to super constructor
code: def generate_np(self, x_val, **kwargs):
      if "epsilon" in kwargs:
          warnings.warn("Using deprecated argument: see `generate`")
          assert "eps" not in kwargs
          kwargs["eps"] = kwargs["epsilon"]
          del kwargs["epsilon"]
      assert "eps" in kwargs
  
      if "num_steps" in kwargs:
          warnings.warn("Using deprecated argument: see `generate`")
          assert "nb_iter" not in kwargs
          kwargs["nb_iter"] = kwargs["num_steps"]
          del kwargs["num_steps"]
  
      if "y" in kwargs and kwargs["y"] is not None:
          assert kwargs["y"].dtype in [np.int32, np.int64]
      if "y_target" in kwargs and kwargs["y_target"] is not None:
          assert kwargs["y_target"].dtype in [np.int32, np.int64]
  
      # Call self.generate() sequentially for each image in the batch
      x_adv = []
      batch_size = x_val.shape[0]
      y = kwargs.pop("y", [None] * batch_size)
      assert len(x_val) == len(y), "# of images and labels should match"
      for x_single, y_single in zip(x_val, y):
          x = np.expand_dims(x_single, axis=0)
          adv_img = super(SPSA, self).generate_np(
              x, y=y_single, **kwargs
          )
          x_adv.append(adv_img)
      return np.concatenate(x_adv, axis=0)
  
imports: import warnings
  import numpy
  from six.moves import xrange
  import tensorflow
  import tensorflow_addons
  from cleverhans.attacks.attack import Attack
  from cleverhans.compat import reduce_mean, reduce_sum, reduce_max
  from cleverhans.model import Model
  from cleverhans import utils_tf
label_desc: Use image node_id 3 for calling the SPSA obj's underlying member method code with example usage: obj.generate_np(x_val) and returns: np