code: def _mae_forward_encoder(self, x, mask_ratio, mask=None):
      x, bcthw = self.patch_embed(x, keep_spatial=False)
      bcthw = list(bcthw)
      if len(bcthw) == 4:  # Fix bcthw in case of 4D tensor
          bcthw.insert(2, torch.tensor(self.T))
      T, H, W = bcthw[-3], bcthw[-2], bcthw[-1]
      assert len(bcthw) == 5 and (T, H, W) == (
          self.T,
          self.H,
          self.W,
      ), bcthw
      s = 1 if self.cls_embed_on else 0
      B, N, C = x.shape
  
      if self.use_fixed_sincos_pos:
          x += self.pos_embed[:, s:, :]  # 0: no cls token
  
      if self.cfg.MASK.PER_FRAME_MASKING:
          x = x.reshape([B * T, H * W, C])
      x, mask, ids_restore, ids_keep = self._mae_random_masking(
          x, mask_ratio, None if self.cfg.MASK.MAE_RND_MASK else mask
      )
      if self.cfg.MASK.PER_FRAME_MASKING:
          x = x.view([B, -1, C])
  
      if self.cls_embed_on:
          # append cls token
          cls_token = self.cls_token  #
          if self.use_fixed_sincos_pos:
              cls_token = cls_token + self.pos_embed[:, :s, :]
          cls_tokens = cls_token.expand(x.shape[0], -1, -1)
          x = torch.cat((cls_tokens, x), dim=1)
  
      if self.use_abs_pos and not self.use_fixed_sincos_pos:
          if self.sep_pos_embed:
              pos_embed = self.pos_embed_spatial.repeat(
                  1, self.patch_dims[0], 1
              ) + torch.repeat_interleave(
                  self.pos_embed_temporal,
                  self.patch_dims[1] * self.patch_dims[2],
                  dim=1,
              )
              pos_embed = pos_embed.expand(x.shape[0], -1, -1)
              pos_embed = torch.gather(
                  pos_embed,
                  dim=1,
                  index=ids_keep.unsqueeze(-1).repeat(
                      1, 1, pos_embed.shape[2]
                  ),
              )
              if self.cls_embed_on:
                  pos_embed = torch.cat(
                      [
                          self.pos_embed_class.expand(
                              pos_embed.shape[0], -1, -1
                          ),
                          pos_embed,
                      ],
                      1,
                  )
              x += pos_embed
          else:
              pos_embed = self.pos_embed.expand(x.shape[0], -1, -1)
              pos_embed_sampled = torch.gather(
                  pos_embed[:, s:, :],
                  dim=1,
                  index=ids_keep.unsqueeze(-1).repeat(
                      1, 1, self.pos_embed.shape[2]
                  ),
              )
              if self.cls_embed_on:
                  pos_embed_sampled = torch.cat(
                      [pos_embed[:, :s, :], pos_embed_sampled], 1
                  )
              x += pos_embed_sampled
  
      # apply Transformer blocks
      B, N, C = x.shape
      thw = [T, H, W]
      for _, blk in enumerate(self.blocks):
          x, thw = blk(x, thw)
      x = self.norm(x)
  
      return x, mask, ids_restore, thw
  
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 12 for calling the MaskMViT obj's underlying member method code with example usage: obj._mae_forward_encoder(x, mask_ratio, mask) and returns: x,  mask,  ids_restore,  thw