code: def __init__(
      self, dim, max_position_embeddings=2048, base=10000, device=None
  ):
      super().__init__()
  
      self.dim = dim
      self.max_position_embeddings = max_position_embeddings
      self.base = base
      inv_freq = 1.0 / (
          self.base
          ** (
              torch.arange(0, self.dim, 2).float().to(device) / self.dim
          )
      )
      self.register_buffer("inv_freq", inv_freq, persistent=False)
  
      # Build here to make `torch.jit.trace` work.
      self._set_cos_sin_cache(
          seq_len=max_position_embeddings,
          device=self.inv_freq.device,
          dtype=torch.get_default_dtype(),
      )
  
imports: import math
  from typing import Optional
  import pytest
  import torch
  import torch.utils.checkpoint
  from helpers import assert_similar, random_tensor
  from torch import nn
  from quanto import Calibration, quantize
label_desc: Use image node_id 1 to create a new RotaryEmbedding object from inherited base classes: nn with example: obj = RotaryEmbedding(dim, max_position_embeddings, base, device)