Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
88c6d32a
提交
88c6d32a
authored
3月 15, 2017
作者:
Frédéric Bastien
提交者:
GitHub
3月 15, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #5533 from nouiz/scan
Scan compile/grad speed up
上级
caf483fe
a17c6ee0
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
24 行删除
+19
-24
scan_op.py
theano/scan_module/scan_op.py
+13
-15
test_scan.py
theano/scan_module/tests/test_scan.py
+4
-7
test_printing.py
theano/tests/test_printing.py
+2
-2
没有找到文件。
theano/scan_module/scan_op.py
浏览文件 @
88c6d32a
...
...
@@ -207,10 +207,10 @@ class Scan(PureOp):
if
self
.
info
[
'gpu'
]
or
self
.
info
[
'gpua'
]:
self
.
_hash_inner_graph
=
self
.
info
[
'gpu_hash'
]
else
:
tmp_in
,
tmp_out
=
scan_utils
.
reconstruct_graph
(
self
.
inputs
,
self
.
outputs
)
# This is actually required for the line just after.
gof
.
FunctionGraph
(
tmp_in
,
tmp_out
,
clone
=
False
)
# Do the missing inputs check here to have the error early.
for
var
in
theano
.
gof
.
graph
.
inputs
(
self
.
outputs
,
self
.
inputs
):
if
var
not
in
self
.
inputs
and
not
isinstance
(
var
,
theano
.
Constant
):
raise
theano
.
gof
.
MissingInputError
(
"ScanOp is missing an input."
)
self
.
_cmodule_key
=
gof
.
CLinker
()
.
cmodule_key_variables
(
self
.
inputs
,
self
.
outputs
,
[])
...
...
@@ -1987,10 +1987,8 @@ class Scan(PureOp):
if
self
.
truncate_gradient
!=
-
1
:
grad_steps
=
tensor
.
minimum
(
grad_steps
,
self
.
truncate_gradient
)
rval
=
scan_utils
.
reconstruct_graph
(
self
.
inputs
,
self
.
outputs
)
self_inputs
=
rval
[
0
]
self_outputs
=
rval
[
1
]
self_inputs
=
self
.
inputs
self_outputs
=
self
.
outputs
# differentiable inputs
diff_inputs
=
(
self
.
inner_seqs
(
self_inputs
)
+
self
.
inner_mitmot
(
self_inputs
)
+
...
...
@@ -2649,13 +2647,13 @@ class Scan(PureOp):
return
gradients
def
R_op
(
self
,
inputs
,
eval_points
):
# Step 0.
Don't work on the orignal tensor variables
rval
=
scan_utils
.
reconstruct_graph
(
self
.
inputs
,
self
.
outputs
,
'_rop'
)
self_inputs
=
rval
[
0
]
rop_of_inputs
=
rval
[
0
][:
self
.
n_seqs
+
self
.
n_outs
]
+
\
rval
[
0
][
self
.
n_seqs
+
self
.
n_outs
+
self
.
n_shared_outs
:]
self_outputs
=
rval
[
1
]
# Step 0.
Prepare some shortcut variable
self_inputs
=
self
.
inputs
rop_of_inputs
=
(
self_inputs
[:
self
.
n_seqs
+
self
.
n_outs
]
+
self_inputs
[
self
.
n_seqs
+
self
.
n_outs
+
self
.
n_shared_outs
:])
self_outputs
=
self
.
outputs
# Step 1. Compute the R_op of the inner function
inner_eval_points
=
[
scan_utils
.
safe_new
(
x
,
'_evalpoint'
)
for
x
in
rop_of_inputs
]
...
...
theano/scan_module/tests/test_scan.py
浏览文件 @
88c6d32a
...
...
@@ -4483,13 +4483,10 @@ class T_Scan(unittest.TestCase):
return
tensor
.
dot
(
x
,
w_
)
ret_strict
=
theano
.
scan
(
_scan_loose
,
sequences
=
[],
outputs_info
=
[
x0_
],
n_steps
=
n
,
strict
=
True
)
f_strict
=
theano
.
function
([
x0_
],
ret_strict
[
0
][
-
1
])
result_strict
=
f_strict
(
x0
)
sequences
=
[],
outputs_info
=
[
x0_
],
n_steps
=
n
,
strict
=
True
)
def
test_monitor_mode
(
self
):
# Test that it is possible to pass an instance of MonitorMode
...
...
theano/tests/test_printing.py
浏览文件 @
88c6d32a
...
...
@@ -693,8 +693,8 @@ def test_scan_debugprint5():
for{cpu,scan_fn} [id F] ''
>Elemwise{mul,no_inplace} [id CR] ''
> |<TensorType(float64, vector)> [id C
S
] -> [id H]
> |A_copy [id C
T
] -> [id P]
> |<TensorType(float64, vector)> [id C
P
] -> [id H]
> |A_copy [id C
L
] -> [id P]
for{cpu,scan_fn} [id F] ''
>Elemwise{mul,no_inplace} [id CR] ''
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论