Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9532c287
提交
9532c287
authored
10月 03, 2014
作者:
Frederic
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
pep8
上级
aa055460
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
5 行删除
+11
-5
function_module.py
theano/compile/function_module.py
+11
-5
没有找到文件。
theano/compile/function_module.py
浏览文件 @
9532c287
...
@@ -16,7 +16,8 @@ import theano
...
@@ -16,7 +16,8 @@ import theano
from
theano
import
gof
from
theano
import
gof
from
theano.gof.python25
import
partial
from
theano.gof.python25
import
partial
import
theano.compile.mode
import
theano.compile.mode
from
theano.compile.io
import
In
,
SymbolicInput
,
SymbolicInputKit
,
SymbolicOutput
from
theano.compile.io
import
(
In
,
SymbolicInput
,
SymbolicInputKit
,
SymbolicOutput
)
from
theano.compile.ops
import
deep_copy_op
,
view_op
from
theano.compile.ops
import
deep_copy_op
,
view_op
import
logging
import
logging
...
@@ -29,9 +30,11 @@ class UnusedInputError(Exception):
...
@@ -29,9 +30,11 @@ class UnusedInputError(Exception):
"""
"""
pass
pass
def
alias_root
(
v
):
def
alias_root
(
v
):
"""Return the variable to which v is aliased by view_maps and destroy_maps"""
"""Return the variable to which v is aliased by view_maps and destroy_maps"""
if
v
.
owner
is
None
:
return
v
if
v
.
owner
is
None
:
return
v
vmap
=
getattr
(
v
.
owner
.
op
,
'view_map'
,
{})
vmap
=
getattr
(
v
.
owner
.
op
,
'view_map'
,
{})
dmap
=
getattr
(
v
.
owner
.
op
,
'destroy_map'
,
{})
dmap
=
getattr
(
v
.
owner
.
op
,
'destroy_map'
,
{})
outpos
=
v
.
owner
.
outputs
.
index
(
v
)
outpos
=
v
.
owner
.
outputs
.
index
(
v
)
...
@@ -106,10 +109,11 @@ class Supervisor:
...
@@ -106,10 +109,11 @@ class Supervisor:
return
True
return
True
for
r
in
self
.
protected
+
list
(
fgraph
.
outputs
):
for
r
in
self
.
protected
+
list
(
fgraph
.
outputs
):
if
fgraph
.
destroyers
(
r
):
if
fgraph
.
destroyers
(
r
):
raise
gof
.
InconsistencyError
(
"Trying to destroy a protected Variable."
,
r
)
raise
gof
.
InconsistencyError
(
"Trying to destroy a protected Variable."
,
r
)
def
std_fgraph
(
input_specs
,
output_specs
,
accept_inplace
=
False
):
def
std_fgraph
(
input_specs
,
output_specs
,
accept_inplace
=
False
):
"""
"""
Makes an FunctionGraph corresponding to the input specs and the output
Makes an FunctionGraph corresponding to the input specs and the output
specs. Any SymbolicInput in the input_specs, if its update field
specs. Any SymbolicInput in the input_specs, if its update field
...
@@ -134,7 +138,8 @@ def std_fgraph(input_specs, output_specs, accept_inplace = False):
...
@@ -134,7 +138,8 @@ def std_fgraph(input_specs, output_specs, accept_inplace = False):
for
node
in
fgraph
.
apply_nodes
:
for
node
in
fgraph
.
apply_nodes
:
if
getattr
(
node
.
op
,
'destroy_map'
,
None
):
if
getattr
(
node
.
op
,
'destroy_map'
,
None
):
if
not
accept_inplace
:
if
not
accept_inplace
:
raise
TypeError
(
"Graph must not contain inplace operations"
,
node
,
node
.
op
)
raise
TypeError
(
"Graph must not contain inplace operations"
,
node
,
node
.
op
)
else
:
else
:
fgraph
.
attach_feature
(
gof
.
DestroyHandler
())
fgraph
.
attach_feature
(
gof
.
DestroyHandler
())
break
break
...
@@ -155,6 +160,7 @@ def std_fgraph(input_specs, output_specs, accept_inplace = False):
...
@@ -155,6 +160,7 @@ def std_fgraph(input_specs, output_specs, accept_inplace = False):
std_fgraph
.
features
=
[
gof
.
toolbox
.
PreserveNames
]
std_fgraph
.
features
=
[
gof
.
toolbox
.
PreserveNames
]
class
AliasedMemoryError
(
Exception
):
class
AliasedMemoryError
(
Exception
):
"""Memory is aliased that should not be"""
"""Memory is aliased that should not be"""
pass
pass
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论