e2f66c0de2600308044ec3ab7731dae9017378fa,allennlp/modules/seq2seq_encoders/bidirectional_language_model_transformer.py,,subsequent_mask,#Any#Any#,40

Before Change


    Mask out subsequent positions.
    attn_shape = (1, size, size)
    mask = np.triu(np.ones(attn_shape), k=1).astype("uint8")
    mask = (torch.from_numpy(mask) == 0)
    return mask.to(device)


class PositionalEncoding(torch.nn.Module):

After Change



def subsequent_mask(size: int, device: str = "cpu") -> torch.Tensor:
    Mask out subsequent positions.
    mask = torch.tril(torch.ones(size, size, device=device, dtype=torch.int32)).unsqueeze(0)
    return mask


class PositionalEncoding(torch.nn.Module):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: allenai/allennlp
Commit Name: e2f66c0de2600308044ec3ab7731dae9017378fa
Time: 2018-12-20
Author: vidurj@allenai.org
File Name: allennlp/modules/seq2seq_encoders/bidirectional_language_model_transformer.py
Class Name:
Method Name: subsequent_mask


Project Name: ncullen93/torchsample
Commit Name: 42418e10a68f534b939a125a9ccd60167f9a6633
Time: 2017-04-18
Author: ncullen@modv-vlan533.0292.apn.wlan.wireless-pennnet.upenn.edu
File Name: torchsample/transforms/torch_transforms.py
Class Name: AddChannel
Method Name: __call__


Project Name: eriklindernoren/PyTorch-YOLOv3
Commit Name: b591a7aecce5b8de42a0dd7bba62780675d34fce
Time: 2019-04-30
Author: eriklindernoren@live.se
File Name: utils/datasets.py
Class Name: ImageFolder
Method Name: __getitem__