import tensorflow as tf

    var = var[:FLAGS.visualiza_max]
    var = tf.concat(tf.unstack(var), axis=0)
    var = tf.expand_dims(var, dim=0)
    color_s = tf.summary.image(name, var[..., :3], max_outputs=FLAGS.visualiza_max)
    var = tf.expand_dims(var[..., 3], dim=3)
    bw_s = tf.summary.image('depth_' + name, var, max_outputs=FLAGS.visualiza_max)
    return tf.summary.merge([color_s, bw_s])


# TRAINING PROGRESS EVENTS


  def _on_training_start(self, sess):
    # Writers and savers
    self.summary_writer = tf.summary.FileWriter(FLAGS.logdir, sess.graph)
    self.saver = tf.train.Saver()
    self._build_embedding_saver(sess)
    self._restore_model(sess)
    # Loss summaries
    self._build_summaries()

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