(self, inputs, mask)
return self.feed_forward(out)
Transformer Encoder Layer definition.

        Args:
            inputs (`FloatTensor`): `[batch_size x src_len x model_dim]`
            mask (`LongTensor`): `[batch_size x src_len x src_len]`

        Returns:
            (`FloatTensor`):

            * outputs `[batch_size x src_len x model_dim]`
Transformer Encoder Layer definition.
Transformer Encoder Layer definition .
def forward(self, inputs, mask):
        """
        Transformer Encoder Layer definition.

        Args:
            inputs (`FloatTensor`): `[batch_size x src_len x model_dim]`
            mask (`LongTensor`): `[batch_size x src_len x src_len]`

        Returns:
            (`FloatTensor`):

            * outputs `[batch_size x src_len x model_dim]`
        """
        input_norm = self.layer_norm(inputs)
        context, _ = self.self_attn(input_norm, input_norm, input_norm,
                                    mask=mask)
        out = self.dropout(context) + inputs
        return self.feed_forward(out)
def forward ( self , inputs , mask ) : input_norm = self . layer_norm ( inputs ) context , _ = self . self_attn ( input_norm , input_norm , input_norm , mask = mask ) out = self . dropout ( context ) + inputs return self . feed_forward ( out )