(self, size)
return subsequent_mask
Get an attention mask to avoid using the subsequent info.

        Args:
            size: int

        Returns:
            (`LongTensor`):

            * subsequent_mask `[1 x size x size]`
Get an attention mask to avoid using the subsequent info.
Get an attention mask to avoid using the subsequent info .
def _get_attn_subsequent_mask(self, size):
        """
        Get an attention mask to avoid using the subsequent info.

        Args:
            size: int

        Returns:
            (`LongTensor`):

            * subsequent_mask `[1 x size x size]`
        """
        attn_shape = (1, size, size)
        subsequent_mask = np.triu(np.ones(attn_shape), k=1).astype('uint8')
        subsequent_mask = torch.from_numpy(subsequent_mask)
        return subsequent_mask
def _get_attn_subsequent_mask ( self , size ) : attn_shape = ( 1 , size , size ) subsequent_mask = np . triu ( np . ones ( attn_shape ) , k = 1 ) . astype ( 'uint8' ) subsequent_mask = torch . from_numpy ( subsequent_mask ) return subsequent_mask