Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
c15e7aaa
提交
c15e7aaa
authored
6月 29, 2024
作者:
Virgile Andreani
提交者:
Ricardo Vieira
11月 19, 2024
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make non-strict zips strict in tensor/elemwise_cgen
上级
47c09433
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
13 行删除
+11
-13
elemwise_cgen.py
pytensor/tensor/elemwise_cgen.py
+11
-13
没有找到文件。
pytensor/tensor/elemwise_cgen.py
浏览文件 @
c15e7aaa
...
@@ -209,7 +209,13 @@ def make_alloc(loop_orders, dtype, sub, fortran="0"):
...
@@ -209,7 +209,13 @@ def make_alloc(loop_orders, dtype, sub, fortran="0"):
)
)
def
make_loop
(
loop_orders
,
dtypes
,
loop_tasks
,
sub
,
openmp
=
None
):
def
make_loop
(
loop_orders
:
list
[
tuple
[
int
|
str
,
...
]],
dtypes
:
list
,
loop_tasks
:
list
,
sub
:
dict
[
str
,
str
],
openmp
:
bool
=
False
,
):
"""
"""
Make a nested loop over several arrays and associate specific code
Make a nested loop over several arrays and associate specific code
to each level of nesting.
to each level of nesting.
...
@@ -227,7 +233,7 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
...
@@ -227,7 +233,7 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
string is code to be executed before the ith loop starts, the second
string is code to be executed before the ith loop starts, the second
one contains code to be executed just before going to the next element
one contains code to be executed just before going to the next element
of the ith dimension.
of the ith dimension.
The last element
i
f loop_tasks is a single string, containing code
The last element
o
f loop_tasks is a single string, containing code
to be executed at the very end.
to be executed at the very end.
sub : dictionary
sub : dictionary
Maps 'lv#' to a suitable variable name.
Maps 'lv#' to a suitable variable name.
...
@@ -260,7 +266,7 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
...
@@ -260,7 +266,7 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
}}
}}
"""
"""
preloops
=
{}
preloops
:
dict
[
int
,
str
]
=
{}
for
i
,
(
loop_order
,
dtype
)
in
enumerate
(
zip
(
loop_orders
,
dtypes
,
strict
=
True
)):
for
i
,
(
loop_order
,
dtype
)
in
enumerate
(
zip
(
loop_orders
,
dtypes
,
strict
=
True
)):
for
j
,
index
in
enumerate
(
loop_order
):
for
j
,
index
in
enumerate
(
loop_order
):
if
index
!=
"x"
:
if
index
!=
"x"
:
...
@@ -277,16 +283,8 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
...
@@ -277,16 +283,8 @@ def make_loop(loop_orders, dtypes, loop_tasks, sub, openmp=None):
s
=
""
s
=
""
for
i
,
(
pre_task
,
task
),
indices
in
reversed
(
tasks_indices
=
zip
(
loop_tasks
[:
-
1
],
zip
(
*
loop_orders
,
strict
=
True
),
strict
=
True
)
list
(
for
i
,
((
pre_task
,
task
),
indices
)
in
reversed
(
list
(
enumerate
(
tasks_indices
))):
zip
(
range
(
len
(
loop_tasks
)
-
1
),
loop_tasks
,
list
(
zip
(
*
loop_orders
,
strict
=
True
)),
strict
=
False
,
)
)
):
s
=
loop_over
(
preloops
.
get
(
i
,
""
)
+
pre_task
,
s
+
task
,
indices
,
i
)
s
=
loop_over
(
preloops
.
get
(
i
,
""
)
+
pre_task
,
s
+
task
,
indices
,
i
)
s
+=
loop_tasks
[
-
1
]
s
+=
loop_tasks
[
-
1
]
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论