Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ecf77a1f
提交
ecf77a1f
authored
2月 03, 2022
作者:
Brandon T. Willard
提交者:
Brandon T. Willard
5月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add inner/outer-input/output counts to ScanInfo
上级
76585fe1
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
54 行增加
和
23 行删除
+54
-23
op.py
aesara/scan/op.py
+50
-21
test_basic.py
tests/scan/test_basic.py
+4
-2
没有找到文件。
aesara/scan/op.py
浏览文件 @
ecf77a1f
...
...
@@ -221,6 +221,54 @@ class ScanInfo:
def
tap_array
(
self
):
return
self
.
mit_mot_in_slices
+
self
.
mit_sot_in_slices
+
self
.
sit_sot_in_slices
@property
def
n_inner_inputs
(
self
):
n_mit_mot_taps
=
sum
(
len
(
x
)
for
x
in
self
.
mit_mot_in_slices
)
n_mit_sot_taps
=
sum
(
len
(
x
)
for
x
in
self
.
mit_sot_in_slices
)
return
(
self
.
n_seqs
+
n_mit_mot_taps
+
n_mit_sot_taps
+
self
.
n_sit_sot
+
self
.
n_shared_outs
+
self
.
n_non_seqs
)
@property
def
n_inner_outputs
(
self
):
n_mit_mot_out_taps
=
sum
(
len
(
x
)
for
x
in
self
.
mit_mot_out_slices
)
return
(
n_mit_mot_out_taps
+
self
.
n_mit_sot
+
self
.
n_sit_sot
+
self
.
n_nit_sot
+
self
.
n_shared_outs
+
int
(
self
.
as_while
)
)
@property
def
n_outer_inputs
(
self
):
return
(
1
+
self
.
n_seqs
+
self
.
n_mit_mot
+
self
.
n_mit_sot
+
self
.
n_sit_sot
+
self
.
n_nit_sot
+
self
.
n_shared_outs
+
self
.
n_non_seqs
)
@property
def
n_outer_outputs
(
self
):
return
(
self
.
n_mit_mot
+
self
.
n_mit_sot
+
self
.
n_sit_sot
+
self
.
n_nit_sot
+
self
.
n_shared_outs
)
TensorConstructorType
=
Callable
[[
List
[
bool
],
Union
[
str
,
np
.
generic
]],
TensorType
]
...
...
@@ -794,27 +842,8 @@ class Scan(Op, ScanMethodsMixin, HasInnerGraph):
self
.
mitmots_preallocated
,
)
=
self
.
_mitmot_preallocations
()
# The total number of inputs across all multi-input taps
# `tap_array = mit_sot_tap_inputs + (-1,) * n_sit_sot`
# n_mit_mot_sot_inputs = sum(len(x) for x in info.tap_array[: (info.n_mit_mot + info.n_mit_sot)])
n_mit_mot_sot_inputs
=
info
.
n_mit_mot
+
info
.
n_mit_sot
# [n_steps] + sequences + mit-mots + mit-sots + sit-sots + shared-variables + nit-sots + non-sequences
self
.
n_outer_inputs
=
(
1
+
info
.
n_seqs
+
n_mit_mot_sot_inputs
+
info
.
n_sit_sot
+
info
.
n_nit_sot
+
info
.
n_shared_outs
+
info
.
n_non_seqs
)
self
.
n_outer_outputs
=
(
info
.
n_mit_mot
+
info
.
n_mit_sot
+
info
.
n_sit_sot
+
info
.
n_nit_sot
+
info
.
n_shared_outs
)
self
.
n_outer_inputs
=
info
.
n_outer_inputs
self
.
n_outer_outputs
=
info
.
n_outer_outputs
def
_mitmot_preallocations
(
self
):
if
config
.
scan__allow_output_prealloc
:
...
...
tests/scan/test_basic.py
浏览文件 @
ecf77a1f
...
...
@@ -4087,5 +4087,7 @@ def test_n_non_seqs(fn, sequences, outputs_info, non_sequences, n_steps, op_chec
_
=
op_check
(
scan_op
)
assert
scan_op
.
n_outer_inputs
==
len
(
res
.
owner
.
inputs
)
assert
scan_op
.
n_outer_outputs
==
len
(
res
.
owner
.
outputs
)
assert
scan_op
.
info
.
n_outer_inputs
==
len
(
res
.
owner
.
inputs
)
assert
scan_op
.
info
.
n_outer_outputs
==
len
(
res
.
owner
.
outputs
)
assert
scan_op
.
info
.
n_inner_inputs
==
len
(
res
.
owner
.
op
.
inputs
)
assert
scan_op
.
info
.
n_inner_outputs
==
len
(
res
.
owner
.
op
.
outputs
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论