Pad or split mlx arrays
mlx_pad.Rd- mlx_pad()mirrors the MLX padding primitive, enlarging each axis according to- pad_width. Values are added symmetrically (- pad_width[i, 1]before,- pad_width[i, 2]after) using the specified- mode.
- mlx_split()divides an array along an axis either into equal sections (- sectionsscalar) or at explicit 1-based split points (- sectionsvector), returning a list of mlx arrays.
Usage
mlx_pad(
  x,
  pad_width,
  value = 0,
  mode = c("constant", "edge", "reflect", "symmetric"),
  axes = NULL
)
mlx_split(x, sections, axis = 1L)Arguments
- x
- An mlx array, or an R array/matrix/vector that will be converted via - as_mlx().
- pad_width
- Padding extents. Supply a single integer, a length-two numeric vector, or a matrix/list with one - (before, after)pair per padded axis.
- value
- Constant fill value used when - mode = "constant".
- mode
- Padding mode passed to MLX (e.g., - "constant",- "edge",- "reflect").
- axes
- Optional integer vector of axes (1-indexed, negatives count from the end) to which - pad_widthapplies. Unlisted axes receive zero padding.
- sections
- Either a single integer (number of equal parts) or an integer vector of 1-based split points along - axis.
- axis
- Axis (1-indexed, negatives count from the end) to operate on.