class_docstr: Predictor for the I-JEPA model [0].
  
  Experimental: Support for I-JEPA is experimental, there might be breaking changes
  in the future.
  
  Predict patch embeddings. Code inspired by [1].
  
  - [0]: Joint-Embedding Predictive Architecture, 2023, https://arxiv.org/abs/2301.08243
  - [1]: https://github.com/facebookresearch/ijepa
  
  Attributes:
      seq_length:
          Token sequence length, including the class token.
      num_layers:
          Number of transformer blocks.
      num_heads:
          Number of attention heads.
      hidden_dim:
          Dimension of the input and output tokens.
      predictor_embed_dim:
          Dimension of inner predicted tokens
      mlp_dim:
          Dimension of the MLP in the transformer block.
      dropout:
          Percentage of elements set to zero after the MLP in the transformer.
      attention_dropout:
          Percentage of elements set to zero after the attention head.
class_docstr_tok: ["Predictor","for","the","I-JEPA","model","[","0","]",".","Experimental",":","Support","for","I-JEPA","is","experimental",",","there","might","be","breaking","changes","in","the","future",".","Predict","patch","embeddings",".","Code","inspired","by","[","1","]",".","-","[","0","]",":","Joint-Embedding","Predictive","Architecture",",","2023",",","https",":","\/\/arxiv.org\/abs\/2301.08243","-","[","1","]",":","https",":","\/\/github.com\/facebookresearch\/ijepa","Attributes",":","seq_length",":","Token","sequence","length",",","including","the","class","token",".","num_layers",":","Number","of","transformer","blocks",".","num_heads",":","Number","of","attention","heads",".","hidden_dim",":","Dimension","of","the","input","and","output","tokens",".","predictor_embed_dim",":","Dimension","of","inner","predicted","tokens","mlp_dim",":","Dimension","of","the","MLP","in","the","transformer","block",".","dropout",":","Percentage","of","elements","set","to","zero","after","the","MLP","in","the","transformer",".","attention_dropout",":","Percentage","of","elements","set","to","zero","after","the","attention","head","."]
code: def forward(self, x, masks_x, masks):
      assert (masks is not None) and (
          masks_x is not None
      ), "Cannot run predictor without mask indices"
  
      if not isinstance(masks_x, list):
          masks_x = [masks_x]
  
      if not isinstance(masks, list):
          masks = [masks]
  
      B = len(x) // len(masks_x)
      x = self.predictor_embed(x)
      x_pos_embed = self.predictor_pos_embed.repeat(B, 1, 1)
  
      x += utils.apply_masks(x_pos_embed, masks_x)
      _, N_ctxt, _ = x.shape
  
      pos_embs = self.predictor_pos_embed.repeat(B, 1, 1)
      pos_embs = utils.apply_masks(pos_embs, masks)
      pos_embs = utils.repeat_interleave_batch(
          pos_embs, B, repeat=len(masks_x)
      )
      pred_tokens = self.mask_token.repeat(
          pos_embs.size(0), pos_embs.size(1), 1
      )
  
      pred_tokens += pos_embs
      x = x.repeat(len(masks), 1, 1)
      x = torch.cat([x, pred_tokens], dim=1)
  
      x = self.ln(self.layers(x))
  
      x = x[:, N_ctxt:]
      x = self.predictor_proj(x)
  
      return x
  
imports: import math
  from functools import partial
  from typing import Callable, List, Optional
  import numpy
  import torch
  import torch.nn
  from torchvision.models import vision_transformer
  from torchvision.models.vision_transformer import ConvStemConfig
  from lightly.models import utils
label_desc: Use image node_id 3 for calling the IJEPAPredictor obj's underlying member method code with example usage: obj.forward(x, masks_x, masks) and returns: x