IIUC, asarray must support nested sequences of Python scalars, but not a nested sequence of arrays.
asarray raises on a sequence of arrays:
import array_api_strict as xp
xp.asarray([xp.asarray(1)])
# TypeError: Nested Arrays are not allowed. Use `stack` instead.
But not a nested sequence of arrays:
xp.asarray([[xp.asarray(1)]])
# Array([[1]], dtype=array_api_strict.int64)
Crossref data-apis/array-api-tests#461
IIUC,
asarraymust support nested sequences of Python scalars, but not a nested sequence of arrays.asarrayraises on a sequence of arrays:But not a nested sequence of arrays:
Crossref data-apis/array-api-tests#461