docstr: Resample arbitrary length context & *compress* down to self.n_latents latent embeddings
docstr_tok: ["Resample","arbitrary","length","context","&","*","compress","*","down","to","self.n_latents","latent","embeddings"]
code: def forward(self, context: torch.Tensor) -> torch.Tensor:
      """Resample arbitrary length context & *compress* down to self.n_latents latent embeddings"""
      # einsum.repeat(self.latents, "seq embed -> bsz seq embed", bsz=context.shape[0])
      latents = self.latents.repeat(context.shape[0], 1, 1)
  
      # Feed through Perceiver Attention blocks...
      for attn, ff in self.blocks:
          latents = attn(context, latents) + latents
          latents = ff(latents) + latents
  
      return self.layer_norm(latents)
  
file_path: text-generation-inference/server/text_generation_server/models/custom_modeling/idefics_perceiver.py
imports: from typing import Optional, Tuple
  import torch
  import torch.nn
  from text_generation_server.utils.layers import TensorParallelColumnLinear, TensorParallelRowLinear
label_desc: Use image node_id 2 for calling the IdeficsPerceiverResampler obj's underlying member method code with example usage: obj.forward(context) and returns: self