def METHOD_NAME(
    self,
    prev_output_tokens,
    incremental_state: Optional[Dict[str, List[torch.Tensor]]] = None,
):
    if incremental_state:
        past = self.get_incremental_state("past")
    else:
        past = None
    # don't attend to padding symbols
    attention_mask = prev_output_tokens.ne(self.pad_idx).int()
    # set position ids to exclude padding symbols
    position_ids = attention_mask * (
        torch.arange(1, 1 + prev_output_tokens.size(1))
        .to(prev_output_tokens)
        .repeat(prev_output_tokens.size(0), 1)
    )
    outputs = self.model.transformer(
        input_ids=prev_output_tokens,
        past=past,
        attention_mask=attention_mask,
        position_ids=position_ids,
    )
    last_hidden_states = outputs[0]
    if incremental_state:
        self.set_incremental_state(incremental_state, "past", outputs[1])
    return last_hidden_states