def METHOD_NAME(
    self,
    input: torch.LongTensor,
    positions: Optional[torch.LongTensor] = None,
    segments: Optional[torch.LongTensor] = None,
) -> Tuple[torch.Tensor, torch.BoolTensor]:
    """
    Embed tokens prior to feeding into transformer.
    :param LongTensor[batch,seqlen] input:
        The input IDs
    :param LongTensor[batch,seqlen] positions:
        Positions for input IDs
    :param LongTensor[batch,seqlen]:
        If provided, additionally adds ``segments`` as extra embedding features.
    :return (tensor, mask):
        return embedded input and mask
    """
    if self.n_positions_init is not None:
        mask = input != self.padding_idx
        if positions is None:
            positions = (mask.cumsum(dim=1, dtype=torch.int64) - 1).clamp_(min=0)
        positions = self.rearrange_positions(positions)  # type: ignore
    return super().METHOD_NAME(input, positions, segments)