プリンキピア

第10章現代のリカレントニューラルネットワーク

10.6.3. Putting the Encoder and Decoder Together10.6.3 エンコーダとデコーダを組み合わせる

In the forward propagation, the output of the encoder is used to produce the encoded state, and this state will be further used by the decoder as one of its input.
英語のヒント
順伝播では、エンコーダの出力を使って符号化された状態を生成し、この状態はさらにデコーダの入力の一つとして使われる。
class EncoderDecoder(d2l.Classifier):  #@save
    """The base class for the encoder--decoder architecture."""
    def __init__(self, encoder, decoder):
        super().__init__()
        self.encoder = encoder
        self.decoder = decoder

    def forward(self, enc_X, dec_X, *args):
        enc_all_outputs = self.encoder(enc_X, *args)
        dec_state = self.decoder.init_state(enc_all_outputs, *args)
        # Return decoder output only
        return self.decoder(dec_X, dec_state)[0]
In the next section, we will see how to apply RNNs to design sequence-to-sequence models based on this encoder–decoder architecture.
英語のヒント
次の節では、RNNを当てはめて、このエンコーダ・デコーダ構造にもとづく系列から系列へのモデルを設計する方法を見る。