Specifying loss functions in Flux.jl

zip doesn’t work the way you hope:

julia> iterate(dataset)
((0.8517903f0, 4.1195936f0), (2, 2))

It is iterating the flat array, not the rows. Instead, try DataLoader

dataset = Flux.Data.DataLoader((x, y))

Then your Attempt 3 works correctly.

3 Likes