We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c85f497 commit 288c3a8Copy full SHA for 288c3a8
src/data/dataloader.jl
@@ -109,8 +109,10 @@ _nobs(data::AbstractArray) = size(data)[end]
109
function _nobs(data::Union{Tuple, NamedTuple})
110
length(data) > 0 || throw(ArgumentError("Need at least one data input"))
111
n = _nobs(data[1])
112
- if !all(x -> _nobs(x) == n, Base.tail(data))
113
- throw(DimensionMismatch("All data should contain same number of observations"))
+ for i in keys(data)
+ ni = _nobs(data[i])
114
+ n == ni || throw(DimensionMismatch("All data inputs should have the same number of observations, i.e. size in the last dimension. " *
115
+ "But data[$(repr(first(keys(data))))] ($(summary(data[1]))) has $n, while data[$(repr(i))] ($(summary(data[i]))) has $ni."))
116
end
117
return n
118
0 commit comments