# perceiver-pytorch **Repository Path**: lsb829/perceiver-pytorch ## Basic Information - **Project Name**: perceiver-pytorch - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-05-13 - **Last Updated**: 2026-05-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Perceiver - Pytorch Implementation of Perceiver, General Perception with Iterative Attention, in Pytorch Yannic Kilcher explanation! ## Install ```bash $ pip install perceiver-pytorch ``` ## Usage ```python import torch from perceiver_pytorch import Perceiver model = Perceiver( input_channels = 3, # number of channels for each token of the input input_axis = 2, # number of axis for input data (2 for images, 3 for video) num_freq_bands = 6, # number of freq bands, with original value (2 * K + 1) max_freq = 10., # maximum frequency, hyperparameter depending on how fine the data is depth = 6, # depth of net num_latents = 256, # number of latents, or induced set points, or centroids. different papers giving it different names cross_dim = 512, # cross attention dimension latent_dim = 512, # latent dimension cross_heads = 1, # number of heads for cross attention. paper said 1 latent_heads = 8, # number of heads for latent self attention, 8 cross_dim_head = 64, latent_dim_head = 64, num_classes = 1000, # output number of classes attn_dropout = 0., ff_dropout = 0., weight_tie_layers = False # whether to weight tie layers (optional, as indicated in the diagram) ) img = torch.randn(1, 224, 224, 3) # 1 imagenet image, pixelized model(img) # (1, 1000) ``` ## Experimental I have also included a version of Perceiver that includes bottom-up (in addition to top-down) attention, using the same scheme as presented in the original Set Transformers paper as the Induced Set Attention Block. You simply have to change the above import to ```python from perceiver_pytorch.experimental import Perceiver ``` ## Citations ```bibtex @misc{jaegle2021perceiver, title = {Perceiver: General Perception with Iterative Attention}, author = {Andrew Jaegle and Felix Gimeno and Andrew Brock and Andrew Zisserman and Oriol Vinyals and Joao Carreira}, year = {2021}, eprint = {2103.03206}, archivePrefix = {arXiv}, primaryClass = {cs.CV} } ```