-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scalar indexing in getobs
#120
Comments
Seems like this happens when x = rand(Float32, 10)
y = rand(Float32, 10)
loader = DataLoader(Popt.metal((x, y)); batchsize = 1)
first(loader) # => OK
loader = DataLoader(Popt.metal((x, y)); batchsize = 1, shuffle = true)
first(loader) # => ERROR |
This appears to be the exact same issue as FluxML/Flux.jl#1935 which was fixed by #73 (and the tests added from that PR pass). I also tried reproducing the issue, and I could not: julia> using JLArrays
julia> JLArrays.allowscalar(false)
julia> x = convert(JLArray, rand(Float32, 3, 4))
3×4 JLArray{Float32, 2}:
0.734856 0.302647 0.0874875 0.85691
0.388475 0.916865 0.720555 0.273599
0.600191 0.806297 0.826627 0.988175
julia> y = convert(JLArray, rand(Float32, 2, 4))
2×4 JLArray{Float32, 2}:
0.221076 0.757612 0.0133287 0.0798213
0.369356 0.8213 0.950042 0.130221
julia> view(x, :, 1:3)[:, 1:2]
ERROR: Scalar indexing is disallowed.
[...]
julia> d = DataLoader((x, y); batchsize = 1, shuffle = true)
DataLoader{Tuple{JLArray{Float32, 2}, JLArray{Float32, 2}}, Random._GLOBAL_RNG, Val{nothing}}((Float32[0.73485607 0.3026467 0.08748752 0.8569099; 0.38847476 0.9168652 0.7205551 0.27359885; 0.60019106 0.8062971 0.82662725 0.98817503], Float32[0.22107565 0.75761235 0.013328671 0.07982129; 0.36935622 0.8213003 0.9500422 0.13022065]), 1, false, true, true, false, Val{nothing}(), Random._GLOBAL_RNG())
julia> first(d)
(Float32[0.08748752; 0.7205551; 0.82662725;;], Float32[0.013328671; 0.9500422;;])
julia> length(collect(d))
4 Are you both sure you are running the latest MLUtils.jl? |
For me, Pluto somehow installed v0.2.1 instead of the latest version even though I made the notebook within the last month. Manually upgrading seems to fix the issue as expected. Hopefully, this is also the case for @chriselrod. |
When I ran my code 6 months ago or so, this worked without any scalar indexing, so this appears to be a regression.
The text was updated successfully, but these errors were encountered: