Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b9609e87
提交
b9609e87
authored
9月 18, 2014
作者:
Dustin Webb
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fixed problem with cudnn softmax tests. This fix should be generalized for use…
Fixed problem with cudnn softmax tests. This fix should be generalized for use of the class. Also there are two cases it cannot handle.
上级
4948b7c8
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
14 行增加
和
7 行删除
+14
-7
dnn.py
theano/sandbox/cuda/dnn.py
+3
-3
test_nnet.py
theano/sandbox/cuda/tests/test_nnet.py
+11
-4
没有找到文件。
theano/sandbox/cuda/dnn.py
浏览文件 @
b9609e87
...
@@ -480,7 +480,7 @@ if(softmax_handle_%(id)d != NULL)
...
@@ -480,7 +480,7 @@ if(softmax_handle_%(id)d != NULL)
else
:
else
:
tensor_format
=
0
tensor_format
=
0
if
self
.
mode
==
'
channel
'
:
if
self
.
mode
==
'
instance
'
:
mode
=
1
mode
=
1
else
:
else
:
mode
=
0
mode
=
0
...
@@ -500,9 +500,9 @@ cudnnSoftmaxAlgorithm_t algo%(id)d = CUDNN_SOFTMAX_ACCURATE;
...
@@ -500,9 +500,9 @@ cudnnSoftmaxAlgorithm_t algo%(id)d = CUDNN_SOFTMAX_ACCURATE;
if (
%(algo)
d == 1)
if (
%(algo)
d == 1)
algo
%(id)
d = CUDNN_SOFTMAX_FAST;
algo
%(id)
d = CUDNN_SOFTMAX_FAST;
cudnnSoftmaxMode_t mode
%(id)
d = CUDNN_SOFTMAX_MODE_
INSTANCE
;
cudnnSoftmaxMode_t mode
%(id)
d = CUDNN_SOFTMAX_MODE_
CHANNEL
;
if (
%(mode)
d == 1)
if (
%(mode)
d == 1)
mode
%(id)
d = CUDNN_SOFTMAX_MODE_
CHANNEL
;
mode
%(id)
d = CUDNN_SOFTMAX_MODE_
INSTANCE
;
err
%(name)
s = cudnnSetTensor4dDescriptor(
err
%(name)
s = cudnnSetTensor4dDescriptor(
softmax_input_
%(id)
d,
softmax_input_
%(id)
d,
...
...
theano/sandbox/cuda/tests/test_nnet.py
浏览文件 @
b9609e87
...
@@ -223,10 +223,13 @@ def _test_softmax(x, x_gpu, f_z, f_gpu_z, cpu_type, gpu_type, cmp, topo_idx):
...
@@ -223,10 +223,13 @@ def _test_softmax(x, x_gpu, f_z, f_gpu_z, cpu_type, gpu_type, cmp, topo_idx):
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
topo_idx
]
.
op
,
gpu_type
)
assert
isinstance
(
f_gpu
.
maker
.
fgraph
.
toposort
()[
topo_idx
]
.
op
,
gpu_type
)
#we need to test n>32*1024 to check that we make the block loop.
#we need to test n>32*1024 to check that we make the block loop.
cmp
(
1
,
5
,
f
,
f_gpu
)
cmp
(
2
,
5
,
f
,
f_gpu
)
cmp
(
2
,
5
,
f
,
f_gpu
)
cmp
(
2
<<
15
,
5
,
f
,
f_gpu
)
cmp
(
10
,
5
,
f
,
f_gpu
)
cmp
(
100
,
5
,
f
,
f_gpu
)
cmp
(
1000
,
5
,
f
,
f_gpu
)
cmp
(
10000
,
5
,
f
,
f_gpu
)
cmp
(
4074
,
400
,
f
,
f_gpu
)
cmp
(
4074
,
400
,
f
,
f_gpu
)
cmp
(
0
,
10
,
f
,
f_gpu
)
cmp
(
784
,
784
,
f
,
f_gpu
)
cmp
(
784
,
784
,
f
,
f_gpu
)
cmp
(
4
,
1000
,
f
,
f_gpu
)
cmp
(
4
,
1000
,
f
,
f_gpu
)
cmp
(
4
,
1024
,
f
,
f_gpu
)
cmp
(
4
,
1024
,
f
,
f_gpu
)
...
@@ -238,6 +241,9 @@ def _test_softmax(x, x_gpu, f_z, f_gpu_z, cpu_type, gpu_type, cmp, topo_idx):
...
@@ -238,6 +241,9 @@ def _test_softmax(x, x_gpu, f_z, f_gpu_z, cpu_type, gpu_type, cmp, topo_idx):
cmp
(
2
,
10000
,
f
,
f_gpu
)
cmp
(
2
,
10000
,
f
,
f_gpu
)
cmp
(
128
,
16
*
1024
,
f
,
f_gpu
)
cmp
(
128
,
16
*
1024
,
f
,
f_gpu
)
cmp
(
128
,
64
*
1024
,
f
,
f_gpu
)
cmp
(
128
,
64
*
1024
,
f
,
f_gpu
)
cmp
((
2
<<
15
)
-
1
,
5
,
f
,
f_gpu
)
# cudnn permits no more than 2^15 - 1 rows
cmp
(
2
<<
15
,
5
,
f
,
f_gpu
)
cmp
(
0
,
10
,
f
,
f_gpu
)
def
test_softmax
():
def
test_softmax
():
...
@@ -257,8 +263,9 @@ def test_cudnn_softmax():
...
@@ -257,8 +263,9 @@ def test_cudnn_softmax():
def
cmp
(
n
,
m
,
f
,
f_gpu
):
def
cmp
(
n
,
m
,
f
,
f_gpu
):
#print "test_softmax",n,m
#print "test_softmax",n,m
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
data
=
numpy
.
arange
(
n
*
m
,
dtype
=
'float32'
)
.
reshape
(
n
,
m
)
gdata
=
numpy
.
asarray
(
data
)
.
transpose
()[
None
,:,:,
None
]
out
=
f
(
data
)
out
=
f
(
data
)
gout
=
f_gpu
(
data
.
reshape
(
1
,
1
,
n
,
m
))
.
reshape
((
n
,
m
)
)
gout
=
numpy
.
asarray
(
f_gpu
(
gdata
))[
0
,:,:,
0
]
.
transpose
(
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
assert
numpy
.
allclose
(
out
,
gout
),
numpy
.
absolute
(
out
-
gout
)
x
=
T
.
matrix
(
'x'
)
x
=
T
.
matrix
(
'x'
)
...
@@ -267,6 +274,6 @@ def test_cudnn_softmax():
...
@@ -267,6 +274,6 @@ def test_cudnn_softmax():
f_gpu
=
theano
.
sandbox
.
cuda
.
dnn
.
GpuDnnSoftmax
(
f_gpu
=
theano
.
sandbox
.
cuda
.
dnn
.
GpuDnnSoftmax
(
'bc01'
,
'bc01'
,
'accurate'
,
'accurate'
,
'
instance
'
'
channel
'
)
)
_test_softmax
(
x
,
x_gpu
,
f_z
,
f_gpu
,
type
(
f_z
),
type
(
f_gpu
),
cmp
,
-
1
)
_test_softmax
(
x
,
x_gpu
,
f_z
,
f_gpu
,
type
(
f_z
),
type
(
f_gpu
),
cmp
,
-
1
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论