We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
adapt_structure
StepRangeLen
eltype
adapt_structure for StepRangeLen,
Adapt.jl/src/base.jl
Lines 79 to 80 in 5ef7c53
does not preserve the eltype of the range. For example:
julia> r = range(Float32(1), Float32(2), length=3); typeof(r) StepRangeLen{Float32, Float64, Float64, Int64} julia> using Adapt julia> r_adapted = Adapt.adapt_structure(nothing, r); typeof(r_adapted) StepRangeLen{Float64, Float64, Float64, Int64}
It's because the constructor called by adapt_structure has a different rule for working out the eltype than range, I suppose...
range
https://github.com/JuliaLang/julia/blob/9850a3881221a57a382e98c9b9ae2bf97ac3966d/base/range.jl#L524-L525
It's not a problem for Float64 ranges.
Float64
I think it's an easy fix by using the constructor StepRangeLen{T}(r.ref, r.step, r.len, r.offset).
StepRangeLen{T}(r.ref, r.step, r.len, r.offset)
The text was updated successfully, but these errors were encountered:
cc @ali-ramadhan
x-ref CliMA/Oceananigans.jl#3870
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
adapt_structure
forStepRangeLen
,Adapt.jl/src/base.jl
Lines 79 to 80 in 5ef7c53
does not preserve the
eltype
of the range. For example:It's because the constructor called by
adapt_structure
has a different rule for working out the eltype thanrange
, I suppose...https://github.com/JuliaLang/julia/blob/9850a3881221a57a382e98c9b9ae2bf97ac3966d/base/range.jl#L524-L525
It's not a problem for
Float64
ranges.I think it's an easy fix by using the constructor
StepRangeLen{T}(r.ref, r.step, r.len, r.offset)
.The text was updated successfully, but these errors were encountered: