Skip to content

Commit

Permalink
Update vae_keras.py
Browse files Browse the repository at this point in the history
  • Loading branch information
bojone authored Jun 10, 2019
1 parent 5986f27 commit ccec3d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion vae_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def sampling(args):
vae = Model(x, x_decoded_mean)

# xent_loss是重构loss,kl_loss是KL loss
xent_loss = original_dim * K.binary_crossentropy(x, x_decoded_mean)
xent_loss = K.sum(K.binary_crossentropy(x, x_decoded_mean), axis=-1)
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)

Expand Down

0 comments on commit ccec3d5

Please sign in to comment.