(
        token_representations: torch.FloatTensor)
return mask
Takes the dictionary of tensors produced by a ``ListField[MetadataField]``
    and returns a mask with 0 where the tokens are padding, and 1 otherwise.

    Parameters
    ----------
    token_representations : torch.FloatTensor
        A padded tensor of shape (batch_size, seq_len, representation_dim),
        with the represenatations of the tokens.
Takes the dictionary of tensors produced by a ``ListField[MetadataField]``
    and returns a mask with 0 where the tokens are padding, and 1 otherwise.
Takes the dictionary of tensors produced by a ListField [ MetadataField ] and returns a mask with 0 where the tokens are padding and 1 otherwise .
def get_text_mask_from_representations(
        token_representations: torch.FloatTensor) -> torch.LongTensor:
    """
    Takes the dictionary of tensors produced by a ``ListField[MetadataField]``
    and returns a mask with 0 where the tokens are padding, and 1 otherwise.

    Parameters
    ----------
    token_representations : torch.FloatTensor
        A padded tensor of shape (batch_size, seq_len, representation_dim),
        with the represenatations of the tokens.
    """
    mask = (torch.sum(token_representations, dim=-1) != 0).long()
    assert mask.dim() == 2
    return mask
def get_text_mask_from_representations ( token_representations : torch . FloatTensor ) -> torch . LongTensor : mask = ( torch . sum ( token_representations , dim = - 1 ) != 0 ) . long ( ) assert mask . dim ( ) == 2 return mask