Skip to content

Commit

Permalink
fix CG parameter name compatibility
Browse files Browse the repository at this point in the history
* need check based on CuPy, not SciPy
  • Loading branch information
grlee77 committed Apr 21, 2024
1 parent 70b7dbc commit 00029eb
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions python/cucim/src/cucim/skimage/_shared/compat.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Compatibility helpers for dependencies."""

import numpy as np
import scipy as sp
from packaging.version import parse

__all__ = [
Expand All @@ -21,8 +20,11 @@
NP_COPY_IF_NEEDED = False if NUMPY_LT_2_0_0 else None


SCIPY_LT_1_12 = parse(sp.__version__) < parse("1.12")
# check CuPy instead of SciPy
# as of CuPy 13.0, tol is still being used instead of rtol as in latest SciPy
# CUPY_LT_14 = parse(cp.__version__) < parse("14.0")

# Starting in SciPy v1.12, 'scipy.sparse.linalg.cg' keyword argument `tol` is
# deprecated in favor of `rtol`.
SCIPY_CG_TOL_PARAM_NAME = "tol" if SCIPY_LT_1_12 else "rtol"
# As of CuPy 13.0, it is still always using 'tol''
SCIPY_CG_TOL_PARAM_NAME = "tol" # if CUPY_LT_14 else "rtol"

0 comments on commit 00029eb

Please sign in to comment.