-
-
Notifications
You must be signed in to change notification settings - Fork 37
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
Readme example with Flux no longer works #146
Comments
This is a side-effect of FluxML/Flux.jl#2156, apparently there were zero tests. It never got an issue, nor an attempt to fix. I think simplest would be a method |
Not sure that diagnosis is correct. Here's a related easier problem, where julia> withgradient(model, rand(2)) do m, x # now x is Vector{Float64}, _match_eltype tries to convert, and fails
sum(abs2, m(x))
end
ERROR: Not implemented: convert tracked Float64 to tracked Float32
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:35
[2] convert(::Type{Tracker.TrackedReal{Float32}}, x::Tracker.TrackedReal{Float64})
@ Tracker ~/.julia/packages/Tracker/tdXqL/src/lib/real.jl:41
[3] setindex!(A::Vector{Tracker.TrackedReal{Float32}}, x::Tracker.TrackedReal{Float64}, i1::Int64)
@ Base ./array.jl:1019
[4] copyto_unaliased!(deststyle::IndexStyle, dest::AbstractArray, srcstyle::IndexStyle, src::AbstractArray)
@ Base ./abstractarray.jl:1089 [inlined]
[5] copyto!(dest::Vector{Tracker.TrackedReal{Float32}}, src::TrackedArray{…,Vector{Float64}})
@ Base ./abstractarray.jl:1063
[6] copyto_axcheck!(dest::Any, src::Any)
@ Base ./abstractarray.jl:1172 [inlined]
[7] AbstractArray{T, N}(A::AbstractArray{S, N}) where {T, N, S}
@ Base ./array.jl:672 [inlined]
[8] (AbstractArray{T})(A::AbstractArray{S, N}) where {T, S, N}
@ Core ./boot.jl:501 [inlined]
[9] convert
@ Base ./abstractarray.jl:17 [inlined]
[10] _match_eltype
@ Flux ~/.julia/packages/Flux/r3RWW/src/layers/stateless.jl:77 [inlined]
[11] _match_eltype
@ Flux ~/.julia/packages/Flux/r3RWW/src/layers/stateless.jl:84 [inlined]
[12] (::Dense{typeof(tanh), TrackedArray{…,Matrix{…}}, Vector{Tracker.TrackedReal{…}}})(x::TrackedArray{…,Vector{Float64}}) For the one above, notice julia> using Tracker, Flux
julia> x = param(rand32(2))
Tracked 2-element Vector{Float32}:
0.066055834f0
0.49695432f0
julia> m = Dense(param(randn32(3,2)))
Dense(2 => 3) # 9 parameters
julia> m(x)
Tracked 3-element Vector{Tracker.TrackedReal{Float32}}:
0.17689592f0
0.32748032f0
0.5916688f0 But fixing that (by adjusting |
I realize this package is half archived, but in case someone happens to see this and knows an easy fix.
Looks like it should "just" be a matter of implementing the Float32 conversion, although I don't know if it should be a noop or return the tracked float.
The text was updated successfully, but these errors were encountered: