adbd89fd4be9e68100bf9a4ba9eed1e7fb2e4040,fairseq/model_parallel/modules/transformer_sentence_encoder_layer.py,ModelParallelTransformerSentenceEncoderLayer,forward,#ModelParallelTransformerSentenceEncoderLayer#Any#Any#Any#,49

Before Change


            need_weights=False,
            attn_mask=self_attn_mask,
        )
        x = F.dropout(x, p=self.dropout, training=self.training)
        x = residual + x

        residual = x
        x = self.final_layer_norm(x)
        x = self.activation_fn(self.fc1(x))
        x = F.dropout(x, p=self.activation_dropout, training=self.training)
        x = self.fc2(x)
        x = F.dropout(x, p=self.dropout, training=self.training)
        x = residual + x
        return x, None

After Change


        )

    def forward(
        self,
        x: torch.Tensor,
        self_attn_mask: torch.Tensor = None,
        self_attn_padding_mask: torch.Tensor = None,
    ):
        
        LayerNorm is applied either before or after the self-attention/ffn
        modules similar to the original Transformer imlementation.
        
        residual = x
        x = self.self_attn_layer_norm(x)
        x, attn = self.self_attn(
            query=x,
            key=x,
            value=x,
            key_padding_mask=self_attn_padding_mask,
            need_weights=False,
            attn_mask=self_attn_mask,
        )
        x = self.dropout_module(x)
        x = residual + x

        residual = x
        x = self.final_layer_norm(x)
        x = self.activation_fn(self.fc1(x))
        x = self.activation_dropout_module(x)
        x = self.fc2(x)
        x = self.dropout_module(x)
        x = residual + x
        return x, None
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 22

Instances


Project Name: pytorch/fairseq
Commit Name: adbd89fd4be9e68100bf9a4ba9eed1e7fb2e4040
Time: 2020-08-20
Author: myleott@fb.com
File Name: fairseq/model_parallel/modules/transformer_sentence_encoder_layer.py
Class Name: ModelParallelTransformerSentenceEncoderLayer
Method Name: forward


Project Name: pytorch/fairseq
Commit Name: 28876638114948711fd4bd4e350fdd6809013f1e
Time: 2020-07-08
Author: mari.fomicheva@gmail.com
File Name: fairseq/models/fconv_self_att.py
Class Name: FConvDecoder
Method Name: forward


Project Name: pytorch/fairseq
Commit Name: 28876638114948711fd4bd4e350fdd6809013f1e
Time: 2020-07-08
Author: mari.fomicheva@gmail.com
File Name: fairseq/models/lightconv.py
Class Name: LightConvDecoderLayer
Method Name: forward


Project Name: pytorch/fairseq
Commit Name: 28876638114948711fd4bd4e350fdd6809013f1e
Time: 2020-07-08
Author: mari.fomicheva@gmail.com
File Name: fairseq/modules/transformer_sentence_encoder_layer.py
Class Name: TransformerSentenceEncoderLayer
Method Name: forward