-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated Variational AutoEncoder example for Keras 3 #1836
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR!
examples/generative/vae.py
Outdated
return z_mean + tf.exp(0.5 * z_log_var) * epsilon | ||
batch = ops.shape(z_mean)[0] | ||
dim = ops.shape(z_mean)[1] | ||
epsilon = keras.random.normal(shape=(batch, dim)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be seeded via seed=self.seed_generator
(to be created in the constructor, self.seed_generator = keras.random.SeedGenerator()
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I apologize! I overlooked the RNG layers' statelessness. Updated in the most recent commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you -- please add the generated files.
Absolutely! The generated files have been added. |
* vae keras 3 example updated * seed generator added to rng layer * generated files are added
This PR updates the Variational AutoEncoder Keras 3.0 example [TF Only Backend]. All TF ops are replaced with corresponding Keras ops.
For example, here is the notebook link provided:
https://colab.research.google.com/drive/15VMQIEUK8jhqI8nYyFSfWDh9fsMMs116?usp=sharing
cc: @fchollet
The following describes the Git difference for the changed files:
Changes: