Skip to content

Feature idea: Infer implicit dimension value in 'reshape' #4250

@malmaud

Description

@malmaud

In numpy, I can write

x=rand(10)
and then to reshape x to a (5,2) array, write either
reshape(x, (5, -1))
or
reshape(x, (-1, 2))
instead of
reshape(x, (5,2))

It's convenient since one of the dimensions to reshape is always implicitly defined by the other, and numpy lets you use -1 to signal the dimension whose value should be inferred from the others.
Any interest in having julia's reshape have the same functionality? I could implement it.

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