Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
a2330f2
Test Refactoring - Layer Basic & Layer Convolution
Apr 16, 2018
a4ad057
pytest configuration added
Apr 16, 2018
a22482f
test layers: merge & stack refactored
Apr 16, 2018
73e479a
test layers: extend & normalization refactored
Apr 16, 2018
2c49c34
yapf cleaning
Apr 16, 2018
8b96b32
PyDoc && YAPF tests refactored
Apr 16, 2018
1ea5395
Test Layer Time Distributed Refactored + Unittest Custom Class with A…
Apr 16, 2018
2379246
Test Layer - Special Activation Refactored
Apr 16, 2018
4cb2468
Test Layers: Flow Control & Super Resolution Refactored
Apr 16, 2018
e9d1f8c
Test Reuse MLP Refactored
Apr 16, 2018
a181785
Test Layer - Spatial Transformer Refactored
Apr 16, 2018
4076ce6
Test Layer - Padding refactored
Apr 16, 2018
7edcde7
Test Layer - Shape Refactored
Apr 16, 2018
9190abe
Test Layer - Importer Refactored
Apr 16, 2018
bde0e67
Test VGG Models refactored
Apr 16, 2018
23da98b
Test Models - Reuse VGG changed to unittest
Apr 16, 2018
baa764a
Test MNIST Model Refactored
Apr 16, 2018
437f8d9
Test Layer - Pooling Refactored
Apr 16, 2018
f2edd08
Test Layer - Core Refactored
Apr 16, 2018
851ef0a
Test Layer - Recurrent Refactor
Apr 16, 2018
b8ee564
TestCases renamed
Apr 16, 2018
a0b20dc
Travis Config Updated
Apr 16, 2018
4ac845c
Travis Config Updated
Apr 16, 2018
a0094e6
Merge branch 'package_arch_refactoring' into test_refactoring
Apr 16, 2018
90574ef
Travis Config Updated
Apr 16, 2018
a8b9a15
Travis Deploy Script Updated
Apr 16, 2018
21d3cdd
Unnecessary Code removed - Tests cleaned
Apr 16, 2018
c93676a
Test Refactored - Codacy Errors: unused variables Removed
Apr 16, 2018
2c661f2
Merge branch 'master' into test_refactoring
DEKHTIARJonathan Apr 16, 2018
a4c56eb
Test Refactored - Codacy Errors: unused variables Removed
Apr 16, 2018
c8cf061
Test Refactored - Codacy Errors: exception type added => ImportError
Apr 16, 2018
e9d7d50
Codacy Code Improvements - assert(a == b) replaced by self.assertEqua…
Apr 16, 2018
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ dist
docs/_build
tensorlayer.egg-info
tensorlayer/__pacache__
venv/
venv/
.pytest_cache/
69 changes: 41 additions & 28 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,56 @@
# https://docs.travis-ci.com/user/languages/python/
language: python

python:
- "2.7"
- "3.5"
- "3.6"

#env:
# global:
#
# ### == PYPI_PASSWORD === ###
# - secure: "##############################################################"
#
# ### === GITHUB_PERSONAL_TOKEN === ###
# - secure: "##############################################################"


install:
- pip install tensorflow
- pip install -r requirements.txt
- pip install -r tests/requirements.txt
- pip install .
- pip install .[test]


script:
# units test
# https://docs.pytest.org/en/latest/
# TODO: make it work
# - pytest
- pytest


before_deploy:
- python setup.py sdist
- python setup.py bdist_wheel
- python setup.py bdist_wheel --universal
- python setup.py egg_info


#deploy:
#- provider: pypi
# user: zsdh123
# password: "$PYPI_PASSWORD"
# skip_cleanup: true
# on:
# tags: true
# python: '3.6'

# smoke tests
# - make test # TODO: make it use python3 by default
- python tests/test_yapf_format.py
- python tests/test_pydocstyle.py
- python tests/test_mnist_simple.py
- python tests/test_reuse_mlp.py
- python tests/test_layers_basic.py
- python tests/test_layers_convolution.py
- python tests/test_layers_core.py
- python tests/test_layers_extend.py
- python tests/test_layers_flow_control.py
- python tests/test_layers_importer.py
- python tests/test_layers_merge.py
- python tests/test_layers_normalization.py
- python tests/test_layers_padding.py
- python tests/test_layers_pooling.py
- python tests/test_layers_recurrent.py
- python tests/test_layers_shape.py
- python tests/test_layers_spatial_transformer.py
- python tests/test_layers_special_activation.py
- python tests/test_layers_stack.py
- python tests/test_layers_super_resolution.py
- python tests/test_layers_time_distributed.py
- python tests/test_models.py
#- provider: releases
# file:
# - dist/*
# - tensorlayer.egg-info/PKG-INFO
# file_glob: true
# skip_cleanup: true
# api_key: "$GITHUB_PERSONAL_TOKEN"
# on:
# tags: true
# python: '3.6'
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[pytest]
testpaths = tests/
3 changes: 0 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ def req_file(filename):
extras_require={
'test': req_file("tests/requirements.txt")
},

zip_safe=True,
include_package_data=True,
scripts=[
'tl',
],
Expand Down
8 changes: 6 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
yapf==0.20.2
pydocstyle==2.1.1
keras==2.1.5
pydocstyle==2.1.1
pytest==3.4.1
pytest-cache==1.0
pytest-cov==2.5.1
pytest-xdist==1.22.2
yapf==0.20.2
71 changes: 44 additions & 27 deletions tests/test_layers_basic.py
Original file line number Diff line number Diff line change
@@ -1,38 +1,55 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import unittest

import tensorflow as tf
import tensorlayer as tl

x = tf.placeholder(tf.float32, [None, 100])
n = tl.layers.InputLayer(x, name='in')
n = tl.layers.DenseLayer(n, n_units=80, name='d1')
n = tl.layers.DenseLayer(n, n_units=80, name='d2')
print(n)
n.print_layers()
n.print_params(False)
print(n.count_params())

if n.count_params() != 14560:
raise Exception("params do not match")
class Layer_Basic_Test(unittest.TestCase):
@classmethod
def setUpClass(cls):

x = tf.placeholder(tf.float32, [None, 100])
n = tl.layers.InputLayer(x, name='in')
n = tl.layers.DenseLayer(n, n_units=80, name='d1')
n = tl.layers.DenseLayer(n, n_units=80, name='d2')

n.print_layers()
n.print_params(False)

n2 = n[:, :30]
n2.print_layers()

cls.n_params = n.count_params()
cls.shape_n = n.outputs.get_shape().as_list()
cls.shape_n2 = n2.outputs.get_shape().as_list()
cls.all_layers = n.all_layers
cls.all_params = n.all_params

@classmethod
def tearDownClass(cls):
tf.reset_default_graph()

def test_n_params(self):
self.assertEqual(self.n_params, 14560)

def test_shape_n(self):
self.assertEqual(self.shape_n[-1], 80)

shape = n.outputs.get_shape().as_list()
if shape[-1] != 80:
raise Exception("shape do not match")
def test_all_layers(self):
self.assertEqual(len(self.all_layers), 2)

if len(n.all_layers) != 2:
raise Exception("layers do not match")
def test_all_params(self):
self.assertEqual(len(self.all_params), 4)

if len(n.all_params) != 4:
raise Exception("params do not match")
def test_shape_n2(self):
self.assertEqual(self.shape_n2[-1], 30)

for l in n:
print(l)

n2 = n[:, :30]
print(n2)
n2.print_layers()
if __name__ == '__main__':

shape = n2.outputs.get_shape().as_list()
if shape[-1] != 30:
raise Exception("shape do not match")
# tf.logging.set_verbosity(tf.logging.INFO)
tf.logging.set_verbosity(tf.logging.DEBUG)

for l in n2:
print(l)
unittest.main()
Loading