FluxML / FluxJS.jl

I heard you like compile times
Other
42 stars 8 forks source link

UndefRefError: access to undefined reference #5

Closed Roboneet closed 6 years ago

Roboneet commented 6 years ago

This example from README.md throws an UndefRefError.

julia> using Flux
julia> using FluxJS
julia> m = Chain(Dense(10,5,relu),Dense(5,2),softmax)
julia> @code_js m(rand(10))

ERROR: UndefRefError: access to undefined reference
Stacktrace:
 [1] lookup_var_if_var at /Users/joyp.isahac/.julia/v0.6/ASTInterpreter2/src/ASTInterpreter2.jl:147 [inlined]
 [2] lookup(::ASTInterpreter2.JuliaStackFrame, ::SSAValue) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:21
 [3] broadcast_t(::Function, ::Type{Any}, ::Tuple{Base.OneTo{Int64}}, ::CartesianRange{CartesianIndex{1}}, ::ASTInterpreter2.JuliaStackFrame, ::Array{Any,1}) at ./broadcast.jl:256
 [4] broadcast_c at ./broadcast.jl:319 [inlined]
 [5] broadcast(::Function, ::ASTInterpreter2.JuliaStackFrame, ::Array{Any,1}) at ./broadcast.jl:434
 [6] callargs(::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:29
 [7] runall(::FluxJS.BTrace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:34
 [8] overdub(::FluxJS.BTrace, ::Function) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [9] primitive(::FluxJS.Trace, ::Base.#broadcast, ::Function, ::Tuple{TrackedArray{…,Array{Float64,1}}}) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [10] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [11] overdub(::FluxJS.Trace, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [12] #trace#6(::FluxJS.Trace, ::Function, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [13] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at ./<missing>:0
 [14] #_traceλ#9(::FluxJS.Trace, ::Function, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:39
 [15] (::FluxJS.#kw##_traceλ)(::Array{Any,1}, ::FluxJS.#_traceλ, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at ./<missing>:0
 [16] #tracecall#13(::FluxJS.Trace, ::Function, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:50
 [17] (::FluxJS.#kw##tracecall)(::Array{Any,1}, ::FluxJS.#tracecall, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at ./<missing>:0
 [18] macro expansion at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:58 [inlined]
 [19] primitive(::FluxJS.Trace, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}, ::FluxJS.StagedArray{Float64,1}) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [20] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [21] overdub(::FluxJS.Trace, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [22] #trace#6(::FluxJS.Trace, ::Function, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [23] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Vararg{Any,N} where N) at ./<missing>:0
 [24] macro expansion at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:58 [inlined]
 [25] primitive(::FluxJS.Trace, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Flux.Dense{NNlib.#relu,TrackedArray{…,Array{Float64,2}},TrackedArray{…,Array{Float64,1}}}) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [26] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [27] overdub(::FluxJS.Trace, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [28] #trace#6(::FluxJS.Trace, ::Function, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [29] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Function, ::Function, ::Vararg{Any,N} where N) at ./<missing>:0
 [30] macro expansion at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:58 [inlined]
 [31] primitive(::FluxJS.Trace, ::Function, ::Function, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [32] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [33] overdub(::FluxJS.Trace, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [34] #trace#6(::FluxJS.Trace, ::Function, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [35] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Function, ::Function, ::Vararg{Any,N} where N) at ./<missing>:0
 [36] macro expansion at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:58 [inlined]
 [37] primitive(::FluxJS.Trace, ::Function, ::Function, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [38] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [39] overdub(::FluxJS.Trace, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [40] #trace#6(::FluxJS.Trace, ::Function, ::Function, ::Function, ::Vararg{Any,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [41] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Function, ::Function, ::Vararg{Any,N} where N) at ./<missing>:0
 [42] macro expansion at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:58 [inlined]
 [43] primitive(::FluxJS.Trace, ::Function, ::Function, ::FluxJS.StagedArray{Float64,1}, ::Array{Any,1}, ::Vararg{Array{Any,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/hooks.jl:24
 [44] runall(::FluxJS.Trace, ::DebuggerFramework.DebuggerState) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:37
 [45] overdub(::FluxJS.Trace, ::Flux.Chain, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/Vinyl/src/interpret.jl:53
 [46] #trace#6(::FluxJS.Trace, ::Function, ::Flux.Chain, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:30
 [47] (::FluxJS.#kw##trace)(::Array{Any,1}, ::FluxJS.#trace, ::Flux.Chain, ::FluxJS.StagedArray{Float64,1}, ::Vararg{FluxJS.StagedArray{Float64,1},N} where N) at ./<missing>:0
 [48] #_traceλ#9(::FluxJS.Trace, ::Function, ::Flux.Chain, ::Type{T} where T, ::Vararg{Type{T} where T,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:39
 [49] (::FluxJS.#kw##_traceλ)(::Array{Any,1}, ::FluxJS.#_traceλ, ::Flux.Chain, ::DataType, ::Vararg{DataType,N} where N) at ./<missing>:0
 [50] #traceλ#10(::FluxJS.Trace, ::Function, ::Flux.Chain, ::Type{T} where T, ::Vararg{Type{T} where T,N} where N) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/trace.jl:44
 [51] (::FluxJS.#kw##traceλ)(::Array{Any,1}, ::FluxJS.#traceλ, ::Flux.Chain, ::Type{T} where T, ::Vararg{Type{T} where T,N} where N) at ./<missing>:0
 [52] #compile#42 at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/compile.jl:102 [inlined]
 [53] compile(::Flux.Chain, ::Array{Float64,1}) at /Users/joyp.isahac/.julia/v0.6/FluxJS/src/compile.jl:101
MikeInnes commented 6 years ago

Not certain, but you might need to try Pkg.checkout("ASTInterpreter2").

Roboneet commented 6 years ago

That worked. Thanks!