src/transformers/models/oneformer/modeling_oneformer.py/OneFormerTransformerDecoderSelfAttentionLayer/forward_pre
class OneFormerTransformerDecoderSelfAttentionLayer:    def forward_pre(
        self,
        output,
        output_mask: Optional[Tensor] = None,
        output_key_padding_mask: Optional[Tensor] = None,
        query_pos: Optional[Tensor] = None,
    ):
        output2 = self.norm(output)
        output2, attention_weights = self.self_attn(
            hidden_states=output2, position_embeddings=query_pos, attention_mask=output_mask, output_attentions=True
        )
        output = output + self.dropout(output2)

        return output, attention_weights