Skip to content
Merged
Changes from all commits
Commits
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
17 changes: 14 additions & 3 deletions tensorlayer/layers.py
Original file line number Diff line number Diff line change
Expand Up @@ -4678,12 +4678,23 @@ def sampled_loss(inputs, labels):

# ============ Seq Encode Layer =============
# Create the internal multi-layer cell for our RNN.
single_cell = tf.nn.rnn_cell.GRUCell(size)
try: # TF1.0
single_cell = tf.contrib.rnn.GRUCell(size)
except:
single_cell = tf.nn.rnn_cell.GRUCell(size)

if use_lstm:
single_cell = tf.nn.rnn_cell.BasicLSTMCell(size)
try: # TF1.0
single_cell = tf.contrib.rnn.BasicLSTMCell(size)
except:
single_cell = tf.nn.rnn_cell.BasicLSTMCell(size)

cell = single_cell
if num_layers > 1:
cell = tf.nn.rnn_cell.MultiRNNCell([single_cell] * num_layers)
try: # TF1.0
cell = tf.contrib.rnn.MultiRNNCell([single_cell] * num_layers)
except:
cell = tf.nn.rnn_cell.MultiRNNCell([single_cell] * num_layers)

# ============== Seq Decode Layer ============
# The seq2seq function: we use embedding for the input and attention.
Expand Down