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):
      B = x.shape[0]
      x = self.patch_embed(x)
      x = x + self.pos_embed
      x = self.pos_drop(x)
  
      if self.training and self.mask_ratio > 0:
          x, _, ids_restore = self.random_masking(x)
  
      for func in self.blocks:
          if self.using_checkpoint and self.training:
              from torch.utils.checkpoint import checkpoint
  
              x = checkpoint(func, x)
          else:
              x = func(x)
      x = self.norm(x.float())
  
      if self.training and self.mask_ratio > 0:
          mask_tokens = self.mask_token.repeat(
              x.shape[0], ids_restore.shape[1] - x.shape[1], 1
          )
          x_ = torch.cat(
              [x[:, :, :], mask_tokens], dim=1
          )  # no cls token
          x_ = torch.gather(
              x_,
              dim=1,
              index=ids_restore.unsqueeze(-1).repeat(1, 1, x.shape[2]),
          )  # unshuffle
          x = x_
      return torch.reshape(x, (B, self.num_patches * self.embed_dim))
  
imports: import torch
  import torch.nn
  from timm.models.layers import DropPath, to_2tuple, trunc_normal_
  from typing import Optional, Callable
label_desc: Use image node_id 6 for calling the VisionTransformer obj's underlying member method code with example usage: obj.forward_features(x) and returns: torch