keras で seq2seq を実装しています。
順々に出力値を生成していく際にforループでコードを書いています。
そのため、全系列を計算する時に予測時のパフォーマンスがかなり悪くなっている状況です。
以下、系列生成時のコードです。
なにか、改善策をご存知でしたらご教授願います。
decoder_output = np.zeros(1) decoder_input = np.zeros(1) for _ range(seq_len): input = [encoder_input, decoder_input] new_decoder_output = model(input).numpy() decoder_output = np.append(decoder_output, new_decoder_output[-1]) decoder_input = np.hstack([decoder_input, decoder_output[-1])
あなたの回答
tips
プレビュー