Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
45adc6e0
提交
45adc6e0
authored
8月 05, 2015
作者:
carriepl
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3250 from f0k/fix-cudnn-performance
Fix GpuDnnConvGradI not being inserted automatically
上级
8cb9d50e
8da3449a
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
11 行增加
和
10 行删除
+11
-10
dnn.py
theano/sandbox/cuda/dnn.py
+11
-10
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
45adc6e0
...
@@ -1115,7 +1115,7 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
...
@@ -1115,7 +1115,7 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
If border_mode is 'valid', subsample is (1,1) and direction_hint is
If border_mode is 'valid', subsample is (1,1) and direction_hint is
'bprop weights', it will use GpuDnnConvGradW.
'bprop weights', it will use GpuDnnConvGradW.
If border_mode is 'full', subsample is (1,1) and direction_hint is
If border_mode is 'full', subsample is (1,1) and direction_hint is
*not* 'forward!
', it will use GpuDnnConvGradI.
'bprop inputs
', it will use GpuDnnConvGradI.
This parameter is used internally by graph optimizers and may be
This parameter is used internally by graph optimizers and may be
removed at any time without a deprecation period. You have been warned.
removed at any time without a deprecation period. You have been warned.
:param workmem: *deprecated*, use param algo instead
:param workmem: *deprecated*, use param algo instead
...
@@ -1138,7 +1138,7 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
...
@@ -1138,7 +1138,7 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
algo
=
workmem
algo
=
workmem
# Ensure the value of direction_hint is supported
# Ensure the value of direction_hint is supported
assert
direction_hint
in
[
None
,
'bprop weights'
,
'forward'
]
assert
direction_hint
in
[
None
,
'bprop weights'
,
'
bprop inputs'
,
'
forward'
]
fgraph
=
getattr
(
img
,
'fgraph'
,
None
)
or
getattr
(
kerns
,
'fgraph'
,
None
)
fgraph
=
getattr
(
img
,
'fgraph'
,
None
)
or
getattr
(
kerns
,
'fgraph'
,
None
)
if
(
border_mode
==
'valid'
and
subsample
==
(
1
,
1
)
and
if
(
border_mode
==
'valid'
and
subsample
==
(
1
,
1
)
and
...
@@ -1161,12 +1161,10 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
...
@@ -1161,12 +1161,10 @@ def dnn_conv(img, kerns, border_mode='valid', subsample=(1, 1),
return
as_cuda_ndarray_variable
(
conv
.
dimshuffle
(
1
,
0
,
2
,
3
))
return
as_cuda_ndarray_variable
(
conv
.
dimshuffle
(
1
,
0
,
2
,
3
))
elif
(
border_mode
==
'full'
and
subsample
==
(
1
,
1
)
and
elif
(
border_mode
==
'full'
and
subsample
==
(
1
,
1
)
and
direction_hint
!=
'forward!'
and
version
()
==
-
1
):
direction_hint
==
'bprop inputs'
):
# Special case: In CuDNN v1, we can be faster by using GpuDnnConvGradI
# Special case: We are asked to use GpuDnnConvGradI. We need to set
# to compute the full convolution as the backward pass of a valid
# up a suitable 'fake' convolution to compute the gradient for.
# convolution. We just need to set up a suitable 'fake' valid
img
=
gpu_contiguous
(
img
)
# convolution.
img
=
gpu_contiguous
(
img
)
# cudnn v1 and v2 rc3 need contiguous data
kerns
=
gpu_contiguous
(
kerns
.
dimshuffle
(
1
,
0
,
2
,
3
))
kerns
=
gpu_contiguous
(
kerns
.
dimshuffle
(
1
,
0
,
2
,
3
))
conv_mode
=
'cross'
if
conv_mode
==
'conv'
else
'conv'
conv_mode
=
'cross'
if
conv_mode
==
'conv'
else
'conv'
shape2
=
shape_i
(
img
,
2
,
fgraph
)
+
shape_i
(
kerns
,
2
,
fgraph
)
-
1
shape2
=
shape_i
(
img
,
2
,
fgraph
)
+
shape_i
(
kerns
,
2
,
fgraph
)
-
1
...
@@ -2049,8 +2047,11 @@ if True:
...
@@ -2049,8 +2047,11 @@ if True:
direction_hint
=
node
.
op
.
direction_hint
direction_hint
=
node
.
op
.
direction_hint
if
border_mode
==
'full'
:
if
border_mode
==
'full'
:
# for a full convolution, try using the forward pass instead
# for a full convolution, try using the forward pass instead
# of the backward pass wrt. inputs
# of the backward pass wrt. inputs and vice versa
direction_hint
=
'forward!'
if
direction_hint
==
'bprop inputs'
:
direction_hint
=
'forward'
else
:
direction_hint
=
'bprop inputs'
elif
border_mode
==
'valid'
:
elif
border_mode
==
'valid'
:
# for a valid convolution, try using the backward pass wrt.
# for a valid convolution, try using the backward pass wrt.
# weights instead of the forward pass and vice versa
# weights instead of the forward pass and vice versa
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论