# DataLoader compatibility passing a vector of graphs and
# effectively using `batch` as a collated function.
MLUtils.numobs(data::Vector{<:GNNGraph}) = length(data)
MLUtils.getobs(data::Vector{<:GNNGraph}, i::Int) = data[i]
MLUtils.getobs(data::Vector{<:GNNGraph}, i) = Flux.batch(data[i])
that make for a nice interaction with MLUtils.DataLoader since we have automatic batching a.k.a. collating.
On the other hand, this doesn't well play well with other transformations in MLUtils, where one ends up with a batched graph even if they didn't want to:
Let's wait for the outcome of the discussion in https://github.com/JuliaML/MLUtils.jl/issues/90 and for whatever DataLoader Flux is exporting to have a collate option before solving this issue.
We currently have the following definitions
that make for a nice interaction with
MLUtils.DataLoader
since we have automatic batching a.k.a. collating.On the other hand, this doesn't well play well with other transformations in MLUtils, where one ends up with a batched graph even if they didn't want to:
We should remove the automatic batching from here, and the
DataLoader
itself should provide automatic batching by callingMLUtils.batch