optimum/graphcore/models/bart/modeling_bart.py
def _make_causal_mask(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0):
    """Makes causal mask used for bi-directional self-attention.
    This differs from the original implementation by:
        - Making the mask creation simpler in terms of operations used
        - Changing the value for tokens to mask to something compatible with fp16
        - Not expanding the final mask to [bsz, 1, tgt_len, src_len]
    """
    bsz, tgt_len = input_ids_shape
    mask = torch.full((tgt_len, tgt_len), -FLOAT16_LIMIT)
    mask = torch.triu(mask, diagonal=1)
    return mask[None, None, :, :]
Makes causal mask used for bi-directional self-attention.
    This differs from the original implementation by:
        - Making the mask creation simpler in terms of operations used
        - Changing the value for tokens to mask to something compatible with fp16
        - Not expanding the final mask to [bsz, 1, tgt_len, src_len]
    
Makes causal mask used for bi-directional self-attention.
This differs from the original implementation by:
Making the mask creation simpler in terms of operations used
Changing the value for tokens to mask to something compatible with fp16
Not expanding the final mask to [bsz, 1, tgt_len, src_len]
Makes causal mask used for bi - directional self - attention . This differs from the original implementation by : Making the mask creation simpler in terms of operations used Changing the value for tokens to mask to something compatible with fp16 Not expanding the final mask to [ bsz 1 tgt_len src_len ]
def _make_causal_mask(input_ids_shape: torch.Size, dtype: torch.dtype, past_key_values_length: int = 0):
    bsz, tgt_len = input_ids_shape
    mask = torch.full((tgt_len, tgt_len), -FLOAT16_LIMIT)
    mask = torch.triu(mask, diagonal=1)
    return mask[None, None, :, :]
def _make_causal_mask ( input_ids_shape : torch . Size , dtype : torch . dtype , past_key_values_length : int = 0 ) : bsz , tgt_len = input_ids_shape mask = torch . full ( ( tgt_len , tgt_len ) , - FLOAT16_LIMIT ) mask = torch . triu ( mask , diagonal = 1 ) return mask [ None , None , : , : ]
Makes causal mask used for bi-directional self-attention.
Makes causal mask used for bi - directional self - attention .
"""Makes causal mask used for bi-directional self-attention.
    This differs from the original implementation by:
        - Making the mask creation simpler in terms of operations used
        - Changing the value for tokens to mask to something compatible with fp16
        - Not expanding the final mask to [bsz, 1, tgt_len, src_len]
    """
input_ids_shape
torch.Size
dtype
torch.dtype
past_key_values_length
int