Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
69575d26
提交
69575d26
authored
1月 03, 2026
作者:
ricardoV94
提交者:
Ricardo Vieira
1月 03, 2026
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove numpy<2.0 compatibility macros
上级
a0ee9a44
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
1 行增加
和
36 行删除
+1
-36
basic.py
pytensor/scalar/basic.py
+1
-36
没有找到文件。
pytensor/scalar/basic.py
浏览文件 @
69575d26
...
...
@@ -521,43 +521,10 @@ class ScalarType(CType, HasDataType, HasShape):
# In that case we add the 'int' type to the real types.
real_types
.
append
(
"int"
)
# Macros for backwards compatibility with numpy < 2.0
#
# In numpy 2.0+, these are defined in npy_math.h, but
# for early versions, they must be vendored by users (e.g. PyTensor)
backwards_compat_macros
=
"""
#ifndef NUMPY_CORE_INCLUDE_NUMPY_NPY_2_COMPLEXCOMPAT_H_
#define NUMPY_CORE_INCLUDE_NUMPY_NPY_2_COMPLEXCOMPAT_H_
#include <numpy/npy_math.h>
#ifndef NPY_CSETREALF
#define NPY_CSETREALF(c, r) (c)->real = (r)
#endif
#ifndef NPY_CSETIMAGF
#define NPY_CSETIMAGF(c, i) (c)->imag = (i)
#endif
#ifndef NPY_CSETREAL
#define NPY_CSETREAL(c, r) (c)->real = (r)
#endif
#ifndef NPY_CSETIMAG
#define NPY_CSETIMAG(c, i) (c)->imag = (i)
#endif
#ifndef NPY_CSETREALL
#define NPY_CSETREALL(c, r) (c)->real = (r)
#endif
#ifndef NPY_CSETIMAGL
#define NPY_CSETIMAGL(c, i) (c)->imag = (i)
#endif
#endif
"""
def
_make_get_set_real_imag
(
scalar_type
:
str
)
->
str
:
"""Make overloaded getter/setter functions for real/imag parts of numpy complex types.
The functions called by these getter/setter functions are defining in npy_math.h, or
in the `backward_compat_macros` defined above.
The functions called by these getter/setter functions are defining in npy_math.h
Args:
scalar_type: float, double, or longdouble
...
...
@@ -602,8 +569,6 @@ class ScalarType(CType, HasDataType, HasShape):
for
stype
in
[
"float"
,
"double"
,
"longdouble"
]
)
get_set_aliases
=
backwards_compat_macros
+
"
\n
"
+
get_set_aliases
# Template for defining pytensor_complex64 and pytensor_complex128 structs/classes
#
# The npy_complex64, npy_complex128 types are aliases defined at run time based on
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论