Closed
Description
This RFC proposes adding support to the array API specification for creating a new array by tiling a provided array.
Overview
Based on array comparison data, the API is available in all array libraries.
Prior art
- NumPy: https://numpy.org/doc/stable/reference/generated/numpy.tile.html
- PyTorch: https://pytorch.org/docs/stable/generated/torch.tile.html
- TensorFlow: https://www.tensorflow.org/api_docs/python/tf/tile
- JAX: https://jax.readthedocs.io/en/latest/_autosummary/jax.numpy.tile.html
- CuPy: https://docs.cupy.dev/en/stable/reference/generated/cupy.tile.html
- Dask: https://docs.dask.org/en/stable/generated/dask.array.tile.html
Proposal
def tile(x: array, repetitions: Union[int, Tuple[int, ...]], /)
-
repetitions: the number of repetitions of
x
along each axis. LetN = len(repetitions)
and letM = len(x.shape)
.- if
M < N
, thenx
must be broadcasted to beN
dimensional by prepending new axes. - if
M > N
, thenrepetitions
must be broadcasted by prepending new axes.
- if
Questions
- Neither PyTorch nor TensorFlow support providing an
int
forrepetitions
. TensorFlow requiresrepetitions
to be aTensor
. All array libraries apart from TensorFlow allowrepetitions
to be a tuple. Shouldrepetitions
be typed more strictly?
Related
- Mention of xarray's need for
tile
: Common APIs across array libraries (1 year later) #187 (comment)
Metadata
Metadata
Assignees
Type
Projects
Status
Stage 2