code: def save_images(images, filenames, output_dir):
      """Saves images to the output directory.
  
      Args:
        images: array with minibatch of images
        filenames: list of filenames without path
          If number of file names in this list less than number of images in
          the minibatch then only first len(filenames) images will be saved.
        output_dir: directory where to save images
      """
      for i, filename in enumerate(filenames):
          # Images for inception classifier are normalized to be in [-1, 1] interval,
          # so rescale them back to [0, 1].
          with tf.gfile.Open(
              os.path.join(output_dir, filename), "w"
          ) as f:
              imsave(f, (images[i, :, :, :] + 1.0) * 0.5, format="png")
  
file_path: cleverhans/cleverhans_v3.1.0/examples/nips17_adversarial_competition/dev_toolkit/sample_targeted_attacks/step_target_class/attack_step_target_class.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import csv
  import os
  import numpy
  import tensorflow
  from tensorflow.contrib.slim.nets import inception
  from scipy.misc import imread
  from scipy.misc import imsave
label_desc: Use image node_id 3 for calling a global function with example usage: save_images(images, filenames, output_dir) without return types