Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
ab1d2d48
提交
ab1d2d48
authored
2月 24, 2015
作者:
abergeron
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2524 from nouiz/tests
Faster tests in DebugMode and more resistent to rounding difference.
上级
65f54e68
4c7819b3
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
41 行增加
和
41 行删除
+41
-41
install_ubuntu.txt
doc/install_ubuntu.txt
+5
-5
cuda_ndarray.cu
theano/sandbox/cuda/cuda_ndarray.cu
+2
-1
opt.py
theano/sandbox/cuda/opt.py
+6
-4
test_fftconv.py
theano/sandbox/cuda/tests/test_fftconv.py
+28
-31
没有找到文件。
doc/install_ubuntu.txt
浏览文件 @
ab1d2d48
...
...
@@ -5,14 +5,14 @@ Easy Installation of an Optimized Theano on Current Ubuntu
For Ubuntu 11.10 through 14.04:
.. code-block: bash
.. code-block:
:
bash
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ libopenblas-dev git
sudo pip install Theano
For Ubuntu 11.04:
.. code-block: bash
.. code-block:
:
bash
sudo apt-get install python-numpy python-scipy python-dev python-pip python-nose g++ git libatlas3gf-base libatlas-dev
sudo pip install Theano
...
...
@@ -71,7 +71,7 @@ If you would like, instead, to install the bleeding edge Theano (from github)
such that you can edit and contribute to Theano, replace the `pip install Theano`
command with:
.. code-block: bash
.. code-block:
:
bash
git clone git://github.com/Theano/Theano.git
cd Theano
...
...
@@ -85,7 +85,7 @@ If you would like to install Theano in a VirtualEnv, you will want to pass the
`--system-site-packages` flag when creating the VirtualEnv so that it will pick up
the system-provided `Numpy` and `SciPy`.
.. code-block: bash
.. code-block:
:
bash
virtualenv --system-site-packages -p python2.7 theano-env
source theano-env/bin/activate
...
...
@@ -166,7 +166,7 @@ Updating Bleeding Edge Installs
Change to the Theano directory and run:
.. code-block: bash
.. code-block:
:
bash
git pull
...
...
theano/sandbox/cuda/cuda_ndarray.cu
浏览文件 @
ab1d2d48
...
...
@@ -3065,7 +3065,8 @@ CudaNdarray_ptr_int_size(PyObject* _unused, PyObject* args)
PyErr_SetString
(
PyExc_RuntimeError
,
"error copying data to from memory"
);
return
NULL
;
}
return
Py_BuildValue
(
"iiii"
,
gpu_sizes
[
0
],
sizeof
(
float
*
),
sizeof
(
int
),
gpu_sizes
[
1
]);
return
Py_BuildValue
(
"iiii"
,
(
int
)
gpu_sizes
[
0
],
(
int
)
sizeof
(
float
*
),
(
int
)
sizeof
(
int
),
(
int
)
gpu_sizes
[
1
]);
}
static
int
cublas_init
();
...
...
theano/sandbox/cuda/opt.py
浏览文件 @
ab1d2d48
...
...
@@ -313,8 +313,8 @@ def local_gpu_split(node):
if
host_input
.
owner
and
isinstance
(
host_input
.
owner
.
op
,
tensor
.
Split
):
split_node
=
host_input
.
owner
new_op
=
GpuSplit
(
split_node
.
op
.
len_splits
)
return
[
new_op
(
gpu_from_host
(
split_node
.
inputs
[
0
]),
*
split_node
.
inputs
[
1
:])]
return
new_op
(
gpu_from_host
(
split_node
.
inputs
[
0
]),
*
split_node
.
inputs
[
1
:])
return
False
...
...
@@ -1742,7 +1742,7 @@ def get_device_type_sizes():
cuda_ndarray
=
theano
.
sandbox
.
cuda
.
cuda_ndarray
.
cuda_ndarray
t
=
cuda_ndarray
.
ptr_int_size
()
gpu_ptr_size
,
cpu_ptr_size
,
int_size
,
gpu_int_size
=
t
assert
int_size
==
gpu_int_size
assert
int_size
==
gpu_int_size
,
(
int_size
,
gpu_int_size
)
del
gpu_int_size
del
t
except
Exception
,
e
:
...
...
@@ -1751,7 +1751,9 @@ def get_device_type_sizes():
"This could cause less GpuElemwise fused together.
\n
"
"
%
s"
)
%
e
)
rval
=
get_device_type_sizes
.
rval
=
locals
()
rval
=
get_device_type_sizes
.
rval
=
dict
(
gpu_ptr_size
=
gpu_ptr_size
,
cpu_ptr_size
=
cpu_ptr_size
,
int_size
=
int_size
)
return
rval
...
...
theano/sandbox/cuda/tests/test_fftconv.py
浏览文件 @
ab1d2d48
import
unittest
import
numpy
import
copy
import
theano
from
theano.tests
import
unittest_tools
as
utt
...
...
@@ -86,7 +85,6 @@ class TestConv2dFFT(unittest.TestCase):
assert
sum
(
isinstance
(
n
.
op
,
theano
.
sandbox
.
cuda
.
fftconv
.
CuFFTOp
)
for
n
in
topo
)
==
2
,
topo
res_ref
=
f_ref
()
res_fft
=
f_fft
()
...
...
@@ -130,11 +128,11 @@ class TestConv2dFFT(unittest.TestCase):
inputs
=
shared
(
inputs_val
)
filters
=
shared
(
filters_val
)
conv
=
theano
.
tensor
.
nnet
.
conv
.
conv2d
(
inputs
,
filters
,
version
=
'no_fft'
)
conv
=
theano
.
tensor
.
nnet
.
conv
.
conv2d
(
inputs
,
filters
,
version
=
'no_fft'
)
mode
=
mode_with_gpu
.
including
(
'conv_fft_valid'
)
f_ref
=
theano
.
function
([],
conv
)
f_fft
=
theano
.
function
([],
conv
,
mode
=
mode
)
# make sure we that no CuFFTOp has been inserted
...
...
@@ -158,7 +156,6 @@ class TestConv2dFFT(unittest.TestCase):
mode
=
mode_with_gpu
.
including
(
'conv_fft_full'
)
f_ref
=
theano
.
function
([],
conv
)
f_fft
=
theano
.
function
([],
conv
,
mode
=
mode
)
# make sure we that no CuFFTOp has been inserted
...
...
@@ -178,15 +175,16 @@ class TestConv3dFFT(unittest.TestCase):
bias
=
shared
(
numpy
.
zeros
(
filters_shape
[
0
])
.
astype
(
'float32'
))
# Flip filter as conv3D compute correlation
filters_flip
=
filters
[:,
::
-
1
,::
-
1
,::
-
1
,
:]
#filters_flip = filters
filters_flip
=
filters
[:,
::
-
1
,
::
-
1
,
::
-
1
,
:]
#
filters_flip = filters
conv_ref
=
theano
.
tensor
.
nnet
.
conv3D
(
V
=
inputs
,
W
=
filters_flip
,
b
=
bias
,
d
=
(
1
,
1
,
1
))
b
=
bias
,
d
=
(
1
,
1
,
1
))
conv_fft
=
theano
.
sandbox
.
cuda
.
fftconv
.
conv3d_fft
(
inputs
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
),
filters
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
),
border_mode
=
"valid"
,
pad_last_dim
=
pad
)
conv_fft
=
theano
.
sandbox
.
cuda
.
fftconv
.
conv3d_fft
(
inputs
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
),
filters
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
),
border_mode
=
"valid"
,
pad_last_dim
=
pad
)
conv_fft
=
conv_fft
.
dimshuffle
(
0
,
2
,
3
,
4
,
1
)
f_ref
=
theano
.
function
([],
conv_ref
,
mode
=
"FAST_RUN"
)
...
...
@@ -198,8 +196,6 @@ class TestConv3dFFT(unittest.TestCase):
res_fft
=
f_fft
()
utt
.
assert_allclose
(
res_ref
,
res_fft
,
rtol
=
1e-05
,
atol
=
1e-05
)
def
run_conv_full
(
self
,
inputs_shape
,
filters_shape
,
pad
=
False
):
inputs_val
=
numpy
.
random
.
random
(
inputs_shape
)
.
astype
(
'float32'
)
filters_val
=
numpy
.
random
.
random
(
filters_shape
)
.
astype
(
'float32'
)
...
...
@@ -208,14 +204,15 @@ class TestConv3dFFT(unittest.TestCase):
filters
=
shared
(
filters_val
)
bias
=
shared
(
numpy
.
zeros
(
filters_shape
[
4
])
.
astype
(
'float32'
))
conv_ref
=
theano
.
tensor
.
nnet
.
convTransp3D
(
W
=
filters
,
b
=
bias
,
d
=
(
1
,
1
,
1
),
H
=
inputs
)
conv_ref
=
theano
.
tensor
.
nnet
.
convTransp3D
(
W
=
filters
,
b
=
bias
,
d
=
(
1
,
1
,
1
),
H
=
inputs
)
filters
=
filters
.
dimshuffle
(
4
,
0
,
1
,
2
,
3
)
inputs
=
inputs
.
dimshuffle
(
0
,
4
,
1
,
2
,
3
)
conv_fft
=
theano
.
sandbox
.
cuda
.
fftconv
.
conv3d_fft
(
inputs
,
filters
,
border_mode
=
"full"
,
pad_last_dim
=
pad
)
border_mode
=
"full"
,
pad_last_dim
=
pad
)
conv_fft
=
conv_fft
.
dimshuffle
(
0
,
2
,
3
,
4
,
1
)
f_ref
=
theano
.
function
([],
conv_ref
)
...
...
@@ -233,6 +230,7 @@ class TestConv3dFFT(unittest.TestCase):
self
.
run_conv_valid
(
inputs_shape
=
(
16
,
20
,
32
,
15
,
1
),
filters_shape
=
(
10
,
6
,
12
,
4
,
1
),
pad
=
True
)
def
test_full
(
self
):
self
.
run_conv_full
(
inputs_shape
=
(
16
,
15
,
21
,
16
,
10
),
filters_shape
=
(
10
,
6
,
12
,
4
,
1
),
...
...
@@ -253,7 +251,7 @@ class TestConv3dFFT(unittest.TestCase):
bias
=
shared
(
numpy
.
zeros
(
filters_shape
[
0
])
.
astype
(
'float32'
))
conv
=
theano
.
tensor
.
nnet
.
conv3D
(
V
=
inputs
,
W
=
filters
,
b
=
bias
,
d
=
(
1
,
1
,
1
))
b
=
bias
,
d
=
(
1
,
1
,
1
))
mode
=
mode_with_gpu
.
including
(
'conv3d_fft'
)
mode
.
check_py_code
=
False
...
...
@@ -265,16 +263,19 @@ class TestConv3dFFT(unittest.TestCase):
assert
sum
(
isinstance
(
n
.
op
,
theano
.
sandbox
.
cuda
.
fftconv
.
CuFFTOp
)
for
n
in
topo
)
==
2
res_ref
=
f_ref
()
res_fft
=
f_fft
()
utt
.
assert_allclose
(
res_ref
,
res_fft
)
def
test_opt_convgrad3d_fft
(
self
):
inputs_shape
=
(
16
,
20
,
32
,
16
,
1
)
filters_shape
=
(
10
,
6
,
12
,
4
,
1
)
dCdH_shape
=
(
16
,
15
,
21
,
13
,
10
)
inputs_shape
=
(
2
,
17
,
15
,
16
,
1
)
filters_shape
=
(
10
,
6
,
7
,
4
,
1
)
dCdH_shape
=
(
inputs_shape
[
0
],
inputs_shape
[
1
]
-
filters_shape
[
1
]
+
1
,
inputs_shape
[
2
]
-
filters_shape
[
2
]
+
1
,
inputs_shape
[
3
]
-
filters_shape
[
3
]
+
1
,
filters_shape
[
0
])
inputs_val
=
numpy
.
random
.
random
(
inputs_shape
)
.
astype
(
'float32'
)
dCdH_val
=
numpy
.
random
.
random
(
dCdH_shape
)
.
astype
(
'float32'
)
...
...
@@ -284,7 +285,7 @@ class TestConv3dFFT(unittest.TestCase):
conv
=
theano
.
tensor
.
nnet
.
convGrad3D
(
V
=
inputs
,
dCdH
=
dCdH
,
WShape
=
filters_shape
,
d
=
(
1
,
1
,
1
))
d
=
(
1
,
1
,
1
))
mode
=
mode_with_gpu
.
including
(
'convgrad3d_fft'
)
mode
.
check_py_code
=
False
...
...
@@ -296,16 +297,14 @@ class TestConv3dFFT(unittest.TestCase):
assert
sum
(
isinstance
(
n
.
op
,
theano
.
sandbox
.
cuda
.
fftconv
.
CuFFTOp
)
for
n
in
topo
)
==
2
res_ref
=
f_ref
()
res_fft
=
f_fft
()
utt
.
assert_allclose
(
res_ref
,
res_fft
,
rtol
=
1e-04
,
atol
=
1e-04
)
def
test_opt_convtransp3d_fft
(
self
):
inputs_shape
=
(
16
,
15
,
21
,
12
,
10
)
filters_shape
=
(
10
,
6
,
12
,
4
,
1
)
inputs_shape
=
(
2
,
9
,
16
,
12
,
10
)
filters_shape
=
(
10
,
3
,
8
,
4
,
1
)
inputs_val
=
numpy
.
random
.
random
(
inputs_shape
)
.
astype
(
'float32'
)
filters_val
=
numpy
.
random
.
random
(
filters_shape
)
.
astype
(
'float32'
)
...
...
@@ -314,7 +313,7 @@ class TestConv3dFFT(unittest.TestCase):
inputs
=
shared
(
inputs_val
)
filters
=
shared
(
filters_val
)
conv
=
theano
.
tensor
.
nnet
.
convTransp3D
(
W
=
filters
,
b
=
bias
,
d
=
(
1
,
1
,
1
),
conv
=
theano
.
tensor
.
nnet
.
convTransp3D
(
W
=
filters
,
b
=
bias
,
d
=
(
1
,
1
,
1
),
H
=
inputs
)
mode
=
mode_with_gpu
.
including
(
'convtransp3d_fft'
)
...
...
@@ -326,9 +325,7 @@ class TestConv3dFFT(unittest.TestCase):
assert
sum
(
isinstance
(
n
.
op
,
theano
.
sandbox
.
cuda
.
fftconv
.
CuFFTOp
)
for
n
in
topo
)
==
2
res_ref
=
f_ref
()
res_fft
=
f_fft
()
utt
.
assert_allclose
(
res_ref
,
res_fft
,
rtol
=
1e-04
,
atol
=
1e-04
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论