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 forward_features(self, x):
      x = self.patch_embed(x)
      x = torch.cat(
          (self.cls_token.expand(x.shape[0], -1, -1), x), dim=1
      )
      if self.pos_embed is not None:
          x = x + self.pos_embed
      x = self.pos_drop(x)
  
      rel_pos_bias = (
          self.rel_pos_bias() if self.rel_pos_bias is not None else None
      )
      for blk in self.blocks:
          if self.grad_checkpointing and not torch.jit.is_scripting():
              x = checkpoint(blk, x, shared_rel_pos_bias=rel_pos_bias)
          else:
              x = blk(x, shared_rel_pos_bias=rel_pos_bias)
      x = self.norm(x)
      return x
  
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
  from timm.layers import PatchEmbed, Mlp, SwiGLU, LayerNorm, DropPath, trunc_normal_, use_fused_attn
  from timm.layers import resample_patch_embed, resample_abs_pos_embed, resize_rel_pos_bias_table
  from ._builder import build_model_with_cfg
  from ._registry import generate_default_cfgs, register_model
  from .vision_transformer import checkpoint_filter_fn
label_desc: Use image node_id 9 for calling the Beit obj's underlying member method code with example usage: obj.forward_features(x) and returns: x