class_docstr: This class evaluates a model against multiple attacks.
class_docstr_tok: ["This","class","evaluates","a","model","against","multiple","attacks","."]
docstr: :param sess: Tensorflow session.
  :param model: an object of Model class
  :param batch_size: batch_size for evaluation.
  :param x_pre: placeholder for input before preprocessing.
  :param x: symbolic input to model.
  :param y: symbolic variable for the label.
  :param data: a tuple with training and test data in the form
               (X_train, Y_train, X_test, Y_test).
  :param writer: Tensorflow summary writer.
  :param hparams: Flags to control the evaluation.
docstr_tok: [":","param","sess",":","Tensorflow","session",".",":","param","model",":","an","object","of","Model","class",":","param","batch_size",":","batch_size","for","evaluation",".",":","param","x_pre",":","placeholder","for","input","before","preprocessing",".",":","param","x",":","symbolic","input","to","model",".",":","param","y",":","symbolic","variable","for","the","label",".",":","param","data",":","a","tuple","with","training","and","test","data","in","the","form","(","X_train",",","Y_train",",","X_test",",","Y_test",")",".",":","param","writer",":","Tensorflow","summary","writer",".",":","param","hparams",":","Flags","to","control","the","evaluation","."]
code: def __init__(
      self,
      sess,
      model,
      batch_size,
      x_pre,
      x,
      y,
      data,
      writer,
      hparams=None,
  ):
      """
      :param sess: Tensorflow session.
      :param model: an object of Model class
      :param batch_size: batch_size for evaluation.
      :param x_pre: placeholder for input before preprocessing.
      :param x: symbolic input to model.
      :param y: symbolic variable for the label.
      :param data: a tuple with training and test data in the form
                   (X_train, Y_train, X_test, Y_test).
      :param writer: Tensorflow summary writer.
      :param hparams: Flags to control the evaluation.
      """
      if hparams is None:
          hparams = {}
      model.set_training(False)
      self.preds = model.get_probs(x)
      self.sess = sess
      self.batch_size = batch_size
      self.x_pre = x_pre
      self.x = x
      self.y = y
      self.X_train, self.Y_train, self.X_test, self.Y_test = data
      self.writer = writer
      self.hparams = hparams
  
      # Evaluate on a fixed subsampled set of the train data
      self.eval_params = {"batch_size": batch_size}
  
      self.epoch = 0
  
      self.attack_type_train = hparams.attack_type_train
      self.attack_type_test = []
      for att_type in hparams.attack_type_test.split(","):
          if att_type == "":
              continue
          self.attack_type_test += [att_type]
      self.attacks = {}
  
      # Initialize the attack object and graph
      for att_type in self.attack_type_test:
          logging.info("Intializing attack %s" % att_type)
          adv_x = create_adv_by_name(
              model, x, att_type, sess, dataset=hparams.dataset, y=y
          )
  
          model.set_training(False)
          preds_adv = model.get_probs(adv_x)
          self.attacks[att_type] = (adv_x, preds_adv)
          # visualize adversarial image
          tf.summary.image(att_type, adv_x, max_outputs=10)
      self.sum_op = tf.summary.merge_all()
  
file_path: cleverhans/cleverhans_v3.1.0/examples/multigpu_advtrain/evaluator.py
imports: import logging
  import tensorflow
  from cleverhans.utils_tf import model_eval
  from cleverhans.attacks import FastGradientMethod
  from cleverhans.attacks import MadryEtAl
  from attacks_multigpu import MadryEtAlMultiGPU
label_desc: Use image node_id 1 to create a new Evaluator object from inherited base classes: object with example: obj = Evaluator(sess, model, batch_size, x_pre, x, y, data, writer, hparams)