Skip to content

Commit 8b2eaa4

Browse files
committed
[layers] bidynamicrnn, out_dropout_keep
1 parent e56c34a commit 8b2eaa4

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

tensorlayer/layers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4739,6 +4739,13 @@ def __init__(
47394739
# cell_instance_fn=lambda: MultiRNNCell_fn([cell_instance_fn2() for _ in range(n_layer)])
47404740
self.fw_cell = MultiRNNCell_fn([cell_creator() for _ in range(n_layer)])
47414741
self.bw_cell = MultiRNNCell_fn([cell_creator() for _ in range(n_layer)])
4742+
4743+
if dropout:
4744+
self.fw_cell = DropoutWrapper_fn(self.fw_cell,
4745+
input_keep_prob=1.0, output_keep_prob=out_keep_prob)
4746+
self.bw_cell = DropoutWrapper_fn(self.bw_cell,
4747+
input_keep_prob=1.0, output_keep_prob=out_keep_prob)
4748+
47424749
# self.fw_cell=cell_instance_fn()
47434750
# self.bw_cell=cell_instance_fn()
47444751
# Initial state of RNN

tensorlayer/ops.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,24 +43,23 @@ def exit_tf(sess=None, port=6006):
4343
# TODO
4444
else:
4545
print(text2 + _platform)
46-
46+
4747
def open_tb(logdir='/tmp/tensorflow', port=6006):
48-
"""Open tensorboard
49-
48+
"""Open Tensorboard.
49+
5050
Parameters
5151
----------
5252
logdir : a string
5353
Directory where your tensorboard logs are saved
5454
port : an integer
5555
TensorBoard port you want to open, 6006 is tensorboard default
5656
"""
57-
5857
text = "[tl] Open tensorboard, go to localhost:" + str(port) + " to access"
5958
text2 = " not yet supported by this function (tl.ops.open_tb)"
60-
59+
6160
if not tl.files.exists_or_mkdir(logdir, verbose=False):
6261
print("[tl] Log reportory was created at %s" % logdir)
63-
62+
6463
if _platform == "linux" or _platform == "linux2":
6564
print('linux %s' % text2)
6665
# TODO

0 commit comments

Comments
 (0)