Run attack on every example in a dataset.
  :param sess: tf.Session
  :param model: cleverhans.model.Model
  :param x: numpy array containing input examples (e.g. MNIST().x_test )
  :param y: numpy array containing example labels (e.g. MNIST().y_test )
  :param attack: cleverhans.attack.Attack
  :param attack_params: dictionary
    passed to attack.generate as keyword arguments.
  :param batch_size: Number of examples to use in a single evaluation batch.
      If not specified, this function will use a reasonable guess and
      may run out of memory.
      When choosing the batch size, keep in mind that the batch will
      be divided up evenly among available devices. If you can fit 128
      examples in memory on one GPU and you have 8 GPUs, you probably
      want to use a batch size of 1024 (unless a different batch size
      runs faster with the ops you are using, etc.)
  :param devices: An optional list of string device names to use.
    If not specified, this function will use all visible GPUs.
  :param feed: An optional dictionary that is appended to the feeding
           dictionary before the session runs. Can be used to feed
           the learning phase of a Keras model for instance.
  :param pass_y: bool. If true pass 'y' to `attack.generate`
  :return:
    an ndarray of bools indicating whether each example is correct
    an ndarray of probabilities assigned to the prediction for each example

def run_attack(sess, model, x, y, attack, attack_params, batch_size=None,
               devices=None, feed=None, pass_y=False):
  """
  Run attack on every example in a dataset.
  :param sess: tf.Session
  :param model: cleverhans.model.Model
  :param x: numpy array containing input examples (e.g. MNIST().x_test )
  :param y: numpy array containing example labels (e.g. MNIST().y_test )
  :param attack: cleverhans.attack.Attack
  :param attack_params: dictionary
    passed to attack.generate as keyword arguments.
  :param batch_size: Number of examples to use in a single evaluation batch.
      If not specified, this function will use a reasonable guess and
      may run out of memory.
      When choosing the batch size, keep in mind that the batch will
      be divided up evenly among available devices. If you can fit 128
      examples in memory on one GPU and you have 8 GPUs, you probably
      want to use a batch size of 1024 (unless a different batch size
      runs faster with the ops you are using, etc.)
  :param devices: An optional list of string device names to use.
    If not specified, this function will use all visible GPUs.
  :param feed: An optional dictionary that is appended to the feeding
           dictionary before the session runs. Can be used to feed
           the learning phase of a Keras model for instance.
  :param pass_y: bool. If true pass 'y' to `attack.generate`
  :return:
    an ndarray of bools indicating whether each example is correct
    an ndarray of probabilities assigned to the prediction for each example
  """

  _check_x(x)
  _check_y(y)

  factory = _AttackFactory(model, attack, attack_params, pass_y)

  out, = batch_eval_multi_worker(sess, factory, [x, y], batch_size=batch_size,
                                 devices=devices, feed=feed)
  return out