Pipe operator with multiple instances

broadcasting always works for each element in a container, it can’t know that you think of the last dimension as the “sample” dimension. But with eachslice you can make an iterator out of your array that has the desired property:

julia> data = rand(513, 321, 1, 2)

julia> eachslice(data, dims = 4) .|> size

2-element Vector{Tuple{Int64, Int64, Int64}}:
 (513, 321, 1)
 (513, 321, 1)
3 Likes