Skip to content

RFC: update full to accept 0D arrays for fill_value #909

Open
@mdhaber

Description

@mdhaber

According to the current standard, the fill_value of full must be a Python scalar.

full(shape: int | Tuple[int, ...], fill_value: bool | int | float | complex, *, dtype: dtype | None = None, device: device | None = None) → array[¶](https://data-apis.org/array-api/latest/API_specification/generated/array_api.full.html#array_api.full)

Are 0d arrays allowed? This usage seems common so that the dype of the output is determined by the dtype of the fill_value. That's what happens in array_api_strict, for instance.

xp.full(1, xp.asarray(1.0, dtype=xp.float32))
# Array([1.], dtype=array_api_strict.float32)

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFCRequest for comments. Feature requests and proposed changes.

    Type

    No type

    Projects

    Status

    Stage 0

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions