Skip to content

Commit ed8a4ab

Browse files
author
DEKHTIARJonathan
committed
1 parent 96a8adb commit ed8a4ab

33 files changed

+369
-64
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ To release a new version, please update the changelog as followed:
7878
- `Layer_DeformableConvolution_Test` added to reproduce issue #572 with deformable convolution (by @DEKHTIARJonathan in #573)
7979
- `Array_Op_Alphas_Test` and `Array_Op_Alphas_Like_Test` added to test `tensorlayer/array_ops.py` file (by @DEKHTIARJonathan in #580)
8080
- `test_optimizer_amsgrad.py` added to test `AMSGrad` optimizer (by @DEKHTIARJonathan in #636)
81+
- `test_logging.py` added to insure robustness of the logging API (by @DEKHTIARJonathan in #645)
8182
- CI Tool:
8283
- [Stale Probot](https://github.com/probot/stale) added to clean stale issues (by @DEKHTIARJonathan in #573)
8384
- [Changelog Probot](https://github.com/mikz/probot-changelog) Configuration added (by @DEKHTIARJonathan in #637)
@@ -97,6 +98,7 @@ To release a new version, please update the changelog as followed:
9798
- RTD links point to stable documentation instead of latest used for development (by @DEKHTIARJonathan in #633)
9899
- TF Version older than 1.6.0 are officially unsupported and raises an exception (by @DEKHTIARJonathan in #644)
99100
- Readme Badges Updated with Support Python and Tensorflow Versions (by @DEKHTIARJonathan in #644)
101+
- TL logging API has been consistent with TF logging API and thread-safe (by @DEKHTIARJonathan in #645)
100102

101103
### Deprecated
102104

setup.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
import os
33
import codecs
44

5+
os.environ['TENSORLAYER_PACKAGE_BUILDING'] = 'True'
6+
57
try:
68
from setuptools import (
79
setup,

tensorlayer/__init__.py

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,18 @@
33
"""Deep learning and Reinforcement learning library for Researchers and Engineers"""
44
from __future__ import absolute_import
55

6-
try:
7-
import tensorflow
6+
import os
7+
8+
if 'TENSORLAYER_PACKAGE_BUILDING' not in os.environ:
9+
10+
try:
11+
import tensorflow
12+
except Exception as e:
13+
raise ImportError(
14+
"Tensorflow is not installed, please install it with the one of the following commands:\n"
15+
" - `pip install --upgrade tensorflow`\n"
16+
" - `pip install --upgrade tensorflow-gpu`"
17+
)
818

919
if tensorflow.__version__ < "1.6.0":
1020
raise RuntimeError(
@@ -21,6 +31,7 @@
2131
from . import files
2232
from . import iterate
2333
from . import layers
34+
from . import tl_logging as logging
2435
from . import models
2536
from . import nlp
2637
from . import optimizers
@@ -40,15 +51,6 @@
4051
global_flag = {}
4152
global_dict = {}
4253

43-
except Exception as e:
44-
45-
import pkg_resources
46-
installed_packages = [d for d in pkg_resources.working_set]
47-
48-
for package in installed_packages:
49-
if 'tensorlayer' in package.project_name and 'site-packages' in package.location:
50-
raise ImportError("__init__.py : Could not import TensorLayer.\nError: {}".format(e))
51-
5254
# Use the following formating: (major, minor, patch, prerelease)
5355
VERSION = (1, 8, 5)
5456
__shortversion__ = '.'.join(map(str, VERSION[:3]))

tensorlayer/_logging.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

tensorlayer/deprecation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import functools
55
import warnings
66

7-
from . import _logging as logging
7+
from . import tl_logging as logging
88

99

1010
def deprecated_alias(end_support_version, **aliases):

tensorlayer/files.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from six.moves import cPickle, zip
1717
from tensorflow.python.platform import gfile
1818

19-
from . import _logging as logging
19+
from . import tl_logging as logging
2020
from . import nlp, utils, visualize
2121

2222
__all__ = [

tensorlayer/layers/__init__.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,21 @@
77
More functions can be found in `TensorFlow API <https://www.tensorflow.org/versions/master/api_docs/index.html>`__.
88
"""
99

10-
from .core import *
11-
from .convolution import *
1210
from .binary import *
13-
from .super_resolution import *
11+
from .convolution import *
12+
from .core import *
13+
from .extend import *
14+
from .flow_control import *
15+
from .importer import *
16+
from .merge import *
1417
from .normalization import *
15-
from .spatial_transformer import *
1618
from .object_detection import *
17-
from .time_distribution import *
18-
from .pooling import *
1919
from .padding import *
20+
from .pooling import *
2021
from .recurrent import *
2122
from .shape import *
22-
from .importer import *
23-
from .merge import *
24-
from .extend import *
25-
from .stack import *
23+
from .spatial_transformer import *
2624
from .special_activation import *
27-
from .flow_control import *
25+
from .stack import *
26+
from .super_resolution import *
27+
from .time_distribution import *

tensorlayer/layers/binary.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
import tensorflow as tf
33

4-
from .. import _logging as logging
4+
from .. import tl_logging as logging
55
from .core import *
66

77
from ..deprecation import deprecated_alias

tensorlayer/layers/convolution.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import tensorflow as tf
44

5-
from .. import _logging as logging
5+
from .. import tl_logging as logging
66
from .core import *
77

88
from ..deprecation import deprecated_alias

tensorlayer/layers/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import tensorflow as tf
99
from tensorflow.python.util.deprecation import deprecated
1010

11-
from .. import _logging as logging
11+
from .. import tl_logging as logging
1212
from .. import files, iterate, utils, visualize
1313

1414
from ..deprecation import deprecated_alias

0 commit comments

Comments
 (0)