Skip to content

bug in stack for collection of abstract arrays #56771

Open
@CarloLucibello

Description

The following issue is present on both julia 1.10.7 and 1.11.2

julia> x = [ones(2,3) for _=1:4];  # CORRECT BEHAVIOR

julia> stack(x, dims=1) |> size
(4, 2, 3)

julia> stack(x, dims=2) |> size
(2, 4, 3)

julia> stack(x, dims=3) |> size
(2, 3, 4)

julia> y = AbstractArray[ones(2,3) for _=1:4]; # NOW THE PROBLEM

julia> stack(y, dims=1) |> size
(4, 2, 3)

julia> stack(y, dims=2) |> size # THIS IS WRONG
(2, 3, 4)

julia> stack(y, dims=3) |> size
(2, 3, 4)

julia> stack(y, dims=2) == stack(y, dims=3) # THIS IS WRONG
true

With y = Any[ones(2,3) for _=1:4] no problems instead.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    arrays[a, r, r, a, y, s]bugIndicates an unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions