import tensorflow as tf


    self.model = model
    self.encoding = tf.placeholder(self.encode.dtype, self.encode.get_shape(), name='encoding')
    eval_decode = interpreter.build_decoder(self.encoding, model.config, reuse=True)
    print(target, eval_decode)
    self.eval_loss = interpreter.l2_loss(target, eval_decode, name='predictive_reconstruction')
    self.eval_decode = self._tensor_to_image(eval_decode)

    self.loss_ae = interpreter.l2_loss(target, model.decode, name='reconstruction')
    self.decode = self._tensor_to_image(model.decode)
    self.losses = [self.loss_ae]

  def build_predictive_model(self):
    self.build_ae_model()  # builds on top of AE model. Due to auxilary operations init
    self.inputs = tf.placeholder(tf.uint8, [3] + self.batch_shape, name='inputs')
    self.targets = tf.placeholder(tf.uint8, [3] + self.batch_shape, name='targets')

    # transform inputs
    self.raw_inputs = [self._image_to_tensor(self.inputs[i]) for i in range(3)]
    self.raw_targets = [self._image_to_tensor(self.targets[i]) for i in range(3)]

    # build AE objective for triplet
    config = self.model.config
    models = [interpreter.build_autoencoder(x, config) for x in self.raw_inputs]
    reco_losses = [1./3 * interpreter.l2_loss(models[i].decode, self.raw_targets[i]) for i in range(3)]  # business as usual
    self.models = models

    # build predictive objective
