with tf.variable_scope('LSTM') as vs:
    for i in range(num_steps):
        output[i], state = cell(input_data[i], state)
lstm_variables = [v for v in tf.all_variables() if v.name.startswith(vs.name)]
Tensorflow: как получить все переменные из rnn_cell.BasicLSTM и rnn_cell.MultiRNNCell