나는 각각 3 차원의 3 개의 시계열을 가지고 RNN 분류기를 만들려고하는데, 시계열은 길이가 다를 수 있습니다. 그래서이를 해결하기 위해 3 개의 RNN을 모델링하여 최종 레이어에 연결했습니다. 어떻게해야, 재사용이 옵션을 선택하지 않습니다 그래서tensorflow에서 독립적 인 LSTM 셀을 만드는 방법은 무엇입니까?
ValueError: Variable rnn/multi_rnn_cell/cell_0/basic_lstm_cell/kernel already exists, disallowed. Did you mean to set reuse=True in VarScope?
timeSeries = ['outbound', 'rest', 'return']
n_steps = {
'outbound': 3159,
'rest': 3603,
'return': 3226
}
n_inputs = 3
n_neurons = 20
n_outputs = 2
n_layers = 1
learning_rate = 0.001
y = tf.placeholder(tf.int32, [None], name="y")
X = {}
seq_length = {}
for timeSeriesName in timeSeries:
with tf.name_scope(timeSeriesName + "_placeholders") as scope:
X[timeSeriesName] = tf.placeholder(tf.float32, [None, n_steps[timeSeriesName], n_inputs])
seq_length[timeSeriesName] = tf.placeholder(tf.int32, [None])
outputs = {}
states = {}
top_layer_h_state = {}
lstm_cells = {}
multi_cell = {}
finalRNNlayers = []
for timeSeriesName in timeSeries:
with tf.name_scope(timeSeriesName) as scope:
lstm_cells[timeSeriesName] = [tf.contrib.rnn.BasicLSTMCell(num_units=n_neurons)
for layer in range(n_layers)]
multi_cell[timeSeriesName] = tf.contrib.rnn.MultiRNNCell(lstm_cells[timeSeriesName])
outputs[timeSeriesName], states[timeSeriesName] = tf.nn.dynamic_rnn(
multi_cell[timeSeriesName], X[timeSeriesName], dtype=tf.float32,
sequence_length=seq_length[timeSeriesName])
top_layer_h_state[timeSeriesName] = states[timeSeriesName][-1][1]
finalRNNlayers.append(top_layer_h_state[timeSeriesName])
with tf.name_scope("3Stages_mixed") as scope:
concat3_top_layer_h_states = tf.concat(finalRNNlayers, axis=1)
logits = tf.layers.dense(concat3_top_layer_h_states, n_outputs, name="softmax")
내가 때마다 시리즈는 자신의 무게를 각각 독립적 LSTM 세포를 갖고 싶어 :
그러나, 나는 다음과 같은 오류 메시지가 무엇입니까 이 오류가 수정 되었습니까?
The full traceback of the error can be found here.