Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
95b8f998
提交
95b8f998
authored
8月 08, 2017
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the original problem of gh-5736
上级
54c49ef0
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
11 行增加
和
10 行删除
+11
-10
function.py
theano/compile/function.py
+0
-10
function_module.py
theano/compile/function_module.py
+10
-0
test_function_module.py
theano/compile/tests/test_function_module.py
+1
-0
没有找到文件。
theano/compile/function.py
浏览文件 @
95b8f998
...
@@ -289,13 +289,6 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
...
@@ -289,13 +289,6 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
uses_updates
=
bool
(
updates
)
uses_updates
=
bool
(
updates
)
uses_givens
=
bool
(
givens
)
uses_givens
=
bool
(
givens
)
# See if we have any mutable / borrow inputs
check_for_aliased_inputs
=
False
for
i
in
inputs
:
if
(
isinstance
(
i
,
In
)
and
((
hasattr
(
i
,
'borrow'
)
and
i
.
borrow
)
or
(
hasattr
(
i
,
'mutable'
)
and
i
.
mutable
))):
check_for_aliased_inputs
=
True
if
uses_tuple
:
if
uses_tuple
:
# we must use old semantics in this case.
# we must use old semantics in this case.
if
profile
:
if
profile
:
...
@@ -323,7 +316,4 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
...
@@ -323,7 +316,4 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
on_unused_input
=
on_unused_input
,
on_unused_input
=
on_unused_input
,
profile
=
profile
,
profile
=
profile
,
output_keys
=
output_keys
)
output_keys
=
output_keys
)
# We need to add the flag check_aliased inputs if we have any mutable or
# borrowed used defined inputs
fn
.
_check_for_aliased_inputs
=
check_for_aliased_inputs
return
fn
return
fn
theano/compile/function_module.py
浏览文件 @
95b8f998
...
@@ -375,6 +375,15 @@ class Function(object):
...
@@ -375,6 +375,15 @@ class Function(object):
self
.
nodes_with_inner_function
=
[]
self
.
nodes_with_inner_function
=
[]
self
.
output_keys
=
output_keys
self
.
output_keys
=
output_keys
# See if we have any mutable / borrow inputs
# TODO: this only need to be set if there is more then 1 input
self
.
_check_for_aliased_inputs
=
False
for
i
in
maker
.
inputs
:
if
(
isinstance
(
i
,
In
)
and
((
hasattr
(
i
,
'borrow'
)
and
i
.
borrow
)
or
(
hasattr
(
i
,
'mutable'
)
and
i
.
mutable
))):
self
.
_check_for_aliased_inputs
=
True
break
# We will be popping stuff off this `containers` object. It is a copy.
# We will be popping stuff off this `containers` object. It is a copy.
containers
=
list
(
self
.
input_storage
)
containers
=
list
(
self
.
input_storage
)
finder
=
{}
finder
=
{}
...
@@ -821,6 +830,7 @@ class Function(object):
...
@@ -821,6 +830,7 @@ class Function(object):
self
[
k
]
=
arg
self
[
k
]
=
arg
if
(
not
self
.
trust_input
and
if
(
not
self
.
trust_input
and
# The getattr is only needed for old pickle
getattr
(
self
,
'_check_for_aliased_inputs'
,
True
)):
getattr
(
self
,
'_check_for_aliased_inputs'
,
True
)):
# Collect aliased inputs among the storage space
# Collect aliased inputs among the storage space
args_share_memory
=
[]
args_share_memory
=
[]
...
...
theano/compile/tests/test_function_module.py
浏览文件 @
95b8f998
...
@@ -609,6 +609,7 @@ class T_picklefunction(unittest.TestCase):
...
@@ -609,6 +609,7 @@ class T_picklefunction(unittest.TestCase):
self
.
assertFalse
(
x
in
g
.
container
)
self
.
assertFalse
(
x
in
g
.
container
)
self
.
assertFalse
(
x
in
g
.
value
)
self
.
assertFalse
(
x
in
g
.
value
)
self
.
assertTrue
(
len
(
f
.
defaults
)
==
len
(
g
.
defaults
))
self
.
assertTrue
(
len
(
f
.
defaults
)
==
len
(
g
.
defaults
))
self
.
assertTrue
(
f
.
_check_for_aliased_inputs
is
g
.
_check_for_aliased_inputs
)
# print 'f.defaults = %s' % (f.defaults, )
# print 'f.defaults = %s' % (f.defaults, )
# print 'g.defaults = %s' % (g.defaults, )
# print 'g.defaults = %s' % (g.defaults, )
self
.
assertTrue
(
all
([
f_req
==
g_req
and
f_feed
==
g_feed
and
self
.
assertTrue
(
all
([
f_req
==
g_req
and
f_feed
==
g_feed
and
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论