4fed0beca64a52aa718371dc3b2cf1fd979197a4,fairseq/models/wav2vec/wav2vec2.py,Wav2Vec2Model,forward,#Wav2Vec2Model#Any#Any#Any#Any#,446

Before Change


        unmasked_features = features.clone()

        if padding_mask is not None:
            extra = padding_mask.size(1) % features.size(1)
            if extra > 0:
                padding_mask = padding_mask[:, :-extra]
            padding_mask = padding_mask.view(padding_mask.size(0), features.size(1), -1)
            padding_mask = padding_mask.all(-1)

After Change


            // these two operations makes sure that all values
            // before the output lengths indices are attended to
            padding_mask[(torch.arange(padding_mask.shape[0], device=padding_mask.device), output_lengths - 1)] = 1
            padding_mask = (1 - padding_mask.flip([-1]).cumsum(-1).flip([-1])).bool()

        if self.post_extract_proj is not None:
            features = self.post_extract_proj(features)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: pytorch/fairseq
Commit Name: 4fed0beca64a52aa718371dc3b2cf1fd979197a4
Time: 2021-02-10
Author: patrick.v.platen@gmail.com
File Name: fairseq/models/wav2vec/wav2vec2.py
Class Name: Wav2Vec2Model
Method Name: forward


Project Name: facebookresearch/ParlAI
Commit Name: a43f2880719c5a048fdf3d0aa5d5b25eeb9a1a41
Time: 2019-03-06
Author: roller@fb.com
File Name: parlai/agents/transformer/modules.py
Class Name: TransformerEncoder
Method Name: forward


Project Name: maciejkula/spotlight
Commit Name: 70e4d7fe60a9658bb27b9f5fb67592a1222b2ec3
Time: 2017-07-06
Author: maciej.kula@gmail.com
File Name: spotlight/sequence/representations.py
Class Name: PoolNet
Method Name: user_representation