Array API compatible wrapper for :py:func:`np.concatenate `. See its docstring for more information.
(
arrays: Union[Tuple[Array, ...], List[Array]], /, *, axis: Optional[int] = 0
)
| 9 | |
| 10 | # Note: the function name is different here |
| 11 | def concat( |
| 12 | arrays: Union[Tuple[Array, ...], List[Array]], /, *, axis: Optional[int] = 0 |
| 13 | ) -> Array: |
| 14 | """ |
| 15 | Array API compatible wrapper for :py:func:`np.concatenate <numpy.concatenate>`. |
| 16 | |
| 17 | See its docstring for more information. |
| 18 | """ |
| 19 | # Note: Casting rules here are different from the np.concatenate default |
| 20 | # (no for scalars with axis=None, no cross-kind casting) |
| 21 | dtype = result_type(*arrays) |
| 22 | arrays = tuple(a._array for a in arrays) |
| 23 | return Array._new(np.concatenate(arrays, axis=axis, dtype=dtype)) |
| 24 | |
| 25 | |
| 26 | def expand_dims(x: Array, /, *, axis: int) -> Array: |