Skip to main content



save(tensor_dict: TensorDict, path: Path) -> object

Saves a collection of tensors to a file.

The file is saved in a binary format that's specific to MAX. You can then load the checkpoint with load().

For example:

from max.graph.checkpoint import save, TensorDict
from tensor import Tensor, TensorShape

def write_to_disk():
tensors = TensorDict()
tensors.set("x", Tensor[DType.int32](TensorShape(1, 2, 2), 1, 2, 3, 4))
tensors.set("y", Tensor[DType.float32](TensorShape(10, 5), -1.23))
save(tensors, "/path/to/checkpoint.maxckpt")


  • tensor_dict (TensorDict): Tensors to save.
  • path (Path): The location to save the checkpoint file. You can use whatever filename and file extension you want.