-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Labels
API extensionAdds new functions or objects to the API.Adds new functions or objects to the API.topic: ManipulationArray manipulation and transformation.Array manipulation and transformation.
Milestone
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
xalong each axis. LetN = len(repetitions)and letM = len(x.shape).- if
M < N, thenxmust be broadcasted to beNdimensional by prepending new axes. - if
M > N, thenrepetitionsmust be broadcasted by prepending new axes.
- if
Questions
- Neither PyTorch nor TensorFlow support providing an
intforrepetitions. TensorFlow requiresrepetitionsto be aTensor. All array libraries apart from TensorFlow allowrepetitionsto be a tuple. Shouldrepetitionsbe typed more strictly?
Related
- Mention of xarray's need for
tile: Common APIs across array libraries (1 year later) #187 (comment)
Metadata
Metadata
Assignees
Labels
API extensionAdds new functions or objects to the API.Adds new functions or objects to the API.topic: ManipulationArray manipulation and transformation.Array manipulation and transformation.
Type
Projects
Status
Stage 2