def METHOD_NAME(self, ilens):
    """Make masks for self-attention.
    Args:
        ilens (LongTensor or List): Batch of lengths (B,).
    Returns:
        Tensor: Mask tensor for self-attention.
                dtype=torch.uint8 in PyTorch 1.2-
                dtype=torch.bool in PyTorch 1.2+ (including 1.2)
    Examples:
        >>> ilens = [5, 3]
        >>> self._source_mask(ilens)
        tensor([[[1, 1, 1, 1, 1],
                [[1, 1, 1, 0, 0]]], dtype=torch.uint8)
    """
    x_masks = make_non_pad_mask(ilens).to(next(self.parameters()).device)
    return x_masks.unsqueeze(-2)