Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
5ed22311
提交
5ed22311
authored
9月 30, 2015
作者:
Arnaud Bergeron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Some flake8 fixes.
上级
c508befc
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
8 行增加
和
40 行删除
+8
-40
test_conv_cuda_ndarray.py
theano/sandbox/gpuarray/tests/test_conv_cuda_ndarray.py
+0
-0
test_neighbours.py
theano/sandbox/gpuarray/tests/test_neighbours.py
+1
-3
test_nnet.py
theano/sandbox/gpuarray/tests/test_nnet.py
+7
-30
test_type.py
theano/sandbox/gpuarray/tests/test_type.py
+0
-3
test_flake8.py
theano/tests/test_flake8.py
+0
-4
没有找到文件。
theano/sandbox/gpuarray/tests/test_conv_cuda_ndarray.py
浏览文件 @
5ed22311
差异被折叠。
点击展开。
theano/sandbox/gpuarray/tests/test_neighbours.py
浏览文件 @
5ed22311
import
unittest
from
theano.tensor.nnet.tests
import
test_neighbours
from
theano.tensor.nnet.tests
import
test_neighbours
# We let that import do the init of the back-end if needed.
# We let that import do the init of the back-end if needed.
from
.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
mode_with_gpu
mode_without_gpu
)
from
..neighbours
import
GpuImages2Neibs
from
..neighbours
import
GpuImages2Neibs
...
...
theano/sandbox/gpuarray/tests/test_nnet.py
浏览文件 @
5ed22311
from
__future__
import
print_function
from
__future__
import
print_function
from
nose.plugins.skip
import
SkipTest
import
numpy
import
numpy
import
unittest
import
unittest
...
@@ -7,8 +7,6 @@ import theano
...
@@ -7,8 +7,6 @@ import theano
import
theano.tensor
as
T
import
theano.tensor
as
T
import
theano.tests.unittest_tools
as
utt
import
theano.tests.unittest_tools
as
utt
from
theano.sandbox
import
gpuarray
# We let that import do the init of the back-end if needed.
# We let that import do the init of the back-end if needed.
from
.test_basic_ops
import
(
mode_with_gpu
,
from
.test_basic_ops
import
(
mode_with_gpu
,
mode_without_gpu
)
mode_without_gpu
)
...
@@ -36,15 +34,13 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
...
@@ -36,15 +34,13 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
n_in
=
4098
n_in
=
4098
n_out
=
4099
n_out
=
4099
x
=
T
.
fmatrix
(
'x'
)
y
=
T
.
lvector
(
'y'
)
y
=
T
.
lvector
(
'y'
)
b
=
T
.
fvector
(
'b'
)
b
=
T
.
fvector
(
'b'
)
#W = T.fmatrix('W')
# we precompute the dot with big shape before to allow the test of
# we precompute the dot with big shape before to allow the test of
# GpuCrossentropySoftmax1HotWithBiasDx to don't fail with the error
# GpuCrossentropySoftmax1HotWithBiasDx to don't fail with the error
#(the launch timed out and was terminated) on GPU card not
#
(the launch timed out and was terminated) on GPU card not
# powerful enough. We need the big shape to check for corner
# powerful enough. We need the big shape to check for corner
# case.
# case.
dot_result
=
T
.
fmatrix
(
'dot_result'
)
dot_result
=
T
.
fmatrix
(
'dot_result'
)
...
@@ -54,7 +50,6 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
...
@@ -54,7 +50,6 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
xx
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
batch_size
,
n_in
),
xx
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
batch_size
,
n_in
),
dtype
=
numpy
.
float32
)
dtype
=
numpy
.
float32
)
#?????yy = numpy.ones((batch_size,),dtype='float32')
yy
=
numpy
.
ones
((
batch_size
,),
dtype
=
'int32'
)
yy
=
numpy
.
ones
((
batch_size
,),
dtype
=
'int32'
)
b_values
=
numpy
.
zeros
((
n_out
,),
dtype
=
'float32'
)
b_values
=
numpy
.
zeros
((
n_out
,),
dtype
=
'float32'
)
W_values
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_in
,
n_out
),
dtype
=
'float32'
)
W_values
=
numpy
.
asarray
(
numpy
.
random
.
rand
(
n_in
,
n_out
),
dtype
=
'float32'
)
...
@@ -71,8 +66,6 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
...
@@ -71,8 +66,6 @@ def test_GpuCrossentropySoftmaxArgmax1HotWithBias():
classify_gpu
=
theano
.
function
(
inputs
=
[
y
,
b
,
dot_result
],
classify_gpu
=
theano
.
function
(
inputs
=
[
y
,
b
,
dot_result
],
outputs
=
[
loss
,
y_pred
,
dW
],
outputs
=
[
loss
,
y_pred
,
dW
],
mode
=
mode_with_gpu
)
mode
=
mode_with_gpu
)
# theano.printing.debugprint(classify)
# theano.printing.debugprint(classify_gpu)
assert
any
([
isinstance
(
node
.
op
,
assert
any
([
isinstance
(
node
.
op
,
T
.
nnet
.
CrossentropySoftmaxArgmax1HotWithBias
)
T
.
nnet
.
CrossentropySoftmaxArgmax1HotWithBias
)
...
@@ -97,12 +90,10 @@ def test_GpuCrossentropySoftmax1HotWithBiasDx():
...
@@ -97,12 +90,10 @@ def test_GpuCrossentropySoftmax1HotWithBiasDx():
We check that we loop when their is too much threads
We check that we loop when their is too much threads
"""
"""
n_in
=
1000
batch_size
=
4097
batch_size
=
4097
n_out
=
1250
n_out
=
1250
if
not
isinstance
(
mode_with_gpu
,
theano
.
compile
.
DebugMode
):
if
not
isinstance
(
mode_with_gpu
,
theano
.
compile
.
DebugMode
):
n_in
=
4098
n_out
=
4099
n_out
=
4099
# Seed numpy.random with config.unittests.rseed
# Seed numpy.random with config.unittests.rseed
...
@@ -137,25 +128,7 @@ def test_GpuCrossentropySoftmax1HotWithBiasDx():
...
@@ -137,25 +128,7 @@ def test_GpuCrossentropySoftmax1HotWithBiasDx():
rtol
=
1e-5
rtol
=
1e-5
atol
=
1e-6
atol
=
1e-6
if
not
numpy
.
allclose
(
cpu_out
,
gpu_out
,
rtol
=
rtol
,
atol
=
atol
):
utt
.
assert_allclose
(
cpu_out
,
gpu_out
,
rtol
=
rtol
,
atol
=
atol
)
abs_err
,
rel_err
=
T
.
numeric_grad
.
abs_rel_err
(
cpu_out
,
gpu_out
)
scaled_err
=
numpy
.
minimum
(
abs_err
/
atol
,
rel_err
/
rtol
)
max_i
=
scaled_err
.
argmax
()
print
(
'max err index:'
,
max_i
,
max_i
/
batch_size
,
end
=
' '
)
print
(
max_i
%
batch_size
,
max_i
/
n_out
,
max_i
&
n_out
)
print
(
'At that index:'
)
print
(
'err:'
,
scaled_err
.
flatten
()[
max_i
])
print
(
'absolute error:'
,
abs_err
.
flatten
()[
max_i
])
print
(
'relative error:'
,
rel_err
.
flatten
()[
max_i
])
print
(
'cpu_out:'
,
cpu_out
.
flatten
()[
max_i
])
print
(
'gpu_out:'
,
gpu_out
.
flatten
()[
max_i
])
print
(
'softmax_output_value:'
,
softmax_output_value
.
flatten
()[
max_i
])
print
(
'dnll_value:'
,
dnll_value
[
max_i
/
n_out
])
print
(
'y_idx_value:'
,
y_idx_value
[
max_i
/
n_out
])
assert
False
,
"numpy.allclose(cpu_out, gpu_out, rtol=
%
s, atol=
%
s)"
%
(
rtol
,
atol
)
def
test_softmax_with_bias_float16
():
def
test_softmax_with_bias_float16
():
...
@@ -166,6 +139,7 @@ def test_softmax_with_bias_float16():
...
@@ -166,6 +139,7 @@ def test_softmax_with_bias_float16():
softmax_with_bias_unittest_template
(
dtypeInput
=
'float32'
,
softmax_with_bias_unittest_template
(
dtypeInput
=
'float32'
,
dtypeBias
=
'float16'
)
dtypeBias
=
'float16'
)
def
test_softmax_with_bias_float32
():
def
test_softmax_with_bias_float32
():
softmax_with_bias_unittest_template
(
dtypeInput
=
'float32'
,
softmax_with_bias_unittest_template
(
dtypeInput
=
'float32'
,
dtypeBias
=
'float32'
)
dtypeBias
=
'float32'
)
...
@@ -188,6 +162,7 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
...
@@ -188,6 +162,7 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
TODO: check that we loop when there are too many threads. (THIS IS
TODO: check that we loop when there are too many threads. (THIS IS
NOT IMPLEMENTED)
NOT IMPLEMENTED)
"""
"""
x
=
T
.
matrix
(
'x'
,
dtype
=
dtypeInput
)
x
=
T
.
matrix
(
'x'
,
dtype
=
dtypeInput
)
b
=
T
.
vector
(
'b'
,
dtype
=
dtypeBias
)
b
=
T
.
vector
(
'b'
,
dtype
=
dtypeBias
)
...
@@ -228,9 +203,11 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
...
@@ -228,9 +203,11 @@ def softmax_with_bias_unittest_template(dtypeInput, dtypeBias):
def
test_softmax_float16
():
def
test_softmax_float16
():
softmax_unittest_template
(
'float16'
)
softmax_unittest_template
(
'float16'
)
def
test_softmax_float32
():
def
test_softmax_float32
():
softmax_unittest_template
(
'float32'
)
softmax_unittest_template
(
'float32'
)
def
test_softmax_float64
():
def
test_softmax_float64
():
softmax_unittest_template
(
'float64'
)
softmax_unittest_template
(
'float64'
)
...
...
theano/sandbox/gpuarray/tests/test_type.py
浏览文件 @
5ed22311
import
operator
import
numpy
import
numpy
import
theano
import
theano
...
@@ -25,7 +23,6 @@ def test_deep_copy():
...
@@ -25,7 +23,6 @@ def test_deep_copy():
def
test_values_eq_approx
():
def
test_values_eq_approx
():
a
=
rand_gpuarray
(
20
,
dtype
=
'float32'
)
a
=
rand_gpuarray
(
20
,
dtype
=
'float32'
)
g
=
GpuArrayType
(
dtype
=
'float32'
,
broadcastable
=
(
False
,))(
'g'
)
assert
GpuArrayType
.
values_eq_approx
(
a
,
a
)
assert
GpuArrayType
.
values_eq_approx
(
a
,
a
)
b
=
a
.
copy
()
b
=
a
.
copy
()
b
[
0
]
=
numpy
.
asarray
(
b
[
0
])
+
1.
b
[
0
]
=
numpy
.
asarray
(
b
[
0
])
+
1.
...
...
theano/tests/test_flake8.py
浏览文件 @
5ed22311
...
@@ -160,12 +160,8 @@ whitelist_flake8 = [
...
@@ -160,12 +160,8 @@ whitelist_flake8 = [
"sandbox/gpuarray/__init__.py"
,
"sandbox/gpuarray/__init__.py"
,
"sandbox/gpuarray/tests/test_subtensor.py"
,
"sandbox/gpuarray/tests/test_subtensor.py"
,
"sandbox/gpuarray/tests/test_scan.py"
,
"sandbox/gpuarray/tests/test_scan.py"
,
"sandbox/gpuarray/tests/test_neighbours.py"
,
"sandbox/gpuarray/tests/test_conv_cuda_ndarray.py"
,
"sandbox/gpuarray/tests/test_type.py"
,
"sandbox/gpuarray/tests/test_opt.py"
,
"sandbox/gpuarray/tests/test_opt.py"
,
"sandbox/gpuarray/tests/test_elemwise.py"
,
"sandbox/gpuarray/tests/test_elemwise.py"
,
"sandbox/gpuarray/tests/test_nnet.py"
,
"scan_module/scan_utils.py"
,
"scan_module/scan_utils.py"
,
"scan_module/scan_views.py"
,
"scan_module/scan_views.py"
,
"scan_module/scan.py"
,
"scan_module/scan.py"
,
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论