Skip to contents

Restores an array saved with mlx_save() and optionally places it on a specified device.

Usage

mlx_load(file, device = mlx_default_device())

Arguments

file

Path to a .npy file. The extension is appended automatically when missing.

device

Execution target: supply "gpu", "cpu", or an mlx_stream created via mlx_new_stream(). Defaults to the current mlx_default_device() unless noted otherwise (helpers that act on an existing array typically reuse that array's device or stream).

Value

An mlx array containing the file contents.

Details

Use an mlx_stream from mlx_new_stream() to load directly onto a specific stream; otherwise the array is placed on the current mlx_default_device().