Skip to content

Glossary: Deep Learning Basics

torch.save / torch.load

Also written: torch.load, torch.save, map_location

`torch.save` writes tensors or dictionaries of tensors to a file (usually `.pt`) and `torch.load` reads them back. Load with `weights_only=True` for safety, and add `map_location="cpu"` to load a GPU-saved model on a CPU.

Where the book teaches it

Related terms

weights_only=Truestate_dictPickle