def METHOD_NAME(self, x: PaddedBatch):
    B, T, H = x.payload.size()
    device = x.device
    if self.training and self.use_start_random_shift:
        start_pos = random.randint(0, self.max_position_embeddings - T - 1)
    else:
        start_pos = 0
    inputs_embeds = torch.cat([
        self.token_cls.expand(B, 1, H),
        x.payload,
    ], dim=1)
    attention_mask = torch.cat([
        torch.ones(B, 1, device=device),
        x.seq_len_mask.float(),
    ], dim=1)
    if self.use_positional_encoding:
        position_ids = torch.arange(T, device=device, dtype=torch.long).view(1, -1).expand(B, T) + 1 + start_pos
    else:
        position_ids = torch.zeros(B, T, device=device, dtype=torch.long)
    position_ids = torch.cat([
        torch.zeros(B, 1, device=device, dtype=torch.long),
        position_ids,
    ], dim=1)
    global_attention_mask = torch.cat([
        torch.ones(B, 1, device=device, dtype=torch.long),
        torch.zeros(B, T, device=device, dtype=torch.long),
    ], dim=1)
    out = self.transf(
        inputs_embeds=inputs_embeds,
        attention_mask=attention_mask,
        position_ids=position_ids,
        global_attention_mask=global_attention_mask,
    ).last_hidden_state
    if self.is_reduce_sequence:
        return out[:, 0, :]
    else:
        if self.add_cls_output:
            return PaddedBatch(out[:, 1:, :], x.seq_lens), out[:, 0, :]
        else:
            return PaddedBatch(out[:, 1:, :], x.seq_lens)