Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
P
pytensor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
testgroup
pytensor
Commits
e4dabed2
提交
e4dabed2
authored
3月 16, 2016
作者:
Frédéric Bastien
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #4241 from abergeron/fix_cudnn_mac
Fix the bilinear tests in float32.
上级
e1b37ea4
7606749b
显示空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
9 行增加
和
9 行删除
+9
-9
test_abstract_conv.py
theano/tensor/nnet/tests/test_abstract_conv.py
+9
-9
没有找到文件。
theano/tensor/nnet/tests/test_abstract_conv.py
浏览文件 @
e4dabed2
...
@@ -563,13 +563,13 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -563,13 +563,13 @@ class TestBilinearUpsampling(unittest.TestCase):
kernel
=
bilinear_kernel_2D
(
ratio
=
ratio
,
normalize
=
False
)
kernel
=
bilinear_kernel_2D
(
ratio
=
ratio
,
normalize
=
False
)
f
=
theano
.
function
([],
kernel
)
f
=
theano
.
function
([],
kernel
)
kernel_2D
=
self
.
numerical_kernel_2D
(
ratio
)
kernel_2D
=
self
.
numerical_kernel_2D
(
ratio
)
np
.
testing
.
assert_allclose
(
kernel_2D
,
f
())
utt
.
assert_allclose
(
kernel_2D
,
f
())
# getting the normalized kernel
# getting the normalized kernel
kernel
=
bilinear_kernel_2D
(
ratio
=
ratio
,
normalize
=
True
)
kernel
=
bilinear_kernel_2D
(
ratio
=
ratio
,
normalize
=
True
)
f
=
theano
.
function
([],
kernel
)
f
=
theano
.
function
([],
kernel
)
kernel_2D
=
kernel_2D
/
float
(
ratio
**
2
)
kernel_2D
=
kernel_2D
/
float
(
ratio
**
2
)
np
.
testing
.
assert_allclose
(
kernel_2D
,
f
())
utt
.
assert_allclose
(
kernel_2D
,
f
())
def
test_bilinear_kernel_1D
(
self
):
def
test_bilinear_kernel_1D
(
self
):
"""Test 1D kernels used in bilinear upsampling
"""Test 1D kernels used in bilinear upsampling
...
@@ -591,15 +591,15 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -591,15 +591,15 @@ class TestBilinearUpsampling(unittest.TestCase):
kernel
=
bilinear_kernel_1D
(
ratio
=
ratio
,
normalize
=
False
)
kernel
=
bilinear_kernel_1D
(
ratio
=
ratio
,
normalize
=
False
)
f
=
theano
.
function
([],
kernel
)
f
=
theano
.
function
([],
kernel
)
kernel_1D
=
self
.
numerical_kernel_1D
(
ratio
)
kernel_1D
=
self
.
numerical_kernel_1D
(
ratio
)
np
.
testing
.
assert_allclose
(
kernel_1D
,
f
())
utt
.
assert_allclose
(
kernel_1D
,
f
())
np
.
testing
.
assert_allclose
(
kernel_1D
,
f_ten
(
ratio
))
utt
.
assert_allclose
(
kernel_1D
,
f_ten
(
ratio
))
# getting the normalized kernel
# getting the normalized kernel
kernel
=
bilinear_kernel_1D
(
ratio
=
ratio
,
normalize
=
True
)
kernel
=
bilinear_kernel_1D
(
ratio
=
ratio
,
normalize
=
True
)
f
=
theano
.
function
([],
kernel
)
f
=
theano
.
function
([],
kernel
)
kernel_1D
=
kernel_1D
/
float
(
ratio
)
kernel_1D
=
kernel_1D
/
float
(
ratio
)
np
.
testing
.
assert_allclose
(
kernel_1D
,
f
())
utt
.
assert_allclose
(
kernel_1D
,
f
())
np
.
testing
.
assert_allclose
(
kernel_1D
,
f_ten_norm
(
ratio
))
utt
.
assert_allclose
(
kernel_1D
,
f_ten_norm
(
ratio
))
def
numerical_upsampling_multiplier
(
self
,
ratio
):
def
numerical_upsampling_multiplier
(
self
,
ratio
):
"""Compute upsampling multiplier
"""Compute upsampling multiplier
...
@@ -680,7 +680,7 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -680,7 +680,7 @@ class TestBilinearUpsampling(unittest.TestCase):
use_1D_kernel
=
True
)
use_1D_kernel
=
True
)
f
=
theano
.
function
([],
bilin_mat
)
f
=
theano
.
function
([],
bilin_mat
)
up_mat_2d
=
self
.
get_upsampled_twobytwo_mat
(
input_x
,
ratio
)
up_mat_2d
=
self
.
get_upsampled_twobytwo_mat
(
input_x
,
ratio
)
np
.
testing
.
assert_allclose
(
f
(),
up_mat_2d
,
rtol
=
1e-06
)
utt
.
assert_allclose
(
f
(),
up_mat_2d
,
rtol
=
1e-06
)
def
test_compare_1D_and_2D_upsampling_values
(
self
):
def
test_compare_1D_and_2D_upsampling_values
(
self
):
"""Compare 1D and 2D upsampling
"""Compare 1D and 2D upsampling
...
@@ -699,7 +699,7 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -699,7 +699,7 @@ class TestBilinearUpsampling(unittest.TestCase):
use_1D_kernel
=
False
)
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_2D
=
theano
.
function
([],
mat_2D
)
np
.
testing
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
# checking upsampling with ratio 8
# checking upsampling with ratio 8
input_x
=
np
.
random
.
rand
(
12
,
11
,
10
,
7
)
.
astype
(
theano
.
config
.
floatX
)
input_x
=
np
.
random
.
rand
(
12
,
11
,
10
,
7
)
.
astype
(
theano
.
config
.
floatX
)
...
@@ -711,4 +711,4 @@ class TestBilinearUpsampling(unittest.TestCase):
...
@@ -711,4 +711,4 @@ class TestBilinearUpsampling(unittest.TestCase):
use_1D_kernel
=
False
)
use_1D_kernel
=
False
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_1D
=
theano
.
function
([],
mat_1D
)
f_2D
=
theano
.
function
([],
mat_2D
)
f_2D
=
theano
.
function
([],
mat_2D
)
np
.
testing
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
utt
.
assert_allclose
(
f_1D
(),
f_2D
(),
rtol
=
1e-06
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论