Skip to content

dpctl.tensor.concat does not support axis=None mandated by array API #1122

@oleksandr-pavlyk

Description

@oleksandr-pavlyk

Array API provisions support for axis=None in concat function.

If axis is None, arrays must be flattened before concatenation.

This is presently not supported in dpctl 0.14.2:

Evidence of the lack thereof (excerpt of the IPython sessions)

In [1]: import dpctl.tensor as dpt

In [2]: x0 = dpt.ones((3,2,), dtype="i4")

In [3]: x1 = dpt.full((3,3,), 2, dtype="i4")

In [4]: dpt.concat((x0, x1), axis=1)
Out[4]:
usm_ndarray([[1, 1, 2, 2, 2],
             [1, 1, 2, 2, 2],
             [1, 1, 2, 2, 2]], dtype=int32)

In [5]: dpt.concat((x0, x1), axis=None)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [5], in <cell line: 1>()
----> 1 dpt.concat((x0, x1), axis=None)

File ~/repos/dpctl/dpctl/tensor/_manipulation_functions.py:479, in concat(arrays, axis)
    476 n = len(arrays)
    477 X0 = arrays[0]
--> 479 axis = normalize_axis_index(axis, X0.ndim)
    480 X0_shape = X0.shape
    481 _check_same_shapes(X0_shape, axis, n, arrays)

TypeError: an integer is required (got type NoneType)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtensor

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions