Keras intermediate layer output to calculate the loss

Viewed 1879

I am using Keras with theano, to train an autoencoder model. I want to use an intermediate layer representation of the model to do some specific calculation in the loss function (a custom loss function to the same model).

How could I do this?

I can output the intermediate layer from the model. But then it will be trained using 2 outputs instead one. I want to train the model only using the final output.

1 Answers
Related