The Vision Transformer (Dosovitskiy et al., 2021) cuts an image into fixed-size patches and treats each patch as a token. The number of tokens, and hence the cost of attention, follows directly from the image size and patch size.
Implement num_patches(img, p), the number of patches for a square image.
Divide the side length by the patch size, floor, then square.
No results yet
Run your code to check it against the examples, or submit to run every test.