Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
1f324a65
提交
1f324a65
authored
6月 29, 2015
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3076 from nouiz/tests
[TEST] fix tests
上级
c7340d33
24eb715c
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
23 行增加
和
14 行删除
+23
-14
opt.py
theano/sandbox/cuda/opt.py
+7
-3
test_basic_ops.py
theano/sandbox/cuda/tests/test_basic_ops.py
+9
-9
test_multinomial.py
theano/sandbox/test_multinomial.py
+2
-0
test_raw_random.py
theano/tensor/tests/test_raw_random.py
+5
-2
没有找到文件。
theano/sandbox/cuda/opt.py
浏览文件 @
1f324a65
...
...
@@ -1770,7 +1770,9 @@ def local_gpu_downsample_factor_max_grad(node):
node
.
op
.
ds
==
node
.
op
.
st
):
assert
node
.
op
.
__props__
==
(
'ds'
,
'ignore_border'
,
'st'
,
'padding'
,
'mode'
)
if
node
.
op
.
padding
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
:
if
(
node
.
op
.
padding
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
or
node
.
op
.
st
!=
node
.
op
.
ds
):
return
x
,
z
,
gz
=
node
.
inputs
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
...
...
@@ -1785,8 +1787,10 @@ def local_gpu_downsample_factor_max_grad(node):
@local_optimizer
([
downsample
.
DownsampleFactorMaxGradGrad
])
def
local_gpu_downsample_factor_max_grad_grad
(
node
):
if
isinstance
(
node
.
op
,
downsample
.
DownsampleFactorMaxGradGrad
):
assert
node
.
op
.
__props__
==
(
'ds'
,
'ignore_border'
,
'st'
)
assert
node
.
op
.
__props__
==
(
'ds'
,
'ignore_border'
,
'st'
,
'padding'
,
'mode'
)
if
node
.
op
.
padding
!=
(
0
,
0
)
or
node
.
op
.
mode
!=
'max'
:
return
x
,
z
,
gx
=
node
.
inputs
if
(
x
.
owner
and
isinstance
(
x
.
owner
.
op
,
HostFromGpu
)):
op
=
GpuDownsampleFactorMaxGradGrad
(
node
.
op
.
ds
,
...
...
theano/sandbox/cuda/tests/test_basic_ops.py
浏览文件 @
1f324a65
...
...
@@ -1069,7 +1069,7 @@ class T_subtensor(theano.tensor.tests.test_subtensor.T_subtensor):
val
=
numpy
.
asarray
(
val
)
good
=
data
[
idx
]
self
.
assertTrue
(
val
.
ndim
==
data
.
ndim
)
self
.
assertTrue
(
numpy
.
allclose
(
val
,
good
),
(
val
,
good
)
)
utt
.
assert_allclose
(
val
,
good
)
# Test with input strided
t
=
self
.
adv_sub1
()(
n
[::
-
1
],
idx
)
...
...
@@ -1082,7 +1082,7 @@ class T_subtensor(theano.tensor.tests.test_subtensor.T_subtensor):
val
=
numpy
.
asarray
(
val
)
good
=
data
[::
-
1
][
idx
]
self
.
assertTrue
(
val
.
ndim
==
data
.
ndim
)
self
.
assertTrue
(
numpy
.
allclose
(
val
,
good
),
(
val
,
good
)
)
utt
.
assert_allclose
(
val
,
good
)
def
test_advinc_subtensor1
():
...
...
@@ -1103,7 +1103,7 @@ def test_advinc_subtensor1():
rval
=
f
(
yval
)
rep
=
xval
.
copy
()
rep
[[
0
,
2
]]
+=
yval
assert
numpy
.
allclose
(
rval
,
rep
)
utt
.
assert_
allclose
(
rval
,
rep
)
def
test_inc_subtensor
():
...
...
@@ -1121,8 +1121,8 @@ def test_inc_subtensor():
assert
sum
([
isinstance
(
node
.
op
,
cuda
.
GpuIncSubtensor
)
and
node
.
op
.
set_instead_of_inc
==
False
for
node
in
f
.
maker
.
fgraph
.
toposort
()])
==
1
assert
numpy
.
allclose
(
f
(
xval
,
yval
),
[[
1.
,
12.
,
13.
],
[
4.
,
15.
,
16.
],
[
7.
,
18.
,
19.
]])
utt
.
assert_
allclose
(
f
(
xval
,
yval
),
[[
1.
,
12.
,
13.
],
[
4.
,
15.
,
16.
],
[
7.
,
18.
,
19.
]])
def
test_set_subtensor
():
...
...
@@ -1180,11 +1180,11 @@ def test_many_arg_elemwise():
if
mode
is
mode_with_gpu
:
assert
any
([
isinstance
(
node
.
op
,
cuda
.
GpuElemwise
)
for
node
in
f
.
maker
.
fgraph
.
apply_nodes
])
assert
numpy
.
allclose
(
out
,
outputs
[
-
1
])
utt
.
assert_
allclose
(
out
,
outputs
[
-
1
])
results_gpu
,
results_cpu
=
outputs
assert
numpy
.
allclose
(
results_gpu
,
results_cpu
)
utt
.
assert_
allclose
(
results_gpu
,
results_cpu
)
def
test_duplicate_arg_elemwise
():
...
...
@@ -1196,7 +1196,7 @@ def test_duplicate_arg_elemwise():
Aval
=
numpy
.
random
.
RandomState
([
1
,
2
,
3
])
.
randn
(
5
,
5
)
.
astype
(
'float32'
)
Bval
=
Aval
+
Aval
assert
numpy
.
allclose
(
Bval
,
f
(
Aval
))
utt
.
assert_
allclose
(
Bval
,
f
(
Aval
))
def
test_shared_float32
():
...
...
@@ -1235,7 +1235,7 @@ def test_gpueye():
B
.
as_cuda_ndarray_variable
(
out
),
mode
=
mode_with_gpu
)
result
=
numpy
.
asarray
(
f
(
N
,
M
))
assert
numpy
.
allclose
(
result
,
numpy
.
eye
(
N
,
M_
,
dtype
=
dtype
))
utt
.
assert_
allclose
(
result
,
numpy
.
eye
(
N
,
M_
,
dtype
=
dtype
))
assert
result
.
dtype
==
numpy
.
dtype
(
dtype
)
assert
any
([
isinstance
(
node
.
op
,
B
.
GpuEye
)
for
node
in
f
.
maker
.
fgraph
.
toposort
()])
...
...
theano/sandbox/test_multinomial.py
浏览文件 @
1f324a65
...
...
@@ -18,6 +18,8 @@ def get_mode(gpu):
'local_gpu_multinomial'
)
if
isinstance
(
mode
.
linker
,
theano
.
gof
.
PerformLinker
):
mode
.
linker
=
predefined_linkers
[
'c|py'
]
if
hasattr
(
mode
.
linker
,
'c_thunks'
):
mode
.
linker
.
c_thunks
=
True
return
mode
...
...
theano/tensor/tests/test_raw_random.py
浏览文件 @
1f324a65
...
...
@@ -1189,12 +1189,15 @@ class T_random_function(utt.InferShapeTester):
# binomial was created by calling RandomFunction on a string,
# random_integers by calling it on a function.
rng_r
=
random_state_type
()
mode
=
None
if
theano
.
config
.
mode
in
[
"DEBUG_MODE"
,
"DebugMode"
]:
mode
=
'FAST_COMPILE'
post_bin_r
,
bin_sample
=
binomial
(
rng_r
,
(
3
,
5
),
1
,
.
3
)
f
=
theano
.
function
([
rng_r
],
[
post_bin_r
,
bin_sample
])
f
=
theano
.
function
([
rng_r
],
[
post_bin_r
,
bin_sample
]
,
mode
=
mode
)
pkl_f
=
pickle
.
dumps
(
f
)
post_int_r
,
int_sample
=
random_integers
(
rng_r
,
(
3
,
5
),
-
1
,
8
)
g
=
theano
.
function
([
rng_r
],
[
post_int_r
,
int_sample
])
g
=
theano
.
function
([
rng_r
],
[
post_int_r
,
int_sample
]
,
mode
=
mode
)
pkl_g
=
pickle
.
dumps
(
g
)
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论