From Continuous Pixels to Discrete Vision Tokens
Standard Transformer blocks require a one dimensional sequence of input vectors. In 2020, the Vision Transformer (ViT) proved that standard attention layers could model 2D spatial relationships by slicing images into non overlapping square patches and treating them identically to subword tokens.
An image is divided into a grid of non overlapping P × P pixel squares.
Each flattened patch is projected into model dimension D via a learnable weight matrix.
2D coordinate embeddings are added so the transformer knows patch layout.