Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ff1bbc05
提交
ff1bbc05
authored
8月 06, 2010
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix the gpu conv optimizer when the cpu and gpu conv op don't have the same pattern.
上级
22896568
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
15 行增加
和
2 行删除
+15
-2
opt.py
theano/sandbox/cuda/opt.py
+7
-2
basic.py
theano/tensor/basic.py
+8
-0
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
ff1bbc05
...
@@ -497,7 +497,9 @@ def local_gpu_conv(node):
...
@@ -497,7 +497,9 @@ def local_gpu_conv(node):
if
host_input
.
owner
and
isinstance
(
host_input
.
owner
.
op
,
conv
.
ConvOp
):
if
host_input
.
owner
and
isinstance
(
host_input
.
owner
.
op
,
conv
.
ConvOp
):
gpu_conv
=
GpuConvOp_from_ConvOp
(
host_input
.
owner
.
op
)
gpu_conv
=
GpuConvOp_from_ConvOp
(
host_input
.
owner
.
op
)
img
,
kern
=
host_input
.
owner
.
inputs
img
,
kern
=
host_input
.
owner
.
inputs
return
[
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
))]
#in some case the ConvOp broadcast the last 2 dimensions differently then the gpu ConvOp
return
[
tensor
.
patternbroadcast
(
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
)),
node
.
outputs
[
0
]
.
broadcastable
)]
if
isinstance
(
node
.
op
,
conv
.
ConvOp
):
if
isinstance
(
node
.
op
,
conv
.
ConvOp
):
#conv(host_from_gpu) -> host_from_gpu(gpu_conv)
#conv(host_from_gpu) -> host_from_gpu(gpu_conv)
...
@@ -506,7 +508,10 @@ def local_gpu_conv(node):
...
@@ -506,7 +508,10 @@ def local_gpu_conv(node):
kern_on_gpu
=
(
kern
.
owner
and
kern
.
owner
.
op
==
host_from_gpu
)
kern_on_gpu
=
(
kern
.
owner
and
kern
.
owner
.
op
==
host_from_gpu
)
if
img_on_gpu
or
kern_on_gpu
:
if
img_on_gpu
or
kern_on_gpu
:
gpu_conv
=
GpuConvOp_from_ConvOp
(
node
.
op
)
gpu_conv
=
GpuConvOp_from_ConvOp
(
node
.
op
)
return
[
host_from_gpu
(
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
)))]
#in some case the ConvOp broadcast the last 2 dimensions differently then the gpu ConvOp
return
[
tensor
.
patternbroadcast
(
host_from_gpu
(
gpu_conv
(
gpu_from_host
(
img
),
gpu_from_host
(
kern
))),
node
.
outputs
[
0
]
.
broadcastable
)]
import
theano.tensor.signal.downsample
as
downsample
import
theano.tensor.signal.downsample
as
downsample
@register_opt
()
@register_opt
()
...
...
theano/tensor/basic.py
浏览文件 @
ff1bbc05
...
@@ -2744,6 +2744,14 @@ def unbroadcast(x, *axes):
...
@@ -2744,6 +2744,14 @@ def unbroadcast(x, *axes):
rval
=
Rebroadcast
(
*
[(
axis
,
False
)
for
axis
in
axes
])(
x
)
rval
=
Rebroadcast
(
*
[(
axis
,
False
)
for
axis
in
axes
])(
x
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
def
patternbroadcast
(
x
,
broadcastable
):
"""
Make the input impossible to broadcast in the specified axes.
We apply the opt here to don't pollute the graph especially during the gpu optimization
"""
rval
=
Rebroadcast
(
*
[(
i
,
broadcastable
[
i
])
for
i
in
range
(
len
(
broadcastable
))])(
x
)
return
theano
.
tensor
.
opt
.
apply_rebroadcast_opt
(
rval
)
class
Join
(
Op
):
class
Join
(
Op
):
"""
"""
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论