🫧 Squeeze & Unsqueeze Visualizer

Watch an invisible size-1 dimension shell appear or vanish at any index β€” the data underneath never moves.

πŸ“‹ How To Use This Lab
  1. Flip the switch to Unsqueeze or Squeeze, then set the Dimension Index slider.
  2. Press Next Step β–Ά to apply it β€” a dashed "shell" box appears (unsqueeze) or dissolves (squeeze).
  3. Use Previous Step β—€ to undo, or Auto Run β–Άβ–Ά to watch a guided 5-step story play itself.
  4. Try squeezing a dimension that isn't size 1 β€” PyTorch just leaves it alone, no error.
Shelly torch.Size([2, 3]) the underlying data β€” 6 values, never touched
πŸ€– SHELLYPick an operation and a dimension index, then press Next Step β€” I'll add or remove a shell right there.
πŸ§‘β€πŸ« PROF. TORCHunsqueeze(dim) inserts a size-1 axis; squeeze(dim) removes one β€” numel never changes either way.

πŸŽ›οΈ Choose an Operation

Squeeze
Unsqueeze