oneflow.load

oneflow.load(path: str, global_src_rank: Optional[int] = None, map_location: Optional[Union[str, oneflow._oneflow_internal.device, oneflow._oneflow_internal.placement]] = None, *, support_pytorch_format: bool = True)Any

Loads an object saved with oneflow.save() from a directory.

Parameters
  • path (str) – The directory containing the object

  • global_src_rank (int, optional) – The source rank for loading global tensors. When specified, only the process whose rank == global_src_rank will really read the files in path, and tensors in the loaded object will be consistent with placement = flow.placement(‘cuda’, [global_src_rank])

  • map_location (str, flow.device or flow.placement, optional) – indicates the location where all tensors should be loaded.

  • support_pytorch_format (bool, optional) – whether to support loading the file saved by torch.save. Default: True

Returns

The loaded object