张量流中tf.contrib.rnn.BasicLSTMCell中构建函数的输入是什么

时间:2018-06-09 10:59:03

标签: tensorflow lstm rnn

我正在尝试初始化RNN单元的参数。为此,我认为我必须首先构建图层。那么我尝试使用BasicLSTMCell中的构建方法构建图层,但它给出了错误int object has no attribute value。请帮助我或给我另一种方法来初始化权重和偏差。

1 个答案:

答案 0 :(得分:0)

import tensorflow as tf   
my_cell = tf.contrib.rnn.BasicLSTMCell(num_units = 128) # 128 is the hidden dimension which is a hyperparameter to be choosen by you
# Note you have just declared the LSTM cell till now, they haven't been initialized.
# Do something with the LSTM
with tf.Session as sess:
    sess.run(tf.global_variables_initializer()) # This line is necessary for the LSTM's parameters (The Matrices and Bias vectors) to be initialized