Skip to content
Merged
Show file tree
Hide file tree
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
20 changes: 0 additions & 20 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,11 @@ def pytest_collection_modifyitems(config, items):
line.strip() for line in openvino_skipped_tests if line.strip()
]

tpu_skipped_tests = []
if backend() == "jax":
import jax

has_multiple_devices = jax.device_count() > 1

if jax.default_backend() == "tpu":
with open(
"keras/src/backend/jax/excluded_tpu_tests.txt", "r"
) as file:
tpu_skipped_tests = file.readlines()
# it is necessary to check if stripped line is not empty
# and exclude such lines
tpu_skipped_tests = [
line.strip() for line in tpu_skipped_tests if line.strip()
]

requires_trainable_backend = pytest.mark.skipif(
backend() in ["numpy", "openvino"],
reason="Trainer not implemented for NumPy and OpenVINO backend.",
Expand Down Expand Up @@ -96,14 +84,6 @@ def pytest_collection_modifyitems(config, items):
"Not supported operation by openvino backend",
)
)
# also, skip concrete tests for TPU when using JAX backend
for skipped_test in tpu_skipped_tests:
if skipped_test in item.nodeid:
item.add_marker(
pytest.mark.skip(
reason="Known TPU test failure",
)
)


def skip_if_backend(given_backend, reason):
Expand Down
79 changes: 0 additions & 79 deletions keras/src/backend/jax/excluded_tpu_tests.txt

This file was deleted.

14 changes: 12 additions & 2 deletions keras/src/export/onnx_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,12 @@ def test_standard_model_export(self, model_type):
ort_inputs = {
k.name: v for k, v in zip(ort_session.get_inputs(), [ref_input])
}
self.assertAllClose(ort_session.run(None, ort_inputs)[0], ref_output)
self.assertAllClose(
ort_session.run(None, ort_inputs)[0],
ref_output,
tpu_atol=1e-3,
tpu_rtol=1e-2,
)
# Test with a different batch size
ort_inputs = {
k.name: v
Expand Down Expand Up @@ -291,7 +296,12 @@ def test_export_with_input_names(self):
ort_inputs = {
k.name: v for k, v in zip(ort_session.get_inputs(), [ref_input])
}
self.assertAllClose(ort_session.run(None, ort_inputs)[0], ref_output)
self.assertAllClose(
ort_session.run(None, ort_inputs)[0],
ref_output,
tpu_atol=1e-3,
tpu_rtol=1e-2,
)

@parameterized.named_parameters(
named_product(
Expand Down
Loading