Skip to content

array_api_strict.asarray does not raise for nested sequence of arrays #245

Description

@mdhaber

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions