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 List, Optional, Tuple, Union
  import torch
  import torch.utils.checkpoint
  from torch import nn
  from torch.nn import BCEWithLogitsLoss, CrossEntropyLoss, MSELoss
  from ...activations import ACT2FN
  from ...cache_utils import Cache, DynamicCache
  from ...modeling_attn_mask_utils import _prepare_4d_causal_attention_mask
  from ...modeling_outputs import BaseModelOutputWithPast, CausalLMOutputWithPast, SequenceClassifierOutputWithPast
  from ...modeling_utils import PreTrainedModel
  from ...utils import add_start_docstrings, add_start_docstrings_to_model_forward, logging, replace_return_docstrings
  from .configuration_persimmon import PersimmonConfig
label_desc: Use image node_id 1 to create a new PersimmonRotaryEmbedding object from inherited base classes: nn with example: obj = PersimmonRotaryEmbedding(dim, max_position_embeddings, base, device)