x=[1 2; 3 4] and
y=copy(x) I want to stack the two arrays together on the 4th dimension.
xy = cat(x, y, dims=4) will get what I wanted
However the above is fine but when you apply the same technique to a large data such as the MNIST dataset the speed is really slow e.g.
using Flux, Flux.Data.MNIST imgs = MNIST.images() X = cat(float.(imgs)..., dims = 4) # SLOW!!!
What’s the most efficient code to create
X? (which is done by stacking 60,000 28x28 matrices together on the 4th dimension.)