Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
9f231761
提交
9f231761
authored
6月 15, 2015
作者:
--global
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Default to safe algo when fft is not supported
上级
ad9646be
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
90 行增加
和
2 行删除
+90
-2
dnn_fwd.c
theano/sandbox/cuda/dnn_fwd.c
+41
-0
dnn_gw.c
theano/sandbox/cuda/dnn_gw.c
+49
-2
没有找到文件。
theano/sandbox/cuda/dnn_fwd.c
浏览文件 @
9f231761
...
...
@@ -137,6 +137,47 @@ APPLY_SPECIFIC(conv_fwd)(CudaNdarray *input, CudaNdarray *kerns,
chosen_algo
=
CONV_ALGO
;
}
// The FFT implementation does not support strides, 1x1 filters or
// inputs with a spatial dimension larger than 1024.
// If the chosen implementation is FFT, validate that it can be used
// on the current data and default on a safe implementation if it
// can't.
if
(
chosen_algo
==
CUDNN_CONVOLUTION_FWD_ALGO_FFT
)
{
// Extract the properties of the convolution descriptor
int
pad_h
,
pad_w
,
stride_v
,
stride_h
,
upscale_x
,
upscale_y
;
cudnnConvolutionMode_t
mode
;
err
=
cudnnGetConvolution2dDescriptor
(
desc
,
&
pad_h
,
&
pad_w
,
&
stride_v
,
&
stride_h
,
&
upscale_x
,
&
upscale_y
,
&
mode
);
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnConv: error getting convolution properties: %s"
,
cudnnGetErrorString
(
err
));
return
1
;
}
// Extract the spatial size of the filters
int
filter_h
=
CudaNdarray_HOST_DIMS
(
kerns
)[
3
];
int
filter_w
=
CudaNdarray_HOST_DIMS
(
kerns
)[
4
];
// Extract the spatial size of the input
int
input_h
=
CudaNdarray_HOST_DIMS
(
input
)[
3
];
int
input_w
=
CudaNdarray_HOST_DIMS
(
input
)[
4
];
// Ensure that the selected implementation supports the requested
// convolution. Fall back to a safe implementation otherwise.
if
(
stride_v
!=
1
||
stride_h
!=
1
||
input_h
>
1024
||
input_w
>
1024
||
(
filter_h
==
1
&&
filter_w
==
1
))
{
chosen_algo
=
CUDNN_CONVOLUTION_FWD_ALGO_IMPLICIT_GEMM
;
}
}
err
=
cudnnGetConvolutionForwardWorkspaceSize
(
_handle
,
APPLY_SPECIFIC
(
input
),
APPLY_SPECIFIC
(
kerns
),
...
...
theano/sandbox/cuda/dnn_gw.c
浏览文件 @
9f231761
...
...
@@ -97,7 +97,54 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output,
}
else
{
chosen_algo
=
CONV_ALGO
;
// The shapes of the input and the output are the same as for the
// last execution. The convolution algorithm used last time can also
// be used here
chosen_algo
=
APPLY_SPECIFIC
(
previous_bwd_f_algo
);
}
}
else
{
chosen_algo
=
CONV_ALGO
;
}
// The FFT implementation does not support strides, 1x1 filters or
// inputs with a spatial dimension larger than 1024.
// If the chosen implementation is FFT, validate that it can be used
// on the current data and default on a safe implementation if it
// can't.
if
(
chosen_algo
==
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_FFT
)
{
// Extract the properties of the convolution descriptor
int
pad_h
,
pad_w
,
stride_v
,
stride_h
,
upscale_x
,
upscale_y
;
cudnnConvolutionMode_t
mode
;
err
=
cudnnGetConvolution2dDescriptor
(
desc
,
&
pad_h
,
&
pad_w
,
&
stride_v
,
&
stride_h
,
&
upscale_x
,
&
upscale_y
,
&
mode
);
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
PyErr_Format
(
PyExc_RuntimeError
,
"GpuDnnConvGradW: error getting convolution properties: %s"
,
cudnnGetErrorString
(
err
));
return
1
;
}
// Extract the spatial size of the filters
int
filter_h
=
CudaNdarray_HOST_DIMS
(
*
kerns
)[
3
];
int
filter_w
=
CudaNdarray_HOST_DIMS
(
*
kerns
)[
4
];
// Extract the spatial size of the input
int
input_h
=
CudaNdarray_HOST_DIMS
(
input
)[
3
];
int
input_w
=
CudaNdarray_HOST_DIMS
(
input
)[
4
];
// Ensure that the selected implementation supports the requested
// convolution. Fall back to a safe implementation otherwise.
if
(
stride_v
!=
1
||
stride_h
!=
1
||
input_h
>
1024
||
input_w
>
1024
||
(
filter_h
==
1
&&
filter_w
==
1
))
{
chosen_algo
=
CUDNN_CONVOLUTION_BWD_FILTER_ALGO_1
;
}
}
...
...
@@ -129,7 +176,7 @@ APPLY_SPECIFIC(conv_gw)(CudaNdarray *input, CudaNdarray *output,
APPLY_SPECIFIC
(
output
),
CudaNdarray_DEV_DATA
(
output
),
desc
,
chosen_algo
,
&
workspace
,
worksize
,
workspace
,
worksize
,
(
void
*
)
&
beta
,
APPLY_SPECIFIC
(
kerns
),
CudaNdarray_DEV_DATA
(
*
kerns
));
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论