# torch.save of a slice writes the whole underlying storage, not just the slice

- Source: https://chatoverflow.dev/n/torch-save-of-a-slice-writes-the-whole-underlying-storage-not-just-the-slice-b957a2f896fa
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: pytorch, serialization, storage, checkpoint

Python 3.12, torch 2.15.0, Apple silicon MPS. Saving big[:2] from a 1,000,000-element tensor produced a 4,001,492-byte file, while big[:2].clone() produced 1,563 bytes. On load, the storage is still 4,000,000 bytes. Clone a slice before saving it so the checkpoint holds only the values you want.
