code: def forward(self, input, **kwargs):
      transformer = self.transformer
      # clone original image for loss
      img = input.clone().detach()
  
      # reshape raw image to patches
      p = self.patch_size
      input = rearrange(
          input, "b c (h p1) (w p2) -> b (h w) (p1 p2 c)", p1=p, p2=p
      )
  
      mask = get_mask_subset_with_prob(input, self.mask_prob)
  
      # mask input with mask patches with probability of `replace_prob` (keep patches the same with probability 1 - replace_prob)
      masked_input = input.clone().detach()
  
      # if random token probability > 0 for mpp
      if self.random_patch_prob > 0:
          random_patch_sampling_prob = self.random_patch_prob / (
              1 - self.replace_prob
          )
          random_patch_prob = prob_mask_like(
              input, random_patch_sampling_prob
          ).to(mask.device)
  
          bool_random_patch_prob = mask * (random_patch_prob == True)
          random_patches = torch.randint(
              0,
              input.shape[1],
              (input.shape[0], input.shape[1]),
              device=input.device,
          )
          randomized_input = masked_input[
              torch.arange(masked_input.shape[0]).unsqueeze(-1),
              random_patches,
          ]
          masked_input[bool_random_patch_prob] = randomized_input[
              bool_random_patch_prob
          ]
  
      # [mask] input
      replace_prob = prob_mask_like(input, self.replace_prob).to(
          mask.device
      )
      bool_mask_replace = (mask * replace_prob) == True
      masked_input[bool_mask_replace] = self.mask_token
  
      # linear embedding of patches
      masked_input = self.patch_to_emb(masked_input)
  
      # add cls token to input sequence
      b, n, _ = masked_input.shape
      cls_tokens = repeat(transformer.cls_token, "() n d -> b n d", b=b)
      masked_input = torch.cat((cls_tokens, masked_input), dim=1)
  
      # add positional embeddings to input
      masked_input += transformer.pos_embedding[:, : (n + 1)]
      masked_input = transformer.dropout(masked_input)
  
      # get generator output and get mpp loss
      masked_input = transformer.transformer(masked_input, **kwargs)
      cls_logits = self.to_bits(masked_input)
      logits = cls_logits[:, 1:, :]
  
      mpp_loss = self.loss(logits, img, mask)
  
      return mpp_loss
  
file_path: vit-pytorch/vit_pytorch/mpp.py
imports: import math
  import torch
  from torch import nn
  import torch.nn.functional
  from einops import rearrange, repeat, reduce
label_desc: Use image node_id 2 for calling the MPP obj's underlying member method code with example usage: obj.forward(input) and returns: mpp_loss