save

Function

Saves data to the specified path.

Format

mindio_acp.save(obj, path, open_way='memfs')

Parameters

Parameter

Mandatory/Optional

Description

Value

obj

Mandatory

Object to be saved

Valid data object

path

Mandatory

Data storage path

Valid file path

open_way

Optional

Saving mode.

  • memfs: uses the high-performance MemFS of MindIO ACP to store data.
  • fopen: calls file operation functions in the C standard library to save data. It is usually used as a backup of the memfs mode.

memfs is used by default.

  • memfs
  • fopen

Usage Example

>>> # Save to file
>>> x = torch.tensor([0, 1, 2, 3, 4])
>>> mindio_acp.save(x, '/mnt/dpc01/tensor.pt')

Return Value

  • -1: Data saving fails.
  • 0: Save data using the native torch.save mode.
  • 1: Save data using the memfs mode.
  • 2: Save data using the fopen mode.