GraphRecipes.jl icon indicating copy to clipboard operation
GraphRecipes.jl copied to clipboard

invalid index: 19.0

Open AStupidBear opened this issue 8 years ago • 6 comments

On julia 0.5

using PlotRecipes
code = :(function transform!{T}(act::Activation{:softmax,T})
            val = forward!(act.input)
            out = act.output.val
            for i=1:act.n
                out[i] = exp(val[i])
            end
            s = one(T) / sum(out)
            for i=1:act.n
                out[i] *= s
            end
            out
        end)

plot(code, fontsize=11, shorten=0.2, axis_buffer=0.05)

get

ArgumentError: invalid index: 19.0

 in getindex(::Array{Float64,1}, ::Float64) at array.jl:386
 in apportion(::Int64, ::Int64, ::NetworkLayout.Buchheim.Tree{Array{Array{Int64,1},1},Array{FixedSizeArrays.Point{2,Float64},1},Array{Float64,1}}) at buchheim.jl:128
 in first_walk(::Int64, ::NetworkLayout.Buchheim.Tree{Array{Array{Int64,1},1},Array{FixedSizeArrays.Point{2,Float64},1},Array{Float64,1}}) at buchheim.jl:86
 in first_walk(::Int64, ::NetworkLayout.Buchheim.Tree{Array{Array{Int64,1},1},Array{FixedSizeArrays.Point{2,Float64},1},Array{Float64,1}}) at buchheim.jl:85
 in layout! at buchheim.jl:49 [inlined]
 in #layout#3 at buchheim.jl:44 [inlined]
 in (::NetworkLayout.Buchheim.#kw##layout)(::Array{Any,1}, ::NetworkLayout.Buchheim.#layout, ::Array{Array{Int64,1},1}) at <missing>:0
 in #buchheim_graph#8(::Array{Float64,1}, ::Symbol, ::Float64, ::Void, ::Int64, ::Array{Any,1}, ::Function, ::Array{Array{Int64,1},1}) at graph_layouts.jl:151
 in (::PlotRecipes.#kw##buchheim_graph)(::Array{Any,1}, ::PlotRecipes.#buchheim_graph, ::Array{Array{Int64,1},1}) at <missing>:0
 in macro expansion at graphs.jl:268 [inlined]
 in apply_recipe(::Dict{Symbol,Any}, ::PlotRecipes.GraphPlot) at RecipesBase.jl:238
 in _process_userrecipes(::Plots.Plot{Plots.PyPlotBackend}, ::Dict{Symbol,Any}, ::Tuple{Expr}) at pipeline.jl:73
 in _plot!(::Plots.Plot{Plots.PyPlotBackend}, ::Dict{Symbol,Any}, ::Tuple{Expr}) at plot.jl:171
 in (::Plots.#kw##plot)(::Array{Any,1}, ::Plots.#plot, ::Expr) at <missing>:0

AStupidBear avatar May 02 '17 14:05 AStupidBear

Looks like the error is thrown from NetworkLayout?

mkborregaard avatar May 02 '17 14:05 mkborregaard

Yes, do you have this issue on your computer?

AStupidBear avatar May 03 '17 02:05 AStupidBear

Yes

mkborregaard avatar May 03 '17 08:05 mkborregaard

Hello @AStupidBear This issue was fixed in the master branch of NetworkLayout but that commit is not included in the release version. Can you please try executing your code in the latest master branch of NetworkLayout? Please post here if the issue persist. A new release supporting 0.6 will be pushed later this weekend. This issue will be fixed in the release version then.

abhijithanilkumar avatar May 04 '17 18:05 abhijithanilkumar

@abhijithanilkumar is this because of something that is implemented in a new way (i.e. do we need to set a version number of NetworkLayout for the new version of PlotRecipes?).

mkborregaard avatar May 04 '17 18:05 mkborregaard

No you need not. This issue was addressed after the previous release. The new release that supports 0.6 will be pushed soon, that will address this issue as well. For now, just checkout to master branch of NetworkLayout before using it.

abhijithanilkumar avatar May 04 '17 19:05 abhijithanilkumar

Appears to be fixed.

t-bltg avatar Sep 18 '22 16:09 t-bltg