Skip to contents

Temporarily set the default MLX device

Usage

with_default_device(device, code)

Arguments

device

"gpu", "cpu", or an mlx_stream created via mlx_new_stream().

code

Expression to evaluate while device is active.

Value

The result of evaluating code.

Examples

with_default_device("cpu", x <- mlx_vector(1:10))