Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
0bd65807
提交
0bd65807
authored
8月 10, 2017
作者:
notoraptor
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rewrite choice of cuDNN definitions.
Fix cuDNN V7 integration into dnn_rnn_desc. Fix typo. Fix flake8.
上级
00786143
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
19 行增加
和
8 行删除
+19
-8
dnn_rnn_desc.c
theano/gpuarray/c_code/dnn_rnn_desc.c
+7
-1
cudnn_defs.py
theano/gpuarray/cudnn_defs.py
+11
-6
dnn.py
theano/gpuarray/dnn.py
+1
-1
没有找到文件。
theano/gpuarray/c_code/dnn_rnn_desc.c
浏览文件 @
0bd65807
...
...
@@ -29,11 +29,17 @@ int dnn_rnn_desc(int hidden_size, int num_layers,
PyErr_SetString
(
PyExc_RuntimeError
,
"Can't create RNN descriptor"
);
return
-
1
;
}
#if CUDNN_MAJOR < 7
err
=
cudnnSetRNNDescriptor
(
desc
,
hidden_size
,
num_layers
,
ddesc
,
(
cudnnRNNInputMode_t
)
input_mode
,
(
cudnnDirectionMode_t
)
direction_mode
,
(
cudnnRNNMode_t
)
rnn_mode
,
data_type
);
#else
err
=
cudnnSetRNNDescriptor
(
_handle
,
desc
,
hidden_size
,
num_layers
,
ddesc
,
(
cudnnRNNInputMode_t
)
input_mode
,
(
cudnnDirectionMode_t
)
direction_mode
,
(
cudnnRNNMode_t
)
rnn_mode
,
CUDNN_RNN_ALGO_STANDARD
,
data_type
);
#endif
if
(
err
!=
CUDNN_STATUS_SUCCESS
)
{
cudnnDestroyRNNDescriptor
(
desc
);
PyErr_SetString
(
PyExc_RuntimeError
,
"Can't set RNN descriptor"
);
...
...
theano/gpuarray/cudnn_defs.py
浏览文件 @
0bd65807
...
...
@@ -103,7 +103,7 @@ class CuDNNV6(CuDNNV51):
# new in v6
(
'CUDNN_DATA_INT8'
,
'int8'
),
(
'CUDNN_DATA_INT32'
,
'int32'
),
#
('CUDNN_DATA_INT8X4', 'int8x4'),
#
('CUDNN_DATA_INT8X4', 'int8x4'),
ctype
=
'cudnnDataType_t'
)
cudnnPoolingMode_t
=
CEnumType
((
'CUDNN_POOLING_MAX'
,
'max'
),
...
...
@@ -133,15 +133,17 @@ class CuDNNV6(CuDNNV51):
(
'CUDNN_REDUCE_TENSOR_NORM2'
,
'norm2'
),
ctype
=
'cudnnReduceTensorOp_t'
)
class
CuDNNV7
(
CuDNNV6
):
version
=
7
cudnnMathType_t
=
CEnumType
((
'CUDNN_DEFAULT_MATH'
,
'non_tensor_op'
),
(
'CUDNN_TENSOR_OP_MATH'
,
'tensor_op'
),
ctype
=
'cudnnMathType_t'
)
ctype
=
'cudnnMathType_t'
)
cudnnDeterminism_t
=
CEnumType
((
'CUDNN_NON_DETERMINISTIC'
,
'non_deterministic'
),
(
'CUDNN_DETERMINISTIC'
,
'deterministic'
),
ctype
=
'cudnnDeterminism_t'
)
ctype
=
'cudnnDeterminism_t'
)
def
get_definitions
(
cudnn_version
=
None
):
"""
Return cuDNN definitions to be used by Theano for the given cuDNN version.
...
...
@@ -151,7 +153,10 @@ def get_definitions(cudnn_version=None):
if None, return definitions for the most recent supported cuDNN version.
"""
if
cudnn_version
is
not
None
and
cudnn_version
//
1000
==
6
:
return
CuDNNV6
()
if
cudnn_version
is
not
None
:
if
cudnn_version
//
1000
==
5
:
return
CuDNNV51
()
if
cudnn_version
//
1000
==
6
:
return
CuDNNV6
()
# By default, we use definitions for the last supported cuDNN version.
return
CuDNNV7
()
theano/gpuarray/dnn.py
浏览文件 @
0bd65807
...
...
@@ -90,7 +90,7 @@ def _dnn_lib():
if
lib_name
:
break
if
lib_name
is
None
:
raise
RuntimeError
(
'Could not find cudnn library (looked for v5*
or v6
*)'
)
raise
RuntimeError
(
'Could not find cudnn library (looked for v5*
to v7
*)'
)
else
:
dnn_handle
=
ctypes
.
cdll
.
LoadLibrary
(
lib_name
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论