(self, src, lengths=None)
return encoder_final, memory_bank
See :obj:`EncoderBase.forward()`
See :obj:`EncoderBase.forward()`
See : obj : EncoderBase . forward ()
def forward(self, src, lengths=None):
        "See :obj:`EncoderBase.forward()`"
        self._check_args(src, lengths)

        emb = self.embeddings(src)
        _, batch, emb_dim = emb.size()
        mean = emb.mean(0).expand(self.num_layers, batch, emb_dim)
        memory_bank = emb
        encoder_final = (mean, mean)
        return encoder_final, memory_bank
def forward ( self , src , lengths = None ) : self . _check_args ( src , lengths ) emb = self . embeddings ( src ) _ , batch , emb_dim = emb . size ( ) mean = emb . mean ( 0 ) . expand ( self . num_layers , batch , emb_dim ) memory_bank = emb encoder_final = ( mean , mean ) return encoder_final , memory_bank