Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
17f7b9ec
提交
17f7b9ec
authored
11月 21, 2014
作者:
f0k
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add an additional meta-optimizer entry that tries a second code path for conv_dnn
上级
ab6c786e
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
34 行增加
和
2 行删除
+34
-2
dnn.py
theano/sandbox/cuda/dnn.py
+31
-1
opt.py
theano/sandbox/cuda/opt.py
+3
-1
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
17f7b9ec
...
...
@@ -1207,7 +1207,37 @@ if True:
border_mode
=
border_mode
,
subsample
=
subsample
,
direction_hint
=
direction_hint
)]
@register_opt
(
'cudnn'
)
# This optimizer is registered in opt.py as part of the meta-optimizer.
# It tries exactly the opposite code path of what local_conv_dnn() uses,
# because for some input/kernel shape configurations, this is faster.
@local_optimizer
([
GpuConv
])
def
local_conv_dnn_alternative
(
node
):
if
not
dnn_available
():
return
if
isinstance
(
node
.
op
,
GpuConv
):
border_mode
=
node
.
op
.
border_mode
subsample
=
node
.
op
.
subsample
if
border_mode
not
in
[
'full'
,
'valid'
]
or
subsample
!=
(
1
,
1
):
return
img
,
kern
=
node
.
inputs
direction_hint
=
node
.
op
.
direction_hint
if
border_mode
==
'full'
:
# for a full convolution, try using the forward pass instead
# of the backward pass wrt. inputs
direction_hint
=
'forward!'
elif
border_mode
==
'valid'
:
# for a valid convolution, try using the backward pass wrt.
# weights instead of the forward pass and vice versa
if
direction_hint
==
'bprop weights'
:
direction_hint
=
'forward'
else
:
direction_hint
=
'bprop weights'
return
[
dnn_conv
(
img
,
kern
,
border_mode
=
border_mode
,
subsample
=
subsample
,
direction_hint
=
direction_hint
)]
# DISABLED as there is problems in the handling of borders
# @register_opt('cudnn')
@local_optimizer
([
GpuDownsampleFactorMax
])
def
local_pool_dnn
(
node
):
if
not
dnn_available
():
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
17f7b9ec
...
...
@@ -1395,7 +1395,9 @@ class ConvMetaOptimizer(LocalCudaMetaOptimizer):
# We just register all optimizers from conv_groupopt with the metaoptimizer
conv_metaopt
=
ConvMetaOptimizer
(
conv_groupopt
.
query
(
*
[
'+'
+
name
for
name
in
conv_groupopt
.
_names
])
.
opts
)
# And then register the metaoptimizer as the first optimizer in conv_groupopt
# Then we add some optimizers that try less obvious options
conv_metaopt
.
register
(
dnn
.
local_conv_dnn_alternative
)
# Finally, we register the metaoptimizer as the first optimizer in conv_groupopt
conv_groupopt
.
register
(
'conv_meta'
,
conv_metaopt
,
0
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论