Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1e3de2ce
提交
1e3de2ce
authored
8月 04, 2014
作者:
Arjun Jain
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Changes suggested by Fred
上级
74ea01ac
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
38 行增加
和
37 行删除
+38
-37
conv_gemm.cu
theano/sandbox/cuda/conv_gemm.cu
+1
-1
test_conv_cuda_ndarray.py
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
+37
-36
没有找到文件。
theano/sandbox/cuda/conv_gemm.cu
浏览文件 @
1e3de2ce
...
@@ -76,7 +76,7 @@ void im2col(const float* data_im, const int channels,
...
@@ -76,7 +76,7 @@ void im2col(const float* data_im, const int channels,
// Author: Arjun Jain
// Author: Arjun Jain
CudaNdarray*
valid
MM(const CudaNdarray *input,
CudaNdarray*
corr
MM(const CudaNdarray *input,
CudaNdarray *weight,
CudaNdarray *weight,
CudaNdarray *output,
CudaNdarray *output,
int padding = 0)
int padding = 0)
...
...
theano/sandbox/cuda/tests/test_conv_cuda_ndarray.py
浏览文件 @
1e3de2ce
...
@@ -830,46 +830,47 @@ def test_gemm():
...
@@ -830,46 +830,47 @@ def test_gemm():
input: (batch size, channels, rows, columns)
input: (batch size, channels, rows, columns)
filters: (number of filters, channels, rows, columns)
filters: (number of filters, channels, rows, columns)
"""
"""
for
bs
in
range
(
1
,
5
):
for
mode
in
[
'valid'
,
'full'
]:
for
ch
in
range
(
1
,
4
):
print
'Testing mode: '
+
mode
for
nf
in
range
(
1
,
4
):
for
bs
in
range
(
1
,
5
):
for
rImg
in
range
(
5
,
9
):
for
ch
in
range
(
1
,
4
):
for
rFlt
in
range
(
2
,
4
):
for
nf
in
range
(
1
,
4
):
ishape
=
(
bs
,
ch
,
rImg
,
rImg
)
for
rImg
in
range
(
5
,
9
):
kshape
=
(
nf
,
ch
,
rFlt
,
rFlt
)
for
rFlt
in
range
(
2
,
4
):
print
"ishape: "
,
ishape
ishape
=
(
bs
,
ch
,
rImg
,
rImg
)
print
"kshape: "
,
kshape
kshape
=
(
nf
,
ch
,
rFlt
,
rFlt
)
mode
=
'full'
print
"ishape: "
,
ishape
subsample
=
(
1
,
1
)
print
"kshape: "
,
kshape
subsample
=
(
1
,
1
)
npy_img
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
ishape
),
dtype
=
'float32'
)
npy_kern
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
kshape
),
dtype
=
'float32'
)
i
=
cuda_tensor4
()
k
=
cuda_tensor4
()
t2
=
None
t0
=
time
.
time
()
cpuval
=
py_conv
(
npy_img
,
npy_kern
,
mode
,
subsample
)
t1
=
time
.
time
()
op
=
theano
.
sandbox
.
cuda
.
blas
.
GpuConvMM
(
border_mode
=
mode
)(
i
,
k
)
npy_img
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
ishape
),
dtype
=
'float32'
)
f
=
theano
.
function
([
i
,
k
],
op
,
mode
=
theano_mode
)
npy_kern
=
theano
.
_asarray
(
numpy
.
random
.
rand
(
*
kshape
),
dtype
=
'float32'
)
for
k
in
range
(
npy_kern
.
shape
[
0
]):
for
s
in
range
(
npy_kern
.
shape
[
1
]):
npy_kern
[
k
,
s
,:,:]
=
numpy
.
rot90
(
npy_kern
[
k
,
s
,:,:],
2
)
gpuval
=
f
(
npy_img
,
npy_kern
)
i
=
cuda_tensor4
()
k
=
cuda_tensor4
()
t2
=
time
.
time
()
t2
=
None
gpuval
=
numpy
.
asarray
(
gpuval
)
t0
=
time
.
time
()
rval
=
numpy
.
allclose
(
cpuval
,
gpuval
,
rtol
=
1e-4
)
cpuval
=
py_conv
(
npy_img
,
npy_kern
,
mode
,
subsample
)
assert
(
rval
==
True
)
print
'Test Passed'
t1
=
time
.
time
()
op
=
theano
.
sandbox
.
cuda
.
blas
.
GpuConvMM
(
border_mode
=
mode
)(
i
,
k
)
f
=
theano
.
function
([
i
,
k
],
op
,
mode
=
theano_mode
)
for
k
in
range
(
npy_kern
.
shape
[
0
]):
for
s
in
range
(
npy_kern
.
shape
[
1
]):
npy_kern
[
k
,
s
,:,:]
=
numpy
.
rot90
(
npy_kern
[
k
,
s
,:,:],
2
)
gpuval
=
f
(
npy_img
,
npy_kern
)
t2
=
time
.
time
()
gpuval
=
numpy
.
asarray
(
gpuval
)
rval
=
numpy
.
allclose
(
cpuval
,
gpuval
,
rtol
=
1e-4
)
assert
(
rval
==
True
)
print
'Test Passed'
def
benchmark
():
def
benchmark
():
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论