code: def rotaryembeddings(dim: int, maxseqlen=2048, base=10000):
      inv_freq = 1.0 / (base ** (torch.arange(0, dim, 2).float() / dim))
      tmax = torch.arange(maxseqlen, device=inv_freq.device)
      rope = torch.outer(tmax, inv_freq).float()
      # rope is now matrix [maxseqlen, dim/2]
      rope = torch.polar(torch.ones_like(rope), rope)
      rope = torch.cat((rope, rope), dim=1)
      return rope
  
imports: import torch
  import torch.nn
  from math import log, sqrt
  from torch import Tensor
  from typing import Optional, Tuple
  from torch.nn.functional import scaled_dot_product_attention
  from torch.utils.checkpoint import checkpoint
  from torch.nn.utils import skip_init
  from .alibi_position_bias import AlibiPositionalBias
  from torch.distributed import all_reduce
  from importlib import import_module
label_desc: Use image node_id 1 for calling a global function with example usage: rotaryembeddings(dim, maxseqlen, base) and returns: rope