code: def __init__(self, cfg):
      super().__init__(cfg)
      self.pretrain_depth = cfg.MASK.PRETRAIN_DEPTH
      if self.pretrain_depth[-1] + 1 < cfg.MVIT.DEPTH:
          del self.blocks[self.pretrain_depth[-1] + 1 :]
      del self.norm
      del self.head
      self.feat_size, self.feat_stride = calc_mvit_feature_geometry(cfg)
  
      self.head_type = cfg.MASK.HEAD_TYPE.split("_")
      feat_sz = [self.feat_size[depth] for depth in self.pretrain_depth]
      if self.head_type[0] == "separate":
          if not cfg.MASK.PRED_HOG:
              pred_t_sz = (
                  1
                  if self.cfg.MASK.TIME_STRIDE_LOSS
                  else self.patch_stride[0]
              )
              num_classes = [
                  pred_t_sz * (self.feat_stride[depth][-1] ** 2) * 3
                  for depth in self.pretrain_depth
              ]
              self.pred_head = head_helper.MSSeparateHead(
                  self.blocks, cfg, num_classes, feat_sz
              )
          else:
              self.hogs = nn.ModuleList()
              self.nbins = 9
              self.cell_sz = 8
              self.hogs.append(
                  operators.HOGLayerC(
                      nbins=self.nbins,
                      pool=self.cell_sz,
                  )
              )
              self.ncells = [
                  (self.feat_stride[depth][-1] // self.cell_sz) ** 2
                  for depth in self.pretrain_depth
              ]
              pred_hog_classes = [
                  self.nbins * ncell for ncell in self.ncells
              ]
              pred_hog_classes = [
                  pred_hog_class * 3  # 3 color channels
                  for pred_hog_class in pred_hog_classes
              ]
              self.pred_head = head_helper.MSSeparateHead(
                  self.blocks, cfg, pred_hog_classes, feat_sz
              )
              self.hog_loss = "mse"
      else:
          raise NotImplementedError
  
      embed_dim = cfg.MVIT.EMBED_DIM
      decoder_embed_dim = cfg.MASK.DECODER_EMBED_DIM
      self.sep_pos_embed_decoder = cfg.MASK.DECODER_SEP_POS_EMBED
      self.counter = 0
      if cfg.MASK.MAE_ON:
          # ----------------------------------------------------------------
          # MAE decoder specifics
          norm_layer = partial(nn.LayerNorm, eps=1e-6)
          dim_in = self.blocks[-1].dim_out
          self.norm = norm_layer(dim_in)
          self.decoder_embed = nn.Linear(
              dim_in, decoder_embed_dim, bias=True
          )
          num_patches = math.prod(self.patch_dims)
          if self.use_abs_pos:
              if self.sep_pos_embed_decoder:
                  self.dec_pos_embed_spatial = nn.Parameter(
                      torch.zeros(
                          1,
                          self.patch_dims[1] * self.patch_dims[2],
                          decoder_embed_dim,
                      )
                  )
                  self.dec_pos_embed_temporal = nn.Parameter(
                      torch.zeros(
                          1, self.patch_dims[0], decoder_embed_dim
                      )
                  )
                  if self.cls_embed_on:
                      self.dec_pos_embed_class = nn.Parameter(
                          torch.zeros(1, 1, decoder_embed_dim)
                      )
              else:
                  self.decoder_pos_embed = nn.Parameter(
                      torch.zeros(
                          1,
                          num_patches + 1
                          if self.cls_embed_on
                          else num_patches,
                          decoder_embed_dim,
                      )
                  )
      self.mask_token = nn.Parameter(
          torch.zeros(
              1, 1, decoder_embed_dim if cfg.MASK.MAE_ON else embed_dim
          )
      )
      trunc_normal_(self.mask_token, std=0.02)
      if self.use_abs_pos and cfg.MASK.MAE_ON:
          if self.sep_pos_embed_decoder:
              trunc_normal_(self.dec_pos_embed_spatial, std=0.02)
              trunc_normal_(self.dec_pos_embed_temporal, std=0.02)
              if self.cls_embed_on:
                  trunc_normal_(self.dec_pos_embed_class, std=0.02)
          else:
              trunc_normal_(self.decoder_pos_embed, std=0.02)
  
      if cfg.MASK.SCALE_INIT_BY_DEPTH:
          self.fix_init_weight()
  
      self.pred_pixel_wt = 0.0 if cfg.MASK.PRED_HOG else 1.0
      self.pred_hog_wt = 1.0 if cfg.MASK.PRED_HOG else 0.0
  
imports: import math
  from functools import partial
  import torch
  import torch.nn
  import torch.nn.functional
  from torch.nn.init import trunc_normal_
  import slowfast.utils.logging
  import slowfast.utils.misc
  from slowfast.models import head_helper
  from slowfast.models.attention import attention_pool
  from slowfast.models.utils import calc_mvit_feature_geometry
  from slowfast.models.video_model_builder import MViT
  from .None import head_helper, operators, resnet_helper, stem_helper
  from .build import MODEL_REGISTRY
label_desc: Use image node_id 1 to create a new MaskMViT object from inherited base classes: MViT with example: obj = MaskMViT(cfg)