Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6e438fe1
提交
6e438fe1
authored
10月 07, 2013
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove the optional reason argument to on_change_input.
This was slowing down python.
上级
f3c99f51
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
9 行增加
和
16 行删除
+9
-16
destroyhandler.py
theano/gof/destroyhandler.py
+2
-2
fg.py
theano/gof/fg.py
+2
-9
opt.py
theano/gof/opt.py
+3
-3
ops.py
theano/sandbox/linalg/ops.py
+1
-1
opt.py
theano/tensor/opt.py
+1
-1
没有找到文件。
theano/gof/destroyhandler.py
浏览文件 @
6e438fe1
...
...
@@ -442,7 +442,7 @@ if 0:
self
.
stale_droot
=
True
def
on_change_input
(
self
,
fgraph
,
app
,
i
,
old_r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
app
,
i
,
old_r
,
new_r
,
reason
):
"""app.inputs[i] changed from old_r to new_r """
if
app
==
'output'
:
# app == 'output' is special key that means FunctionGraph is redefining which nodes are being
...
...
@@ -827,7 +827,7 @@ class DestroyHandler(toolbox.Bookkeeper):
self
.
stale_droot
=
True
def
on_change_input
(
self
,
fgraph
,
app
,
i
,
old_r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
app
,
i
,
old_r
,
new_r
,
reason
):
"""app.inputs[i] changed from old_r to new_r """
if
app
==
'output'
:
# app == 'output' is special key that means FunctionGraph is redefining which nodes are being
...
...
theano/gof/fg.py
浏览文件 @
6e438fe1
...
...
@@ -376,7 +376,7 @@ class FunctionGraph(utils.object2):
current value of node.inputs[i] which we want to replace.
For each feature that has a 'on_change_input' method, calls:
feature.on_change_input(function_graph, node, i, old_r, new_r,
[reason]
)
feature.on_change_input(function_graph, node, i, old_r, new_r,
reason
)
"""
# TODO: ERROR HANDLING FOR LISTENERS (should it complete the change or revert it?)
if
node
==
'output'
:
...
...
@@ -512,14 +512,7 @@ class FunctionGraph(utils.object2):
# not existing
continue
#####HORRIBLE OPTIONAL ARGUMENT HACK
try
:
fn
(
self
,
*
args
,
**
kwargs
)
except
TypeError
,
e
:
if
str
(
e
)
==
"on_change_input() got an unexpected keyword argument 'reason'"
and
len
(
kwargs
)
==
1
:
fn
(
self
,
*
args
)
else
:
raise
fn
(
self
,
*
args
,
**
kwargs
)
def
collect_callbacks
(
self
,
name
,
*
args
):
"""WRITEME
...
...
theano/gof/opt.py
浏览文件 @
6e438fe1
...
...
@@ -423,7 +423,7 @@ class MergeFeature(object):
for
node
in
fgraph
.
toposort
():
self
.
on_import
(
fgraph
,
node
,
"on_attach"
)
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
,
reason
):
# If inputs to node change, it is not guaranteed that it is distinct
# from the other nodes in nodes_seen
if
node
in
self
.
nodes_seen
:
...
...
@@ -1171,7 +1171,7 @@ class NavigatorOptimizer(Optimizer):
def
on_prune
(
self
,
fgraph
,
node
,
reason
):
pruner
(
node
)
if
chin
is
not
None
:
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
,
reason
):
chin
(
node
,
i
,
r
,
new_r
)
u
=
Updater
()
...
...
@@ -1360,7 +1360,7 @@ class ChangeTracker:
def
on_import
(
self
,
fgraph
,
node
,
reason
):
self
.
changed
=
True
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
,
reason
):
self
.
changed
=
True
def
reset
(
self
):
...
...
theano/sandbox/linalg/ops.py
浏览文件 @
6e438fe1
...
...
@@ -159,7 +159,7 @@ class HintsFeature(object):
if
k
not
in
new_hints
:
new_hints
[
k
]
=
v
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
,
reason
):
# TODO:
# This tells us that r and new_r must have the same shape
# if we didn't know that the shapes are related, now we do.
...
...
theano/tensor/opt.py
浏览文件 @
6e438fe1
...
...
@@ -1075,7 +1075,7 @@ class ShapeFeature(object):
for
r
,
s
in
izip
(
node
.
outputs
,
o_shapes
):
self
.
set_shape
(
r
,
s
)
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
):
def
on_change_input
(
self
,
fgraph
,
node
,
i
,
r
,
new_r
,
reason
):
if
new_r
not
in
self
.
shape_of
:
# It happen that the fgraph didn't called on_import for some
# new_r. This happen when new_r don't have an
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论