code: def __init__(
      self,
      dim,
      base=10000,
      distance_scale: Union[int, float] = 1,
      dtype: torch.dtype = torch.half,
  ):
      super().__init__()
      inv_freq = 1.0 / (
          base
          ** (
              torch.arange(
                  0, dim, 2, device="cuda", dtype=torch.float32
              )
              / dim
          )
      )
      inv_freq = inv_freq.to(dtype)
      self.distance_scale = distance_scale
      self.dtype = dtype
      self.inv_freq = inv_freq
  
file_path: DeepKE/example/llm/CPM-Bee/src/cpm_live/native_layers/position_embedding.py
imports: import math
  from typing import Union
  import torch
  import torch.nn.functional
label_desc: Use image node_id 1 to create a new RotaryEmbedding object from inherited base classes: torch.nn with example: obj = RotaryEmbedding(dim, base, distance_scale, dtype)