Skip to content
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

TF+XLA+Mixed Precision: Keras fails to compute gradients #20931

Open
itmo153277 opened this issue Feb 20, 2025 · 0 comments
Open

TF+XLA+Mixed Precision: Keras fails to compute gradients #20931

itmo153277 opened this issue Feb 20, 2025 · 0 comments
Assignees
Labels

Comments

@itmo153277
Copy link
Contributor

Keras fails to compute gradients for autoencoder-esce model using Tensorflow backend with mixed precision and jit compilation enabled.
See code here: colab.

This is caused by UpSampling2D layer. When gradients are computed, the type is resolved as float32 instead of float16, and this causes Relu that comes next to throw a dtype mismatch exception.

The only working workaround I found is explicitly setting dtype to float32 for UpSampling2D layer. This inserts a cast node inbetween relu and upsample which helps dealing with dtype conversion.

Not sure which project this issue should be submitted to: Keras, TF or XLA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants