Convert an image matrix into an ordered sequence of flattened patches so pixels can enter a transformer as tokens.
Required APIdef patchify(image, patch_size):
return flattened_patchesBehaviorThink through the mechanism first if you want the extra reasoning step. It never blocks the editor.
patchify([[1, 2], [3, 4]], 1)each pixel can become one token
patchify([[1, 2], [3, 4]], 2)patch size controls sequence length
2 hidden edge tests run after the visible contract passes.
Run Tests to see the contract verdicts here.