Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
f0d2b735
提交
f0d2b735
authored
11月 17, 2016
作者:
Pascal Lamblin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Avoid setting the same element to different values
This fixes an intermittent failure with non-default seed
上级
ec2dab80
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
3 行删除
+9
-3
test_subtensor.py
theano/tensor/tests/test_subtensor.py
+9
-3
没有找到文件。
theano/tensor/tests/test_subtensor.py
浏览文件 @
f0d2b735
...
@@ -989,6 +989,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -989,6 +989,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
all_inputs_num
=
[]
all_inputs_num
=
[]
all_outputs_var
=
[]
all_outputs_var
=
[]
all_outputs_num
=
[]
all_outputs_num
=
[]
all_params
=
[]
for
set_instead_of_inc
in
(
False
,
True
):
for
set_instead_of_inc
in
(
False
,
True
):
for
inplace
in
(
False
,
True
):
for
inplace
in
(
False
,
True
):
for
data_shape
in
((
10
,),
(
4
,
5
),
(
1
,
2
,
3
),
(
4
,
5
,
6
,
7
)):
for
data_shape
in
((
10
,),
(
4
,
5
),
(
1
,
2
,
3
),
(
4
,
5
,
6
,
7
)):
...
@@ -1021,7 +1022,11 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -1021,7 +1022,11 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
data_shape
[
0
]
>
1
):
data_shape
[
0
]
>
1
):
n_to_inc
=
2
n_to_inc
=
2
# Corresponding numeric variable.
# Corresponding numeric variable.
idx_num
=
rng
.
randint
(
0
,
data_shape
[
0
],
n_to_inc
)
# If set_instead_of_inc, we want to avoid repeating
# indices, as the order is not guaranteed.
idx_num
=
rng
.
choice
(
numpy
.
arange
(
data_shape
[
0
]),
n_to_inc
,
replace
=
(
not
set_instead_of_inc
))
idx_num
=
idx_num
.
astype
(
'int64'
)
idx_num
=
idx_num
.
astype
(
'int64'
)
# Symbolic variable with increment value.
# Symbolic variable with increment value.
inc_var
=
self
.
type
(
inc_var
=
self
.
type
(
...
@@ -1079,6 +1084,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -1079,6 +1084,7 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
all_inputs_num
+=
[
data_num
,
idx_num
,
inc_num
]
all_inputs_num
+=
[
data_num
,
idx_num
,
inc_num
]
all_outputs_var
.
append
(
output
)
all_outputs_var
.
append
(
output
)
all_outputs_num
.
append
(
data_copy
)
all_outputs_num
.
append
(
data_copy
)
all_params
.
append
((
set_instead_of_inc
,
inplace
,
data_shape
,
inc_shape
))
if
False
:
# Enable for debugging purpose.
if
False
:
# Enable for debugging purpose.
f
=
self
.
function
([
data_var
,
idx_var
,
inc_var
],
f
=
self
.
function
([
data_var
,
idx_var
,
inc_var
],
output
,
accept_inplace
=
inplace
,
output
,
accept_inplace
=
inplace
,
...
@@ -1105,10 +1111,10 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
...
@@ -1105,10 +1111,10 @@ class T_subtensor(unittest.TestCase, utt.TestOptimizationMixin):
f_outs
=
f
(
*
all_inputs_num
)
f_outs
=
f
(
*
all_inputs_num
)
assert
len
(
f_outs
)
==
len
(
all_outputs_num
)
assert
len
(
f_outs
)
==
len
(
all_outputs_num
)
for
f_out
,
output_num
in
izip
(
f_outs
,
all_outputs_num
):
for
params
,
f_out
,
output_num
in
izip
(
all_params
,
f_outs
,
all_outputs_num
):
# NB: if this assert fails, it will probably be easier to debug if
# NB: if this assert fails, it will probably be easier to debug if
# you enable the debug code above.
# you enable the debug code above.
assert
numpy
.
allclose
(
f_out
,
output_num
)
assert
numpy
.
allclose
(
f_out
,
output_num
)
,
(
params
,
f_out
,
output_num
)
def
test_adv_constant_arg
(
self
):
def
test_adv_constant_arg
(
self
):
# Test case provided (and bug detected, gh-607) by John Salvatier
# Test case provided (and bug detected, gh-607) by John Salvatier
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论