Skip to contents

Reshapes the MLX array to the specified dimensions. The total number of elements must remain the same.

Usage

# S3 method for class 'mlx'
dim(x) <- value

Arguments

x

An mlx array, or an R array/matrix/vector that will be converted via as_mlx().

value

Integer vector of new dimensions

Value

Reshaped mlx object

Examples

x <- as_mlx(1:12)
dim(x) <- c(3, 4)
dim(x)
#> [1] 3 4