Skip to content

[RFC]: make axis kwarg optional in squeeze #892

Closed as not planned
Closed as not planned
@ev-br

Description

@ev-br

Cross-referencing from data-apis/array-api-strict#62 :

The standard's version of squeeze has axis as a required argument (https://data-apis.org/array-api/2023.12/API_specification/generated/array_api.squeeze.html#array_api.squeeze), while virtually all array libraries allow axis=None with the semantics of "remove all singleton dimensions":

  • torch.squeeze(input: Tensor, dim: Optional[Union[int, List[int]]])
  • numpy.squeeze(a, axis=None)
  • jax.numpy.squeeze(a, axis=None)

Is there any deep reason to not follow the suit and allow the axis to be Optional[ int | tuple]?

Metadata

Metadata

Assignees

No one assigned

    Labels

    API changeChanges to existing functions or objects in the API.Needs DiscussionNeeds further discussion.RFCRequest for comments. Feature requests and proposed changes.topic: ManipulationArray manipulation and transformation.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions