Open hellomurphy opened 3 years ago
I got exactly the same error. Any help is appreciated.
I met the same error. After referring to https://github.com/bojone/vae/blob/master/vae_keras_cnn.py It seems that I solved the problem by replacing
def vae_loss(x, x_decoded_mean):
xent_loss = original_dim * binary_crossentropy(x, x_decoded_mean)
kl_loss = - 0.5 * K.sum(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis=-1)
return K.mean(xent_loss + kl_loss)
vae = Model(x, x_decoded_mean)
vae.compile(optimizer='rmsprop', loss = vae_loss)
vae.summary()
with
vae = Model(x, x_decoded_mean)
xent_loss = original_dim * binary_crossentropy(x, x_decoded_mean)
kl_loss = - 0.5 * K.sum(1 + z_log_var - K.square(z_mean) - K.exp(z_log_var), axis=-1)
vae_loss = K.mean(xent_loss + kl_loss)
vae.add_loss(vae_loss)
vae.compile(optimizer='rmsprop')
vae.summary()
I have tried running this line of code in the Variational Autoencoders markdown.
But found an error showing the result as follows