import tensorflow as tf

    self._build_summaries()

    self.epoch_stats = get_stats_template()
    self.stats = Bunch(
      epoch_accuracy=[],
      epoch_reconstructions=[],
      permutation=None
    )
    # if FLAGS.dev:
    #   plt.ion()
    #   plt.show()

  def _build_summaries(self):
    # losses
    with tf.name_scope('losses'):
      loss_names = ['loss_autoencoder', 'loss_predictive', 'loss_distance', 'loss_denoising']
      for i, loss in enumerate(self.losses):
        self._add_loss_summary(loss_names[i], loss)
      self._add_loss_summary('loss_total', self.loss_total)
    self.summs_train = tf.summary.merge_all('train')
    # reconstructions
    with tf.name_scope('decodings'):
      self.image_summaries = {
        'orig': self._add_decoding_summary('0_original_input', self.input),
        'reco': self._add_decoding_summary('1_reconstruction', self.eval_decode),
        'pred': self._add_decoding_summary('2_prediction', self.eval_decode),
        'midd': self._add_decoding_summary('3_averaged', self.eval_decode),
        'nois': self._add_decoding_summary('4_noisy', self.eval_decode)
