def METHOD_NAME(self, x: torch.Tensor) -> torch.Tensor:
    """Compute rotary positional embeddings.
    Args:
        x: Input sequence. (L, size)
    Returns:
        x: Rotary positional embeddings.  (L, size)
    """
    length, dim = x.size()
    x1, x2 = torch.chunk(x, 2, dim=-1)
    if self.sine is None or length > self.sine.size(0):
        self.sine, self.cosine = RotaryRelativePositionBias.get_sinusoid_embeddings(
            length, dim
        )
        self.max_positions = length
    self.sine = self.sine.to(self._pe)
    self.cosine = self.cosine.to(self._pe)
    sin = self.sine[:length]
    cos = self.cosine[:length]
    x = torch.cat([x1 * cos - x2 * sin, x2 * cos + x1 * sin], dim=1)
    return x