Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e25e8a2a
提交
e25e8a2a
authored
2月 18, 2025
作者:
Ricardo Vieira
提交者:
Ricardo Vieira
2月 18, 2025
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix unauthorized inplace update of vector B in numba solve_triangular
上级
cc8c4992
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
11 行增加
和
7 行删除
+11
-7
slinalg.py
pytensor/link/numba/dispatch/slinalg.py
+8
-4
test_slinalg.py
tests/link/numba/test_slinalg.py
+3
-3
没有找到文件。
pytensor/link/numba/dispatch/slinalg.py
浏览文件 @
e25e8a2a
...
@@ -126,13 +126,17 @@ def solve_triangular_impl(A, B, trans, lower, unit_diagonal, b_ndim, overwrite_b
...
@@ -126,13 +126,17 @@ def solve_triangular_impl(A, B, trans, lower, unit_diagonal, b_ndim, overwrite_b
B_is_1d
=
B
.
ndim
==
1
B_is_1d
=
B
.
ndim
==
1
if
not
overwrite_b
:
if
overwrite_b
:
B_copy
=
_copy_to_fortran_order
(
B
)
else
:
B_copy
=
B
B_copy
=
B
else
:
if
B_is_1d
:
# _copy_to_fortran_order does nothing with vectors
B_copy
=
np
.
copy
(
B
)
else
:
B_copy
=
_copy_to_fortran_order
(
B
)
if
B_is_1d
:
if
B_is_1d
:
B_copy
=
np
.
expand_dims
(
B
,
-
1
)
B_copy
=
np
.
expand_dims
(
B
_copy
,
-
1
)
NRHS
=
1
if
B_is_1d
else
int
(
B_copy
.
shape
[
-
1
])
NRHS
=
1
if
B_is_1d
else
int
(
B_copy
.
shape
[
-
1
])
...
...
tests/link/numba/test_slinalg.py
浏览文件 @
e25e8a2a
...
@@ -79,9 +79,9 @@ def test_solve_triangular(b_shape: tuple[int], lower, trans, unit_diag, is_compl
...
@@ -79,9 +79,9 @@ def test_solve_triangular(b_shape: tuple[int], lower, trans, unit_diag, is_compl
A_val
=
A_val
+
np
.
random
.
normal
(
size
=
(
5
,
5
))
*
1
j
A_val
=
A_val
+
np
.
random
.
normal
(
size
=
(
5
,
5
))
*
1
j
b_val
=
b_val
+
np
.
random
.
normal
(
size
=
b_shape
)
*
1
j
b_val
=
b_val
+
np
.
random
.
normal
(
size
=
b_shape
)
*
1
j
X_np
=
f
(
A_func
(
A_val
.
copy
()),
b_val
.
copy
()
)
X_np
=
f
(
A_func
(
A_val
),
b_val
)
test_input
=
transpose_func
(
A_func
(
A_val
.
copy
()
),
trans
)
test_input
=
transpose_func
(
A_func
(
A_val
),
trans
)
ATOL
=
1e-8
if
floatX
.
endswith
(
"64"
)
else
1e-4
ATOL
=
1e-8
if
floatX
.
endswith
(
"64"
)
else
1e-4
RTOL
=
1e-8
if
floatX
.
endswith
(
"64"
)
else
1e-4
RTOL
=
1e-8
if
floatX
.
endswith
(
"64"
)
else
1e-4
...
@@ -92,7 +92,7 @@ def test_solve_triangular(b_shape: tuple[int], lower, trans, unit_diag, is_compl
...
@@ -92,7 +92,7 @@ def test_solve_triangular(b_shape: tuple[int], lower, trans, unit_diag, is_compl
compare_numba_and_py
(
compare_numba_and_py
(
compiled_fgraph
.
inputs
,
compiled_fgraph
.
inputs
,
compiled_fgraph
.
outputs
,
compiled_fgraph
.
outputs
,
[
A_func
(
A_val
.
copy
()),
b_val
.
copy
()
],
[
A_func
(
A_val
),
b_val
],
)
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论