Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b1b05e86
提交
b1b05e86
authored
6月 16, 2016
作者:
Frederic Bastien
提交者:
sentient07
7月 08, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rework the subtensor lifter. If it have only 1 clients, don't move it to the…
Rework the subtensor lifter. If it have only 1 clients, don't move it to the GPU. Simpler condition that do what we want.
上级
fbc384cf
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
12 行增加
和
7 行删除
+12
-7
opt.py
theano/gpuarray/opt.py
+8
-6
test_opt.py
theano/gpuarray/tests/test_opt.py
+4
-1
没有找到文件。
theano/gpuarray/opt.py
浏览文件 @
b1b05e86
...
@@ -913,11 +913,8 @@ def local_gpua_subtensor(op, context_name, inputs, outputs):
...
@@ -913,11 +913,8 @@ def local_gpua_subtensor(op, context_name, inputs, outputs):
isinstance
(
gpu_x
.
owner
.
op
,
GpuFromHost
)
and
isinstance
(
gpu_x
.
owner
.
op
,
GpuFromHost
)
and
# And it is a shared var or an input of the graph.
# And it is a shared var or an input of the graph.
not
gpu_x
.
owner
.
inputs
[
0
]
.
owner
):
not
gpu_x
.
owner
.
inputs
[
0
]
.
owner
):
if
len
(
x
.
clients
)
==
1
:
if
len
(
x
.
clients
)
==
1
and
len
(
outputs
[
0
]
.
clients
)
==
1
:
if
any
([
n
==
'output'
or
any
([
isinstance
(
v
.
type
,
GpuArrayType
)
return
for
v
in
n
.
inputs
+
n
.
outputs
])
for
n
,
_
in
outputs
[
0
]
.
clients
]):
return
# Here is the condition for the GraphToGPU opt. inputs is the
# Here is the condition for the GraphToGPU opt. inputs is the
# inputs we want to use for the new node
# inputs we want to use for the new node
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
GpuFromHost
)):
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
GpuFromHost
)):
...
@@ -945,7 +942,12 @@ def local_gpua_subtensor_graph(op, context_name, inputs, outputs):
...
@@ -945,7 +942,12 @@ def local_gpua_subtensor_graph(op, context_name, inputs, outputs):
# and is used by only 1 node.
# and is used by only 1 node.
# x is in the new graph, so we can't tests its number of clients.
# x is in the new graph, so we can't tests its number of clients.
if
not
cpu_x
.
owner
and
len
(
cpu_x
.
clients
)
==
1
:
if
not
cpu_x
.
owner
and
len
(
cpu_x
.
clients
)
==
1
:
return
c
=
outputs
[
0
]
.
clients
# If the subtensor have only 1 client, do it on the CPU.
# We let the other optimization to take care to move the
# next node or not.
if
len
(
c
)
==
1
:
return
return
GpuSubtensor
(
op
.
idx_list
)
return
GpuSubtensor
(
op
.
idx_list
)
...
...
theano/gpuarray/tests/test_opt.py
浏览文件 @
b1b05e86
...
@@ -355,7 +355,10 @@ def test_local_gpu_subtensor():
...
@@ -355,7 +355,10 @@ def test_local_gpu_subtensor():
topo
=
f
.
maker
.
fgraph
.
toposort
()
topo
=
f
.
maker
.
fgraph
.
toposort
()
assert
any
([
type
(
node
.
op
)
is
tensor
.
Subtensor
for
node
in
topo
])
assert
any
([
type
(
node
.
op
)
is
tensor
.
Subtensor
for
node
in
topo
])
assert
not
any
([
isinstance
(
node
.
op
,
GpuSubtensor
)
for
node
in
topo
])
assert
not
any
([
isinstance
(
node
.
op
,
GpuSubtensor
)
for
node
in
topo
])
assert
any
([
isinstance
(
node
.
op
,
GpuElemwise
)
for
node
in
topo
])
# Our optimizer isn't smart enough to move to the GPU Elemwise.
# If it where just a little bit smarter, it could wrongly move it to the GPU.
# If it where super smart, it would know it should not move it to the GPU.
assert
any
([
isinstance
(
node
.
op
,
tensor
.
Elemwise
)
for
node
in
topo
])
def
test_local_gpu_elemwise
():
def
test_local_gpu_elemwise
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论