Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
6098369f
提交
6098369f
authored
10月 03, 2016
作者:
Frederic Bastien
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Update 3d conv algo avail in cudnn v5
上级
58e93f9b
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
19 行增加
和
13 行删除
+19
-13
dnn.py
theano/gpuarray/dnn.py
+19
-13
没有找到文件。
theano/gpuarray/dnn.py
浏览文件 @
6098369f
...
@@ -461,9 +461,9 @@ class GpuDnnConv(DnnBase):
...
@@ -461,9 +461,9 @@ class GpuDnnConv(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
if
self
.
algo
==
'none'
:
if
self
.
algo
==
'none'
:
# 3d (at least in v4)
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM'
elif
self
.
algo
==
'small'
:
elif
self
.
algo
==
'small'
:
# 3d (at least in v4)
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_PRECOMP_GEMM'
elif
self
.
algo
==
'large'
:
elif
self
.
algo
==
'large'
:
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_GEMM'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_GEMM'
...
@@ -471,7 +471,7 @@ class GpuDnnConv(DnnBase):
...
@@ -471,7 +471,7 @@ class GpuDnnConv(DnnBase):
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_DIRECT'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_DIRECT'
elif
self
.
algo
==
'fft'
:
elif
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT'
elif
self
.
algo
==
'fft_tiling'
:
elif
self
.
algo
==
'fft_tiling'
:
# 3d (not in v4, in v5)
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING'
alg
=
'CUDNN_CONVOLUTION_FWD_ALGO_FFT_TILING'
elif
self
.
algo
==
'winograd'
:
elif
self
.
algo
==
'winograd'
:
# need v5
# need v5
...
@@ -505,10 +505,13 @@ class GpuDnnConv(DnnBase):
...
@@ -505,10 +505,13 @@ class GpuDnnConv(DnnBase):
raise
TypeError
(
"The number of dimensions of "
raise
TypeError
(
"The number of dimensions of "
"img, kern and output must match"
)
"img, kern and output must match"
)
if
(
img
.
type
.
ndim
==
5
and
if
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'large'
,
'fft'
]:
self
.
algo
in
[
'small'
,
'large'
,
'fft'
,
'fft_tiling'
]):
raise
ValueError
(
"convolution algo
%
s can't be used for "
raise
ValueError
(
"convolution algo
%
s can't be used for "
"3d convolutions"
,
(
self
.
algo
,))
"3d convolutions"
,
(
self
.
algo
,))
if
(
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft_tiling'
]
and
version
()
<
5000
):
raise
ValueError
(
"3d convolution algo fft_tiling need cudnn v5"
)
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
...
@@ -634,13 +637,13 @@ class GpuDnnConvGradW(DnnBase):
...
@@ -634,13 +637,13 @@ class GpuDnnConvGradW(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
if
self
.
algo
==
'none'
:
if
self
.
algo
==
'none'
:
# 3d in at least v4
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_0'
if
self
.
algo
==
'deterministic'
:
if
self
.
algo
==
'deterministic'
:
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1'
if
self
.
algo
==
'fft'
:
if
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT'
if
self
.
algo
==
'small'
:
if
self
.
algo
==
'small'
:
# 3d in at least v4
# non-deterministic, small workspace
# non-deterministic, small workspace
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3'
alg
=
'CUDNN_CONVOLUTION_BWD_FILTER_ALGO_3'
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
if
self
.
algo
in
[
'guess_once'
,
'guess_on_shape_change'
,
...
@@ -673,7 +676,7 @@ class GpuDnnConvGradW(DnnBase):
...
@@ -673,7 +676,7 @@ class GpuDnnConvGradW(DnnBase):
"img, topgrad and output must match"
)
"img, topgrad and output must match"
)
if
(
img
.
type
.
ndim
==
5
and
if
(
img
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft'
,
'deterministic'
,
'small'
]):
self
.
algo
in
[
'fft'
,
'deterministic'
]):
raise
ValueError
(
"convolution algo
%
s can't be used for "
raise
ValueError
(
"convolution algo
%
s can't be used for "
"3d convolutions"
,
(
self
.
algo
,))
"3d convolutions"
,
(
self
.
algo
,))
...
@@ -766,13 +769,13 @@ class GpuDnnConvGradI(DnnBase):
...
@@ -766,13 +769,13 @@ class GpuDnnConvGradI(DnnBase):
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
defs
.
append
((
'CONV_INPLACE'
,
'1'
))
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
if
self
.
algo
==
'none'
:
if
self
.
algo
==
'none'
:
# 3d at least v4
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_0'
elif
self
.
algo
==
'deterministic'
:
elif
self
.
algo
==
'deterministic'
:
# 3d at least v4
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_1'
elif
self
.
algo
==
'fft'
:
elif
self
.
algo
==
'fft'
:
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT'
elif
self
.
algo
==
'fft_tiling'
:
elif
self
.
algo
==
'fft_tiling'
:
# 3d not v4, since v5
# big workspace but less than fft
# big workspace but less than fft
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING'
alg
=
'CUDNN_CONVOLUTION_BWD_DATA_ALGO_FFT_TILING'
elif
self
.
algo
==
'winograd'
:
elif
self
.
algo
==
'winograd'
:
...
@@ -808,10 +811,13 @@ class GpuDnnConvGradI(DnnBase):
...
@@ -808,10 +811,13 @@ class GpuDnnConvGradI(DnnBase):
raise
TypeError
(
"The number of dimensions of "
raise
TypeError
(
"The number of dimensions of "
"kern, topgrad and output must match"
)
"kern, topgrad and output must match"
)
if
(
kern
.
type
.
ndim
==
5
and
if
kern
.
type
.
ndim
==
5
and
self
.
algo
in
[
'fft'
]:
self
.
algo
in
[
'fft'
,
'deterministic'
,
'fft_tiling'
]):
raise
ValueError
(
"convolution algo
%
s can't be used for "
raise
ValueError
(
"convolution algo
%
s can't be used for "
"3d convolutions"
,
(
self
.
algo
,))
"3d convolutions"
,
(
self
.
algo
,))
if
(
kern
.
type
.
ndim
==
5
and
self
.
algo
==
'fft_tiling'
and
version
()
<
5000
):
raise
ValueError
(
"3d convolution algo fft_tiling need cudnn v5"
)
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
if
(
not
isinstance
(
desc
.
type
,
CDataType
)
or
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
desc
.
type
.
ctype
!=
'cudnnConvolutionDescriptor_t'
):
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论