I spend days trying to figure out what is going on and I am still getting this error. here is the error I get
ValueError: Variable rnn/multi_rnn_cell/cell_1/basic_lstm_cell/weights does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?
And here is my sample code, does anyone know what I am doing wrong?
x = tf.placeholder(tf.float32,[None,n_steps,n_input])
y = tf.placeholder(tf.float32,[None,n_classes])
weights = {
'out': tf.Variable(tf.random_normal([n_hidden, n_classes]))
}
biases = {
'out': tf.Variable(tf.random_normal([n_classes]))
}
def RNN(x, weights, biases):
x = tf.unstack(x, n_steps, 1)
lstm_cell = rnn.MultiRNNCell([cell() for y in range(2)] , state_is_tuple=True)
# Get lstm cell output
outputs, states = rnn.static_rnn(lstm_cell, x, dtype=tf.float32)
# Linear activation, using rnn inner loop last output
return tf.matmul(outputs[-1], weights['out']) + biases['out']
def cell():
return rnn.BasicLSTMCell(n_hidden,forget_bias=0.1, reuse=True)
pred = RNN(x, weights, biases)