Skip to content

reshape view doesn't infer shape from -1 #2417

@JosephSummerhays1

Description

@JosephSummerhays1

#926

behold my code:

int main() {                   
    xt::xarray<float> a = xt::zeros<float>({3, 3, 3});
    auto b = xt::reshape_view(a, {3, -1});
    cout << xt::adapt(a.shape()) << endl;
    cout << xt::adapt(b.shape()) << endl;
}

and it's unexpected output

{3, 3, 3}
{                   3, 18446744073709551615}

While nowhere in the documentation does it claim to handle -1 as numpy does, and this is probably just my fault for assuming this, it would be very convenient if it did.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions