Skip to main content

function

load

load(path: Path) -> TensorDict

Reads tensors from saved checkpoint file.

This supports only MAX checkpoint files saved with save().

For example:

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

def read_from_disk():
tensors = load("/path/to/checkpoint.maxckpt")
x = tensors.get("x").to_tensor[DType.int32]()

Args:

  • path (Path): Path to existing checkpoint file.

Returns:

TensorDict containing loaded Tensors.

Raises:

If the checkpoint file was saved with an older serialization format.