Commit 460addf8 authored by Yuxin Wu's avatar Yuxin Wu

add layer tests to travis

parent eaec5b2b
......@@ -35,7 +35,7 @@ matrix:
install:
- pip install -U pip # the pip version on travis is too old
- pip install flake8 opencv-python pypandoc
- pip install flake8 scikit-image opencv-python pypandoc
# here we use opencv-python, but users are in general not recommended to use this package,
# because it brings issues working with tensorflow on gpu
- ./tests/install-tensorflow.sh
......@@ -51,7 +51,7 @@ script:
- cd examples && flake8 .
- mkdir -p $HOME/tensorpack_data
- export TENSORPACK_DATASET=$HOME/tensorpack_data
- cd $TRAVIS_BUILD_DIR/tests && python -m unittest discover -v
- $TRAVIS_BUILD_DIR/tests/run-tests.sh
notifications:
- email:
......
......@@ -43,7 +43,7 @@ setup(
description='Neural Network Toolbox on TensorFlow',
long_description=long_description,
install_requires=req,
tests_require=['flake8'],
tests_require=['flake8', 'scikit-image'],
extras_require={
'all': extra_req
},
......
......@@ -107,7 +107,7 @@ def ImageSample(inputs, borderMode='repeat'):
class TestSample(TestModel):
def test_sample(self):
def test_ImageSample(self):
import numpy as np
h, w = 3, 4
......
......@@ -193,8 +193,7 @@ def BilinearUpSample(x, shape):
class TestPool(TestModel):
def test_fixed_unpooling(self):
def test_FixedUnPooling(self):
h, w = 3, 4
mat = np.random.rand(h, w, 3).astype('float32')
inp = self.make_variable(mat)
......@@ -210,7 +209,7 @@ class TestPool(TestModel):
res[0, ::2, ::2, :] = 0
self.assertTrue((res == 0).all())
def test_upsample(self):
def test_BilinearUpSample(self):
h, w = 5, 5
scale = 2
......@@ -222,14 +221,16 @@ class TestPool(TestModel):
res = self.run_variable(output)[0, :, :, 0]
from skimage.transform import rescale
res2 = rescale(mat, scale)
res2 = rescale(mat, scale, mode='constant')
diff = np.abs(res2 - res)
# not equivalent to rescale on edge?
# TODO not equivalent to rescale on edge?
diff[0, :] = 0
diff[-1, :] = 0
diff[:, 0] = 0
if not diff.max() < 1e-4:
import IPython
IPython.embed(config=IPython.terminal.ipapp.load_default_config())
self.assertTrue(diff.max() < 1e-4)
diff[:, -1] = 0
# if not diff.max() < 1e-4:
# import IPython
# IPython.embed(config=IPython.terminal.ipapp.load_default_config())
self.assertTrue(diff.max() < 1e-4, diff.max())
......@@ -52,7 +52,7 @@ class PythonScript(threading.Thread):
else:
# something unexpected happend here, this script was supposed to survive at leat the timeout
if len(self.err) is not 0:
stderr = "\n".join([" " * 10 + v for v in self.err.decode("utf-8").split("\n")])
stderr = "\n" * 5 + self.err
raise AssertionError(stderr)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment