Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions keras/src/utils/jax_layer_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,13 @@ def verify_identical_model(model):
model2.export(path, format="tf_saved_model")
model4 = tf.saved_model.load(path)
output4 = model4.serve(x_test)
# The output difference is greater when using the GPU or bfloat16
lower_precision = testing.jax_uses_gpu() or "dtype" in layer_init_kwargs
self.assertAllClose(
output1,
output4,
# The output difference might be significant when using the GPU
atol=1e-2 if testing.jax_uses_gpu() else 1e-6,
atol=1e-2 if lower_precision else 1e-6,
rtol=1e-3 if lower_precision else 1e-6,
)

# test subclass model building without a build method
Expand Down
Loading