Skip to content
This repository was archived by the owner on Jul 2, 2021. It is now read-only.

add test_xception.py #879

Merged
merged 1 commit into from
May 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions tests/links_tests/model_tests/deeplab_tests/test_xception.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import unittest

import chainer
from chainer import testing
from chainer.testing import attr

from chainercv.links.model.deeplab.xception import Xception65


class TestXception(unittest.TestCase):

def setUp(self):
self.link = Xception65()

def check_call(self):
xp = self.link.xp
x = chainer.Variable(xp.random.uniform(
low=-1, high=1, size=(2, 3, 64, 64)
).astype(xp.float32))
y1, y2 = self.link(x)

self.assertIsInstance(y1, chainer.Variable)
self.assertIsInstance(y1.data, xp.ndarray)
self.assertEqual(y1.shape, (2, 256, 16, 16))
self.assertIsInstance(y2, chainer.Variable)
self.assertIsInstance(y2.data, xp.ndarray)
self.assertEqual(y2.shape, (2, 2048, 8, 8))

@attr.slow
def test_call_cpu(self):
self.check_call()

@attr.gpu
@attr.slow
def test_call_gpu(self):
self.link.to_gpu()
self.check_call()


testing.run_module(__name__, __file__)