class_docstr: Vision Transformer with support for patch or hybrid CNN input stage
class_docstr_tok: ["Vision","Transformer","with","support","for","patch","or","hybrid","CNN","input","stage"]
code: def prepare_tokens(self, x):
      x = self.patch_embed(x)
      batch_size, seq_len, _ = x.size()
  
      cls_tokens = self.cls_token.expand(
          batch_size, -1, -1
      )  # stole cls_tokens impl from Phil Wang, thanks
      x = torch.cat((cls_tokens, x), dim=1)
      if self.pos_embed is not None:
          x = x + self.pos_embed
      x = self.pos_drop(x)
      return x
  
imports: import copy
  import logging
  import math
  from functools import partial
  from typing import List
  import torch
  import torch.nn
  import torch.nn.functional
  from vissl.config import AttrDict
  from vissl.models.model_helpers import DropPath, to_2tuple, trunc_normal_
  from vissl.models.trunks import register_model_trunk
label_desc: Use image node_id 5 for calling the BEiT obj's underlying member method code with example usage: obj.prepare_tokens(x) and returns: x