def visualize_training(images_val,<EOL>reconstructed_images_val,<EOL>random_images_val,<EOL>log_dir, prefix, viz_n=<NUM_LIT:10>):
save_imgs(images_val[:viz_n],<EOL>os.path.join(log_dir, "<STR_LIT>".format(prefix)))<EOL>save_imgs(reconstructed_images_val[:viz_n],<EOL>os.path.join(log_dir,<EOL>"<STR_LIT>".format(prefix)))<EOL>if random_images_val is not None:<EOL><INDENT>save_imgs(random_images_val[:viz_n],<EOL>os.path.join(log_dir,<EOL>"<STR_LIT>".format(prefix)))<EOL><DEDENT>
Helper method to save images visualizing model reconstructions.

    Args:
      images_val: Numpy array containing a batch of input images.
      reconstructed_images_val: Numpy array giving the expected output
        (mean) of the decoder.
      random_images_val: Optionally, a Numpy array giving the expected output
        (mean) of decoding samples from the prior, or `None`.
      log_dir: The directory to write images (Python `str`).
      prefix: A specific label for the saved visualizations, which
        determines their filenames (Python `str`).
      viz_n: The number of images from each batch to visualize (Python `int`).