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 init_weights(self):
      logger = MMLogger.get_current_instance()
      if self.init_cfg is None:
          logger.warn(
              f"No pre-trained weights for "
              f"{self.__class__.__name__}, "
              f"training start from scratch"
          )
          self.apply(self._init_weights)
      else:
          assert "checkpoint" in self.init_cfg, (
              f"Only support "
              f"specify `Pretrained` in "
              f"`init_cfg` in "
              f"{self.__class__.__name__} "
          )
          ckpt = CheckpointLoader.load_checkpoint(
              self.init_cfg.checkpoint,
              logger=logger,
              map_location="cpu",
          )
          if "model" in ckpt:
              _state_dict = ckpt["model"]
          self.load_state_dict(_state_dict, False)
  
imports: import math
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import build_activation_layer, build_norm_layer
  from mmcv.cnn.bricks import DropPath
  from mmengine.logging import MMLogger
  from mmengine.model import BaseModule
  from mmengine.runner.checkpoint import CheckpointLoader
  from mmdet.registry import MODELS
label_desc: Use image node_id 3 for calling the ViT obj's underlying member method code with example usage: obj.init_weights() without return types