Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
b6747150
提交
b6747150
authored
10月 25, 2016
作者:
slefrancois
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
use float32 reference and raise rtol for test_conv3d in float16
上级
d5a45459
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
21 行增加
和
5 行删除
+21
-5
test_dnn.py
theano/gpuarray/tests/test_dnn.py
+21
-5
没有找到文件。
theano/gpuarray/tests/test_dnn.py
浏览文件 @
b6747150
...
...
@@ -33,6 +33,13 @@ def set_precision(floatX):
return
precision
# If using float16, cast reference input to float32
def
ref_cast
(
x
):
if
theano
.
config
.
floatX
==
'float16'
:
x
=
T
.
cast
(
x
,
'float32'
)
return
x
def
test_dnn_conv_desc_merge
():
if
not
dnn
.
dnn_available
(
test_ctx_name
):
raise
SkipTest
(
dnn
.
dnn_available
.
msg
)
...
...
@@ -1044,13 +1051,18 @@ def test_conv3d_fwd():
# Compile a theano function for the reference implementation
conv_ref
=
theano
.
tensor
.
nnet
.
corr3d
.
Corr3dMM
(
border_mode
=
border_mode
,
subsample
=
subsample
)(
inputs
,
flipped_filters
)
)(
ref_cast
(
inputs
)
,
flipped_filters
)
f_ref
=
theano
.
function
([],
conv_ref
,
mode
=
"FAST_RUN"
)
# Compare the results of the two implementations
res_ref
=
f_ref
()
res
=
f
()
utt
.
assert_allclose
(
res_ref
,
res
)
# raise rtol to make the test pass with more seed.
rtol
=
None
# Raise tolerance for float16
if
theano
.
config
.
floatX
==
'float16'
:
rtol
=
6e-2
utt
.
assert_allclose
(
res_ref
,
res
,
rtol
=
rtol
)
test_cases
=
get_conv3d_test_cases
()
for
(
i_shape
,
f_shape
,
subsample
),
border_mode
,
conv_mode
in
test_cases
:
...
...
@@ -1091,7 +1103,7 @@ def test_conv3d_bwd():
# Compile a theano function for the reference implementation
conv_ref
=
theano
.
tensor
.
nnet
.
corr3d
.
Corr3dMM
(
border_mode
=
border_mode
,
subsample
=
subsample
)(
inputs
,
flipped_filters
)
)(
ref_cast
(
inputs
)
,
flipped_filters
)
(
grad_i_ref
,
grad_w_ref
)
=
theano
.
tensor
.
grad
(
conv_ref
.
sum
(),
[
inputs
,
filters
])
...
...
@@ -1102,8 +1114,12 @@ def test_conv3d_bwd():
res
=
f
()
# Needed for big size for some seed
# raise rtol to make the test pass with more seed.
utt
.
assert_allclose
(
res_ref
[
0
],
res
[
0
],
rtol
=
2e-5
)
utt
.
assert_allclose
(
res_ref
[
1
],
res
[
1
],
rtol
=
2e-5
)
rtol
=
None
# Raise tolerance for float16
if
theano
.
config
.
floatX
==
'float16'
:
rtol
=
5e-2
utt
.
assert_allclose
(
res_ref
[
0
],
res
[
0
],
rtol
=
rtol
)
utt
.
assert_allclose
(
res_ref
[
1
],
res
[
1
],
rtol
=
rtol
)
test_cases
=
get_conv3d_test_cases
()
for
(
i_shape
,
f_shape
,
subsample
),
border_mode
,
conv_mode
in
test_cases
:
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论