class_docstr: Model builder for MViTv1 and MViTv2.
  
  "MViTv2: Improved Multiscale Vision Transformers for Classification and Detection"
  Yanghao Li, Chao-Yuan Wu, Haoqi Fan, Karttikeya Mangalam, Bo Xiong, Jitendra Malik, Christoph Feichtenhofer
  https://arxiv.org/abs/2112.01526
  "Multiscale Vision Transformers"
  Haoqi Fan, Bo Xiong, Karttikeya Mangalam, Yanghao Li, Zhicheng Yan, Jitendra Malik, Christoph Feichtenhofer
  https://arxiv.org/abs/2104.11227
class_docstr_tok: ["Model","builder","for","MViTv1","and","MViTv2",".","``","MViTv2",":","Improved","Multiscale","Vision","Transformers","for","Classification","and","Detection","''","Yanghao","Li",",","Chao-Yuan","Wu",",","Haoqi","Fan",",","Karttikeya","Mangalam",",","Bo","Xiong",",","Jitendra","Malik",",","Christoph","Feichtenhofer","https",":","\/\/arxiv.org\/abs\/2112.01526","''","Multiscale","Vision","Transformers","''","Haoqi","Fan",",","Bo","Xiong",",","Karttikeya","Mangalam",",","Yanghao","Li",",","Zhicheng","Yan",",","Jitendra","Malik",",","Christoph","Feichtenhofer","https",":","\/\/arxiv.org\/abs\/2104.11227"]
code: def _get_pos_embed(self, pos_embed, bcthw):
      if len(bcthw) == 4:
          t, h, w = 1, bcthw[-2], bcthw[-1]
      else:
          t, h, w = bcthw[-3], bcthw[-2], bcthw[-1]
      if self.cls_embed_on:
          cls_pos_embed = pos_embed[:, 0:1, :]
          pos_embed = pos_embed[:, 1:]
      txy_num = pos_embed.shape[1]
      p_t, p_h, p_w = self.patch_dims
      assert p_t * p_h * p_w == txy_num
  
      if (p_t, p_h, p_w) != (t, h, w):
          new_pos_embed = F.interpolate(
              pos_embed[:, :, :]
              .reshape(1, p_t, p_h, p_w, -1)
              .permute(0, 4, 1, 2, 3),
              size=(t, h, w),
              mode="trilinear",
          )
          pos_embed = new_pos_embed.reshape(1, -1, t * h * w).permute(
              0, 2, 1
          )
  
      if self.cls_embed_on:
          pos_embed = torch.cat((cls_pos_embed, pos_embed), dim=1)
  
      return pos_embed
  
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.weight_init_helper
  from slowfast.models.attention import MultiScaleBlock
  from slowfast.models.batchnorm_helper import get_norm
  from slowfast.models.common import TwoStreamFusion
  from slowfast.models.reversible_mvit import ReversibleMViT
  from slowfast.models.utils import calc_mvit_feature_geometry, get_3d_sincos_pos_embed, round_width, validate_checkpoint_wrapper_import
  from .None import head_helper, operators, resnet_helper, stem_helper
  from .build import MODEL_REGISTRY
label_desc: Use image node_id 4 for calling the MViT obj's underlying member method code with example usage: obj._get_pos_embed(pos_embed, bcthw) and returns: pos_embed