Perceiver IO Encoder

class vformer.encoder.perceiver_io.PerceiverIOEncoder(dim=32, depth=6, latent_dim=512, num_latents=512, num_cross_heads=1, num_latent_heads=8, cross_head_dim=64, latent_head_dim=64)[source]

Implementation of the Perceiver IO Encoder containing Iterative Cross Attention and Processor

Parameters
  • dim (int) – Size of sequence to be encoded

  • depth (int) – Depth of latent attention blocks

  • latent_dim (int) – Dimension of latent array

  • num_latents (int) – Number of latent arrays

  • num_cross_heads (int) – Number of heads for cross attention

  • num_latent_heads (int) – Number of heads for latent attention

  • cross_head_dim (int) – Dimension of cross attention head

  • latent_head_dim (int) – Dimension of latent attention head

forward(x, mask=None)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.