Multilayer perceptron with multidimensional output array using Flux

Note that Flux.jl expects data in the format nfeatures x nsamples. This is different from most machine learning frameworks and different from what you did.

using Flux
nsamples = 10; in_features = 6; out_features = 3;
X = randn(Float32, in_features, nsamples);
Y = randn(Float32, out_features, nsamples);
data = Flux.Data.DataLoader((X,Y), batchsize=4); # automatic batching convenience
X1, Y1 = first(data); 
@show size(X1) size(Y1)

If you really want to feed your model with some other kind of data format or non array types then you can use the pattern:

model = Flux.Chain(to_flux_format, some, flux, layers, from_flux_format)