Skip to content

Commit 46eeca1

Browse files
committed
remove supress stdout as we have changed to logging
1 parent 438f824 commit 46eeca1

File tree

2 files changed

+7
-33
lines changed

2 files changed

+7
-33
lines changed

tensorlayer/layers/time_distribution.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,14 +61,13 @@ def __init__(
6161
timestep = input_shape[1]
6262
x = tf.unstack(self.inputs, axis=1)
6363

64-
with utils.suppress_stdout():
65-
for i in range(0, timestep):
66-
with tf.variable_scope(name, reuse=(set_keep['name_reuse'] if i == 0 else True)) as vs:
67-
set_name_reuse((set_keep['name_reuse'] if i == 0 else True))
68-
net = layer_class(InputLayer(x[i], name=args['name'] + str(i)), **args)
69-
# net = layer_class(InputLayer(x[i], name="input_"+args['name']), **args)
70-
x[i] = net.outputs
71-
variables = tf.get_collection(TF_GRAPHKEYS_VARIABLES, scope=vs.name)
64+
for i in range(0, timestep):
65+
with tf.variable_scope(name, reuse=(set_keep['name_reuse'] if i == 0 else True)) as vs:
66+
set_name_reuse((set_keep['name_reuse'] if i == 0 else True))
67+
net = layer_class(InputLayer(x[i], name=args['name'] + str(i)), **args)
68+
# net = layer_class(InputLayer(x[i], name="input_"+args['name']), **args)
69+
x[i] = net.outputs
70+
variables = tf.get_collection(TF_GRAPHKEYS_VARIABLES, scope=vs.name)
7271

7372
self.outputs = tf.stack(x, axis=1, name=name)
7473

tensorlayer/utils.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -617,28 +617,3 @@ def set_gpu_fraction(gpu_fraction=0.3):
617617
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_fraction)
618618
sess = tf.Session(config=tf.ConfigProto(gpu_options=gpu_options))
619619
return sess
620-
621-
622-
@contextmanager
623-
def suppress_stdout():
624-
"""Temporarily disable console output.
625-
626-
Examples
627-
---------
628-
>>> print("You can see me")
629-
>>> with tl.utils.suppress_stdout():
630-
>>> print("You can't see me")
631-
>>> print("You can see me")
632-
633-
References
634-
-----------
635-
- `Stack Overflow <http://stackoverflow.com/questions/2125702/how-to-suppress-console-output-in-python>`__
636-
637-
"""
638-
with open(os.devnull, "w") as devnull:
639-
old_stdout = sys.stdout
640-
sys.stdout = devnull
641-
try:
642-
yield
643-
finally:
644-
sys.stdout = old_stdout

0 commit comments

Comments
 (0)