Wrapper around mlx.core.slice_update()
that replaces a contiguous strided region with value.
Arguments
- x
An mlx array.
- value
Replacement
mlx(or coercible) array. Must broadcast to the slice determined bystart,stop, andstrides.- start
Integer vector (1-indexed) giving the inclusive starting index for each axis.
- stop
Integer vector (1-indexed) giving the inclusive stopping index for each axis.
- strides
Optional integer vector of strides (defaults to ones).
Examples
x <- mlx_matrix(1:9, 3, 3)
replacement <- mlx_matrix(100:103, nrow = 2)
updated <- mlx_slice_update(x, replacement, start = c(1L, 2L), stop = c(2L, 3L))
updated
#> mlx array [3 x 3]
#> dtype: float32
#> device: gpu
#> values:
#> [,1] [,2] [,3]
#> [1,] 1 100 102
#> [2,] 2 101 103
#> [3,] 3 6 9