Why zip the data argument to the `Flux::train!` function?

julia> zz = zip([1,2,3], ["a","b","c"])
Base.Iterators.Zip{Tuple{Array{Int64,1},Array{String,1}}}(([1, 2, 3], ["a", "b", "c"]))

julia> for (x, y) in zz
           @show x, y
       end
(x, y) = (1, "a")
(x, y) = (2, "b")
(x, y) = (3, "c")

you’re right, the zipped thing can be iterated over and each element is a pair of input and output (of your ML model)

and in the example you linked, it looks like this is mainly for maintaining the type requirement, not for zipping input and label together

1 Like