【发布时间】:2016-10-01 14:02:27
【问题描述】:
我想在基于 LSTM 的 RNN 中使用占位符来表示丢失率、隐藏单元数和层数。以下是我目前正在尝试的代码。
dropout_rate = tf.placeholder(tf.float32)
n_units = tf.placeholder(tf.uint8)
n_layers = tf.placeholder(tf.uint8)
net = rnn_cell.BasicLSTMCell(n_units)
net = rnn_cell.DropoutWrapper(net, output_keep_prob = dropout_rate)
net = rnn_cell.MultiRNNCell([net] * n_layers)
最后一行给出以下错误:
TypeError: Expected uint8, got <tensorflow.python.ops.rnn_cell.DropoutWrapper
object ... of type 'DropoutWrapper' instead.
我将不胜感激。
【问题讨论】:
标签: tensorflow lstm recurrent-neural-network