Sae*_*eed 10 tensorflow recurrent-neural-network
我曾经使用以下方法在TensorFlow的0.8版本中创建RNN网络:
from tensorflow.python.ops import rnn
# Define a lstm cell with tensorflow
lstm_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0)
# Get lstm cell output
outputs, states = rnn.rnn(cell=lstm_cell, inputs=x, dtype=tf.float32)
Run Code Online (Sandbox Code Playgroud)
rnn.rnn()不再可用了,听起来它已被移动到tf.contrib.创建RNN网络的确切代码是BasicLSTMCell什么?
或者,如果我有一个堆叠的LSTM,
lstm_cell = tf.contrib.rnn.BasicLSTMCell(hidden_size, forget_bias=0.0)
stacked_lstm = tf.contrib.rnn.MultiRNNCell([lstm_cell] * num_layers)
outputs, new_state = tf.nn.rnn(stacked_lstm, inputs, initial_state=_initial_state)
Run Code Online (Sandbox Code Playgroud)
tf.nn.rnn在新版本的TensorFlow中有什么替代品?
ruo*_*tsi 13
tf.nn.rnn相当于tf.nn.static_rnn.
注:前TensorFlow的1.2版本,该命名空间 tf.nn.static_rnn是不存在的,但只有tf.contrib.rnn.static_rnn(现在是一个别名为tf.nn.static_rnn).
| 归档时间: |
|
| 查看次数: |
5809 次 |
| 最近记录: |