提交 f15a953c authored 作者: Virgile Andreani's avatar Virgile Andreani 提交者: Ricardo Vieira

Remove npy<2 compatibility for ndarray_c_version

上级 a1d07eb8
......@@ -29,8 +29,7 @@ from pytensor.link.c.cmodule import (
from pytensor.link.c.cmodule import get_module_cache as _get_module_cache
from pytensor.link.c.interface import CLinkerObject, CLinkerOp, CLinkerType
from pytensor.link.utils import gc_helper, map_storage, raise_with_op, streamline
from pytensor.npy_2_compat import ndarray_c_version
from pytensor.utils import difference, uniq
from pytensor.utils import NDARRAY_C_VERSION, difference, uniq
NoParams = object()
......@@ -1367,7 +1366,7 @@ class CLinker(Linker):
# We must always add the numpy ABI version here as
# DynamicModule always add the include <numpy/arrayobject.h>
sig.append(f"NPY_ABI_VERSION=0x{ndarray_c_version:X}")
sig.append(f"NPY_ABI_VERSION=0x{NDARRAY_C_VERSION:X}")
if c_compiler:
sig.append("c_compiler_str=" + c_compiler.version_str())
......
......@@ -10,10 +10,6 @@ numpy_version = np.lib.NumpyVersion(
using_numpy_2 = numpy_version >= "2.0.0rc1"
if using_numpy_2:
ndarray_c_version = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined]
else:
ndarray_c_version = np.core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined]
# function that replicates np.unique from numpy < 2.0
......
......@@ -22,6 +22,7 @@ __all__ = [
"LOCAL_BITWIDTH",
"PYTHON_INT_BITWIDTH",
"NPY_RAVEL_AXIS",
"NDARRAY_C_VERSION",
"NoDuplicateOptWarningFilter",
]
......@@ -54,6 +55,8 @@ NPY_RAVEL_AXIS = np.iinfo(np.int32).min
The value of the numpy C API NPY_RAVEL_AXIS.
"""
NDARRAY_C_VERSION = np._core._multiarray_umath._get_ndarray_c_version() # type: ignore[attr-defined]
def __call_excepthooks(type, value, trace):
"""
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论