class_docstr: Eva Vision Transformer w/ Abs & Rotary Pos Embed
  
  This class implements the EVA and EVA02 models that were based on the BEiT ViT variant
    * EVA - abs pos embed, global avg pool
    * EVA02 - abs + rope pos embed, global avg pool, SwiGLU, scale Norm in MLP (ala normformer)
class_docstr_tok: ["Eva","Vision","Transformer","w\/","Abs","&","Rotary","Pos","Embed","This","class","implements","the","EVA","and","EVA02","models","that","were","based","on","the","BEiT","ViT","variant","*","EVA","-","abs","pos","embed",",","global","avg","pool","*","EVA02","-","abs","+","rope","pos","embed",",","global","avg","pool",",","SwiGLU",",","scale","Norm","in","MLP","(","ala","normformer",")"]
code: def _pos_embed(
      self, x
  ) -> Tuple[torch.Tensor, Optional[torch.Tensor]]:
      if self.dynamic_img_size:
          B, H, W, C = x.shape
          if self.pos_embed is not None:
              pos_embed = resample_abs_pos_embed(
                  self.pos_embed,
                  (H, W),
                  num_prefix_tokens=self.num_prefix_tokens,
              )
          else:
              pos_embed = None
          x = x.view(B, -1, C)
          rot_pos_embed = (
              self.rope.get_embed(shape=(H, W))
              if self.rope is not None
              else None
          )
      else:
          pos_embed = self.pos_embed
          rot_pos_embed = (
              self.rope.get_embed() if self.rope is not None else None
          )
  
      if self.cls_token is not None:
          x = torch.cat(
              (self.cls_token.expand(x.shape[0], -1, -1), x), dim=1
          )
      if pos_embed is not None:
          x = x + pos_embed
      x = self.pos_drop(x)
  
      # obtain shared rotary position embedding and apply patch dropout
      if self.patch_drop is not None:
          x, keep_indices = self.patch_drop(x)
          if rot_pos_embed is not None and keep_indices is not None:
              rot_pos_embed = apply_keep_indices_nlc(
                  x, rot_pos_embed, keep_indices
              )
      return x, rot_pos_embed
  
imports: import math
  from typing import Callable, Optional, Tuple, Union
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.utils.checkpoint import checkpoint
  from timm.data import IMAGENET_DEFAULT_MEAN, IMAGENET_DEFAULT_STD, OPENAI_CLIP_MEAN, OPENAI_CLIP_STD
  from timm.layers import PatchEmbed, Mlp, GluMlp, SwiGLU, LayerNorm, DropPath, PatchDropout, RotaryEmbeddingCat, apply_rot_embed_cat, apply_keep_indices_nlc, trunc_normal_, resample_patch_embed, resample_abs_pos_embed, to_2tuple, use_fused_attn
  from ._builder import build_model_with_cfg
  from ._registry import generate_default_cfgs, register_model
label_desc: Use image node_id 9 for calling the Eva obj's underlying member method code with example usage: obj._pos_embed(x) and returns: x,  rot_pos_embed