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

Bump jaxlib/jax and flax max versions #518

Merged
merged 5 commits into from
May 14, 2024
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
8 changes: 6 additions & 2 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
have_ray = True
ray.init(num_cpus=1) # call required to be here: see ray-project/ray#44087

import jax.numpy as jnp

import scico.numpy as snp


Expand All @@ -24,7 +26,8 @@ def pytest_sessionstart(session):

def pytest_sessionfinish(session, exitstatus):
"""Clean up after end of test session."""
ray.shutdown()
if have_ray:
ray.shutdown()


@pytest.fixture(autouse=True)
Expand All @@ -33,7 +36,8 @@ def add_modules(doctest_namespace):

Necessary because `np` is used in doc strings for jax functions
(e.g. `linear_transpose`) that get pulled into `scico/__init__.py`.
Also allow `snp` to be used without explicitly importing.
Also allow `snp` and `jnp` to be used without explicitly importing.
"""
doctest_namespace["np"] = np
doctest_namespace["snp"] = snp
doctest_namespace["jnp"] = jnp
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ scipy>=1.6.0
imageio>=2.17
tifffile
matplotlib
jaxlib>=0.4.3,<=0.4.26
jax>=0.4.3,<=0.4.26
jaxlib>=0.4.3,<=0.4.28
jax>=0.4.3,<=0.4.28
orbax-checkpoint<=0.5.7
flax>=0.8.0,<=0.8.2
flax>=0.8.0,<=0.8.3
pyabel>=0.9.0
14 changes: 8 additions & 6 deletions scico/linop/xray/astra.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,10 +362,12 @@ def angle_to_vector(det_spacing: Tuple[float, float], angles: np.ndarray) -> np.

def _ensure_writeable(x):
"""Ensure that `x.flags.writeable` is ``True``, copying if needed."""

if not x.flags.writeable:
try:
x.setflags(write=True)
except ValueError:
x = x.copy()
if hasattr(x, "flags"): # x is a numpy array
if not x.flags.writeable:
try:
x.setflags(write=True)
except ValueError:
x = x.copy()
else: # x is a jax array (which is immutable)
x = np.array(x)
return x
Loading