私は入力として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。