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(self, x: torch.Tensor, out_feat_keys: List[str] = None):
      if out_feat_keys is None or len(out_feat_keys) == 0:
          x = self.forward_features(x)
          x = x.unsqueeze(0)
      else:
          # we specified a feature layer name. Follow DINO
          # (https://github.com/facebookresearch/dino/blob/main/eval_linear.py#L159) # NOQA
          x = self.get_intermediate_features(x, out_feat_keys)
      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 8 for calling the BEiT obj's underlying member method code with example usage: obj.forward(x, out_feat_keys) and returns: x