Vector-valued function in multidimensional list comprehension (Differentiable code)

In Julia 1.9, this is possible with stack :slightly_smiling_face:

julia> f(x,y) = rand(2,3)
f (generic function with 1 method)

julia> stack([f(x,y) for x in 1:4, y in 1:5]) |> size
(2, 3, 4, 5)
1 Like