def METHOD_NAME(self, last_hidden_state, padding_mask):
    self.device = last_hidden_state.device
    batch_size = last_hidden_state.size()[0]
    seq_len = last_hidden_state.size()[1]
    outputs = self.dense(last_hidden_state)
    outputs = torch.split(outputs, self.inner_dim * 2, dim=-1)
    outputs = torch.stack(outputs, dim=-2)
    qw, kw = outputs[..., :self.inner_dim], outputs[
        ..., self.inner_dim:]  # TODO:修改为Linear获取？
    if self.RoPE:
        qw, kw = self.rope(batch_size, seq_len, self.inner_dim, qw, kw)
    # logits:(batch_size, ent_type_size, seq_len, seq_len)
    logits = torch.einsum('bmhd,bnhd->bhmn', qw, kw)
    # padding mask
    pad_mask = padding_mask.unsqueeze(1).unsqueeze(1).expand(
        batch_size, self.ent_type_size, seq_len, seq_len)
    logits = logits * pad_mask - (1 - pad_mask) * 1e12
    mask = torch.tril(torch.ones_like(logits), -1)
    logits = logits - mask * 1e12
    return logits / self.inner_dim**0.5