Skip to content

[Feature Request] + to match "at least one"/"1 or more" array axes #378

Description

@pdcook

Currently, there is the * modifier to match "0 or more" axes. I think it would be very useful to have the closely related "1 or more" axes modifier, perhaps using +. For example:

Float[Array, "batch *features"] would match arrays with a batch dimension and any number of features, but also matches arrays with no feature axes.

Float[Array, "batch +features"] would only match arrays with a batch dimension and at least one more axis. So [b, a, b, c], [b, a], [b, 1] would all pass, but [b] would not.

Currently, this can be achieved by manually specifying that one differently named axis is present:

Float[Array, "batch feature0 *features"]

But I think it would be both more concise and clear with the + modifier.

Let me know if I'm missing anything with this idea, and thanks again for all your work on this package and the many others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions