revert selectdim

selectdim can lead to type instability, see https://discourse.julialang.org/t/why-selectdim-is-type-instable/25271/5
This commit is contained in:
cossio 2020-06-13 14:19:42 +02:00
parent 1dbaf32810
commit 9078f85096
1 changed files with 1 additions and 1 deletions

View File

@ -104,7 +104,7 @@ function _nobs(data::Union{Tuple, NamedTuple})
return n
end
_getobs(data::AbstractArray, i) = selectdim(data, ndims(data), i)
_getobs(data::AbstractArray, i) = data[ntuple(i -> Colon(), Val(ndims(data) - 1))..., i]
_getobs(data::Union{Tuple, NamedTuple}, i) = map(Base.Fix2(_getobs, i), data)
Base.eltype(::DataLoader{D}) where D = D