Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
78b41288
提交
78b41288
authored
12月 09, 2014
作者:
Frederic
提交者:
Arnaud Bergeron
12月 19, 2014
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add cuDNN version information.
上级
5895d5a2
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
51 行增加
和
2 行删除
+51
-2
cudnn_helper.h
theano/sandbox/cuda/cudnn_helper.h
+11
-1
dnn.py
theano/sandbox/cuda/dnn.py
+34
-1
test_dnn.py
theano/sandbox/cuda/tests/test_dnn.py
+6
-0
没有找到文件。
theano/sandbox/cuda/cudnn_helper.h
浏览文件 @
78b41288
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
#include <cudnn.h>
#include <cudnn.h>
static
inline
const
char
*
cudnnGetErrorString
(
cudnnStatus_t
err
)
{
inline
const
char
*
cudnnGetErrorString
(
cudnnStatus_t
err
)
{
switch
(
err
)
{
switch
(
err
)
{
case
CUDNN_STATUS_SUCCESS
:
case
CUDNN_STATUS_SUCCESS
:
return
"The operation completed successfully."
;
return
"The operation completed successfully."
;
...
@@ -28,4 +28,14 @@ static inline const char *cudnnGetErrorString(cudnnStatus_t err) {
...
@@ -28,4 +28,14 @@ static inline const char *cudnnGetErrorString(cudnnStatus_t err) {
}
}
}
}
static
inline
const
int
cudnnVersionMacro
(){
#ifdef CUDNN_VERSION
return
CUDNN_VERSION
;
#else
//CUDNN_VERSION undefined, you probably use cuDNN R1 version
return
-
1
;
#endif
}
#endif
#endif
theano/sandbox/cuda/dnn.py
浏览文件 @
78b41288
...
@@ -3,7 +3,7 @@ import os
...
@@ -3,7 +3,7 @@ import os
import
theano
import
theano
from
theano
import
Apply
,
gof
,
tensor
from
theano
import
Apply
,
gof
,
tensor
from
theano.gof
import
Optimizer
,
local_optimizer
from
theano.gof
import
Optimizer
,
local_optimizer
from
theano.gof.type
import
CDataType
from
theano.gof.type
import
CDataType
,
Generic
from
theano.compat
import
PY3
from
theano.compat
import
PY3
from
theano.tensor.nnet
import
SoftmaxGrad
from
theano.tensor.nnet
import
SoftmaxGrad
from
theano.sandbox.cuda.type
import
CudaNdarrayType
from
theano.sandbox.cuda.type
import
CudaNdarrayType
...
@@ -121,6 +121,39 @@ if ((err = cudnnCreate(&_handle)) != CUDNN_STATUS_SUCCESS) {
...
@@ -121,6 +121,39 @@ if ((err = cudnnCreate(&_handle)) != CUDNN_STATUS_SUCCESS) {
}"""
%
(
error_out
,)]
}"""
%
(
error_out
,)]
class
DnnVersion
(
DnnBase
):
def
c_compiler
(
self
):
return
NVCC_compiler
def
make_node
(
self
):
return
Apply
(
self
,
[],
[
Generic
()()])
def
c_code
(
self
,
node
,
name
,
inputs
,
outputs
,
sub
):
o
=
outputs
[
0
]
return
"""
%(o)
s = PyInt_FromLong(cudnnVersionMacro());
"""
%
locals
()
def
do_constant_folding
(
self
,
node
):
# Needed as we do not want to cache this information.
return
False
def
c_code_cache_version
(
self
):
# Not needed, but make it clear that we do not want to cache this.
return
None
def
version
():
"""
return the current cuDNN version we compile with.
This only check the header version, the the library we link with.
"""
f
=
theano
.
function
([],
DnnVersion
()(),
theano
.
Mode
(
optimizer
=
None
))
return
f
()
class
GpuDnnConvDesc
(
GpuOp
):
class
GpuDnnConvDesc
(
GpuOp
):
"""This Op builds a convolution descriptor for use in the other
"""This Op builds a convolution descriptor for use in the other
convolution operations.
convolution operations.
...
...
theano/sandbox/cuda/tests/test_dnn.py
浏览文件 @
78b41288
...
@@ -192,3 +192,9 @@ def test_dnn_tag():
...
@@ -192,3 +192,9 @@ def test_dnn_tag():
assert
cuda
.
dnn
.
dnn_available
()
assert
cuda
.
dnn
.
dnn_available
()
assert
any
([
isinstance
(
n
.
op
,
cuda
.
dnn
.
GpuDnnPool
)
assert
any
([
isinstance
(
n
.
op
,
cuda
.
dnn
.
GpuDnnPool
)
for
n
in
f
.
maker
.
fgraph
.
toposort
()])
for
n
in
f
.
maker
.
fgraph
.
toposort
()])
def
test_version
():
if
not
cuda
.
dnn
.
dnn_available
():
raise
SkipTest
(
cuda
.
dnn
.
dnn_available
.
msg
)
assert
isinstance
(
cuda
.
dnn
.
version
(),
int
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论