Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9023e2b3
提交
9023e2b3
authored
3月 19, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
3月 19, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix an issue with non-homogeneous shape tuples in Numba's BroadcastTo
上级
081967d3
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
9 行增加
和
2 行删除
+9
-2
extra_ops.py
aesara/link/numba/dispatch/extra_ops.py
+5
-2
test_numba.py
tests/link/test_numba.py
+4
-0
没有找到文件。
aesara/link/numba/dispatch/extra_ops.py
浏览文件 @
9023e2b3
...
...
@@ -2,6 +2,7 @@ import warnings
import
numba
import
numpy
as
np
from
numba.misc.special
import
literal_unroll
from
numpy.core.multiarray
import
normalize_axis_index
from
aesara
import
config
...
...
@@ -367,10 +368,12 @@ def numba_funcify_BroadcastTo(op, node, **kwargs):
def
broadcast_to
(
x
,
*
shape
):
scalars_shape
=
create_zeros_tuple
()
for
i
in
range
(
len
(
shape
)):
i
=
0
for
s_i
in
literal_unroll
(
shape
):
scalars_shape
=
numba_basic
.
tuple_setitem
(
scalars_shape
,
i
,
numba_basic
.
to_scalar
(
s
hape
[
i
]
)
scalars_shape
,
i
,
numba_basic
.
to_scalar
(
s
_i
)
)
i
+=
1
return
np
.
broadcast_to
(
x
,
scalars_shape
)
...
...
tests/link/test_numba.py
浏览文件 @
9023e2b3
...
...
@@ -1924,6 +1924,10 @@ def test_Searchsorted(a, v, side, sorter, exc):
set_test_value
(
at
.
vector
(),
rng
.
random
(
size
=
(
2
,))
.
astype
(
config
.
floatX
)),
at
.
as_tensor
([
set_test_value
(
at
.
lscalar
(),
np
.
array
(
v
))
for
v
in
[
3
,
2
]]),
),
(
set_test_value
(
at
.
vector
(),
rng
.
random
(
size
=
(
2
,))
.
astype
(
config
.
floatX
)),
[
at
.
as_tensor
(
3
,
dtype
=
np
.
int8
),
at
.
as_tensor
(
2
,
dtype
=
np
.
int64
)],
),
],
)
def
test_BroadcastTo
(
x
,
shape
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论