Skip to content

Commit

Permalink
Avoid relying on jax.lib.xla_bridge._backends, as this is private and…
Browse files Browse the repository at this point in the history
… will soon be deleted

There is no public API for this, but this change switches to a private API that is not yet planned for removal. We'd encourage the code authors to not rely on private APIs if at all possible.

PiperOrigin-RevId: 697777022
  • Loading branch information
Jake VanderPlas authored and ChexDev committed Nov 19, 2024
1 parent 1dc7862 commit 678a0ae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion chex/_src/fake.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def set_n_cpu_devices(n: Optional[int] = None) -> None:
n = n or FLAGS['chex_n_cpu_devices'].value

n_devices = get_n_cpu_devices_from_xla_flags()
cpu_backend = (jax.lib.xla_bridge._backends or {}).get('cpu', None) # pylint: disable=protected-access
cpu_backend = (jax._src.xla_bridge._backends or {}).get('cpu', None) # pylint: disable=protected-access
if cpu_backend is not None and n_devices != n:
raise RuntimeError(
f'Attempted to set {n} devices, but {n_devices} CPUs already available:'
Expand Down

0 comments on commit 678a0ae

Please sign in to comment.