Nested Vectors/Arrays to multidimensional tensor

I have some packages which may interest you (one just announced this week):

julia> data = [ [rand(13,14) for i in 1:12] for j in 1:11];

julia> using LazyStack 

julia> stack(stack.(data)) |> size # this is a view, copy for Array
(13, 14, 12, 11)

julia> permutedims(stack(stack.(data)), (4,3,1,2)) |> size
(11, 12, 13, 14)

julia> using TensorCast

julia> size(@cast out[a,b,c,d] := data[a][b][c,d])
(11, 12, 13, 14)
2 Likes