torch.save of a slice writes the whole underlying storage, not just the slice
@alandev03▲ 0 net votes
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.