Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5222ae46
提交
5222ae46
authored
8月 01, 2017
作者:
Frédéric Bastien
提交者:
GitHub
8月 01, 2017
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #6215 from abergeron/lol
Fix the copy for aliased function arguments
上级
76e434ad
54645174
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
12 行增加
和
13 行删除
+12
-13
function.py
theano/compile/function.py
+1
-2
function_module.py
theano/compile/function_module.py
+10
-10
scan_utils.py
theano/scan_module/scan_utils.py
+1
-1
没有找到文件。
theano/compile/function.py
浏览文件 @
5222ae46
...
...
@@ -13,7 +13,6 @@ from six import string_types
from
theano.compile.io
import
In
from
theano.compile.function_module
import
orig_function
from
theano.compile.pfunc
import
pfunc
import
numpy
as
np
import
warnings
from
theano
import
compat
...
...
@@ -286,7 +285,7 @@ def function(inputs, outputs=None, mode=None, updates=None, givens=None,
"input."
)
# compute some features of the arguments:
uses_tuple
=
np
.
any
([
isinstance
(
i
,
(
list
,
tuple
))
for
i
in
inputs
])
uses_tuple
=
any
([
isinstance
(
i
,
(
list
,
tuple
))
for
i
in
inputs
])
uses_updates
=
bool
(
updates
)
uses_givens
=
bool
(
givens
)
...
...
theano/compile/function_module.py
浏览文件 @
5222ae46
...
...
@@ -836,9 +836,9 @@ class Function(object):
in
args_share_memory
[
j
]],
[
self
.
input_storage
[
k
]
.
storage
[
0
]
for
k
in
args_share_memory
[
j
]])
if
np
.
any
([(
var
.
type
is
i_var
.
type
and
var
.
type
.
may_share_memory
(
val
,
i_val
))
for
(
var
,
val
)
in
group_j
]):
if
any
([(
var
.
type
is
i_var
.
type
and
var
.
type
.
may_share_memory
(
val
,
i_val
))
for
(
var
,
val
)
in
group_j
]):
is_aliased
=
True
args_share_memory
[
j
]
.
append
(
i
)
...
...
@@ -847,13 +847,13 @@ class Function(object):
if
not
is_aliased
:
args_share_memory
.
append
([
i
])
# Check for groups of more than one argument that share memory
for
group
in
args_share_memory
:
if
len
(
group
)
>
1
:
# copy all but the first
for
idx
in
group
[
1
:]:
self
.
input_storage
[
i
]
.
storage
[
0
]
=
copy
.
copy
(
self
.
input_storage
[
i
]
.
storage
[
0
])
# Check for groups of more than one argument that share memory
for
group
in
args_share_memory
:
if
len
(
group
)
>
1
:
# copy all but the first
for
j
in
group
[
1
:]:
self
.
input_storage
[
j
]
.
storage
[
0
]
=
copy
.
copy
(
self
.
input_storage
[
j
]
.
storage
[
0
])
# Check if inputs are missing, or if inputs were set more than once, or
# if we tried to provide inputs that are supposed to be implicit.
...
...
theano/scan_module/scan_utils.py
浏览文件 @
5222ae46
...
...
@@ -948,7 +948,7 @@ def scan_can_remove_outs(op, out_idxs):
added
=
False
for
pos
,
idx
in
enumerate
(
out_idxs
):
if
(
out_idxs_mask
[
pos
]
and
np
.
any
([
x
in
required_inputs
for
x
in
out_ins
[
idx
]])):
any
([
x
in
required_inputs
for
x
in
out_ins
[
idx
]])):
# This output is required ..
out_idxs_mask
[
pos
]
=
0
required_inputs
+=
gof
.
graph
.
inputs
([
op
.
outputs
[
idx
]])
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论