Jose Ramon
Jose Ramon

Reputation: 5444

Calculate the loss of discriminator in keras

I want to calculate the loss error of the discriminator in keras, however, without updating the weights of the network. So far, I am using the following function (train_on_batch) to update the weights of the network using the gradient descent:

d_loss = d.train_on_batch(X, y)

However, what I want to do is firstly to calculate the d_loss and then to update the weights according to the d_loss value. How can i do so in Keras?

Upvotes: 0

Views: 153

Answers (1)

KonstantinosKokos
KonstantinosKokos

Reputation: 3473

d.evaluate(x, y)

will return all losses and metrics defined in your model. Refer to the documentation.

d.test_on_batch(x, y)

might also be of interest.

Upvotes: 2

Related Questions