code: def print_accuracies(
      filepath,
      train_start=TRAIN_START,
      train_end=TRAIN_END,
      test_start=TEST_START,
      test_end=TEST_END,
      batch_size=BATCH_SIZE,
      which_set=WHICH_SET,
      base_eps_iter=BASE_EPS_ITER,
      nb_iter=NB_ITER,
  ):
      """
      Load a saved model and print out its accuracy on different data distributions
  
      This function works by running a single attack on each example.
      This provides a reasonable estimate of the true failure rate quickly, so
      long as the model does not suffer from gradient masking.
      However, this estimate is mostly intended for development work and not
      for publication. A more accurate estimate may be obtained by running
      an attack bundler instead.
  
      :param filepath: path to model to evaluate
      :param train_start: index of first training set example to use
      :param train_end: index of last training set example to use
      :param test_start: index of first test set example to use
      :param test_end: index of last test set example to use
      :param batch_size: size of evaluation batches
      :param which_set: 'train' or 'test'
      :param base_eps_iter: step size if the data were in [0,1]
        (Step size will be rescaled proportional to the actual data range)
      :param nb_iter: Number of iterations of PGD to run per class
      """
  
      # Set TF random seed to improve reproducibility
      tf.set_random_seed(20181014)
      set_log_level(logging.INFO)
      sess = tf.Session()
  
      with sess.as_default():
          model = load(filepath)
      assert len(model.get_params()) > 0
      factory = model.dataset_factory
      factory.kwargs["train_start"] = train_start
      factory.kwargs["train_end"] = train_end
      factory.kwargs["test_start"] = test_start
      factory.kwargs["test_end"] = test_end
      dataset = factory()
  
      x_data, y_data = dataset.get_set(which_set)
  
      impl(
          sess,
          model,
          dataset,
          factory,
          x_data,
          y_data,
          base_eps_iter,
          nb_iter,
      )
  
file_path: cleverhans/cleverhans_v3.1.0/scripts/compute_accuracy.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from __future__ import unicode_literals
  import logging
  import time
  import tensorflow
  from cleverhans.attacks import ProjectedGradientDescent, Semantic
  from cleverhans.compat import flags
  from cleverhans.evaluation import accuracy
  from cleverhans.serial import load
  from cleverhans.utils import set_log_level
  from cleverhans.utils_tf import infer_devices
  from cleverhans.utils_tf import silence
label_desc: Use image node_id 1 for calling a global function with example usage: print_accuracies(filepath, train_start, train_end, test_start, test_end, batch_size, which_set, base_eps_iter, nb_iter) without return types