braindecode.functional.rotary_frequencies#

braindecode.functional.rotary_frequencies(head_dim, base=10000.0, device=None, dtype=torch.float32)[source]#

Inverse frequencies of a rotary embedding, 1 / base ** (2 i / head_dim).

Parameters:
  • head_dim (int) – Even feature dimension that is rotated.

  • base (float) – Base period (theta).

  • device (Optional[device])

  • dtype (dtype) – Precision of the table; the angles inherit it.

Returns:

Shape (head_dim // 2,).

Return type:

Tensor