提交 6bf3b80f authored 作者: Duc Nguyen's avatar Duc Nguyen

added test for output shape of frac bilinear upsampling. changed fractions.gcd to math.gcd

上级 7e41d0c4
...@@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, division ...@@ -6,7 +6,7 @@ from __future__ import absolute_import, print_function, division
import logging import logging
from six import reraise, integer_types from six import reraise, integer_types
import sys import sys
from fractions import gcd from math import gcd
import theano import theano
......
...@@ -1326,6 +1326,12 @@ class TestBilinearUpsampling(unittest.TestCase): ...@@ -1326,6 +1326,12 @@ class TestBilinearUpsampling(unittest.TestCase):
f_up_x = theano.function([], up_x, mode=self.compile_mode) f_up_x = theano.function([], up_x, mode=self.compile_mode)
utt.assert_allclose(f_up_x(), num_up_x, rtol=1e-6) utt.assert_allclose(f_up_x(), num_up_x, rtol=1e-6)
def test_fractional_bilinear_upsampling_shape(self):
x = np.random.rand(1, 1, 200, 200).astype('float32')
resize = (24, 20)
z = bilinear_upsampling(tensor.as_tensor_variable(x), frac_ratio=resize, use_1D_kernel=False)
utt.assert_allclose(z.shape.eval(), (1, 1, 240, 240))
class TestConv2dTranspose(unittest.TestCase): class TestConv2dTranspose(unittest.TestCase):
mode = None mode = None
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论