def METHOD_NAME(self, batch_size, seq_len, dim, qw, kw):
    # pos_emb:(batch_size, seq_len, inner_dim)
    pos_emb = self.sinusoidal_position_embedding(batch_size, seq_len, dim)
    # cos_pos,sin_pos: (batch_size, seq_len, 1, inner_dim)
    cos_pos = pos_emb[..., None, 1::2].repeat_interleave(2, dim=-1)
    sin_pos = pos_emb[..., None, ::2].repeat_interleave(2, dim=-1)
    qw2 = torch.stack([-qw[..., 1::2], qw[..., ::2]], -1)
    qw2 = qw2.reshape(qw.shape)
    qw = qw * cos_pos + qw2 * sin_pos
    kw2 = torch.stack([-kw[..., 1::2], kw[..., ::2]], -1)
    kw2 = kw2.reshape(kw.shape)
    kw = kw * cos_pos + kw2 * sin_pos
    return qw, kw