Skip to contents

as_r() mirrors base R coercion rules: MLX objects with dim() equal to NULL return a plain vector, while higher-dimensional inputs return matrices or arrays.

Usage

as_r(x, ...)

Arguments

x

An mlx array.

...

Additional arguments; ignored.

Value

A vector, matrix, or array depending on the dimensions of x.

Examples

v <- as_mlx(1:3)
as_r(v)      # numeric vector
#> [1] 1 2 3