0
のすべての出力でのクロスエントロピーを計算します。 しかし、LSTMのすべての出力でクロスエントロピーを計算する方法はわかりません。 私のプログラムの一部です。は私がLSTMを使用して分類問題のプログラムを書いていますLSTM
cell_fw = tf.nn.rnn_cell.LSTMCell(num_hidden)
cell_bw = tf.nn.rnn_cell.LSTMCell(num_hidden)
outputs, _ = tf.nn.bidirectional_dynamic_rnn(cell_fw,cell_bw,inputs = inputs3, dtype=tf.float32,sequence_length= seq_len)
outputs = tf.concat(outputs,axis=2)
#outputs [batch_size,max_timestep,num_features]
outputs = tf.reshape(outputs, [-1, num_hidden*2])
W = tf.Variable(tf.truncated_normal([num_hidden*2,
num_classes],
stddev=0.1))
b = tf.Variable(tf.constant(0., shape=[num_classes]))
logits = tf.matmul(outputs, W) + b
は、どのように私はこれにcrossentropyエラーを適用することができますか? 各バッチのmax_timestepの数と同じクラスを表すベクトルを作成し、その誤差を計算する必要がありますか?