Skip to content
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

Problem with InlineStrings.jl #98

Closed
oysteinsolheim opened this issue Jan 7, 2022 · 3 comments · Fixed by #105
Closed

Problem with InlineStrings.jl #98

oysteinsolheim opened this issue Jan 7, 2022 · 3 comments · Fixed by #105

Comments

@oysteinsolheim
Copy link
Contributor

How can I work around the issue in InlineStrings JuliaStrings/InlineStrings.jl#21 ?
I don't make any sense of the suggested fix.

For example:

julia> using Flux
julia> using GraphNeuralNetworks

julia> g = rand_graph(2,2)
GNNGraph:
    num_nodes = 2
    num_edges = 2

julia> Flux.batch([g,g])
GNNGraph:
    num_nodes = 4
    num_edges = 4
    num_graphs = 2

julia> using InlineStrings

julia> Flux.batch([g,g])
ERROR: MethodError: defalg(::Vector{Union{}}) is ambiguous. Candidates:
  defalg(v::AbstractArray{<:Union{Missing, Number}}) in Base.Sort at sort.jl:658
  defalg(::AbstractArray{<:Union{Missing, String1, String15, String3, String7}}) in InlineStrings at /home/oystein/.julia/packages/InlineStrings/aWvyB/src/InlineStrings.jl:698
Possible fix, define
  defalg(::AbstractArray{<:Missing})
Stacktrace:
 [1] sort!(v::Vector{Union{}})
   @ Base.Sort ./sort.jl:711
 [2] sort(v::Vector{Union{}}; kws::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Base.Sort ./sort.jl:770
 [3] sort(v::Vector{Union{}})
   @ Base.Sort ./sort.jl:770
 [4] cat_features(x1::NamedTuple{(), Tuple{}}, x2::NamedTuple{(), Tuple{}})
   @ GraphNeuralNetworks.GNNGraphs ~/.julia/packages/GraphNeuralNetworks/KNr8R/src/GNNGraphs/utils.jl:22
 [5] blockdiag(g1::GNNGraph{Tuple{Vector{Int64}, Vector{Int64}, Nothing}}, g2::GNNGraph{Tuple{Vector{Int64}, Vector{Int64}, Nothing}})
   @ GraphNeuralNetworks.GNNGraphs ~/.julia/packages/GraphNeuralNetworks/KNr8R/src/GNNGraphs/transform.jl:177
 [6] batch(gs::Vector{GNNGraph{Tuple{Vector{Int64}, Vector{Int64}, Nothing}}})
   @ GraphNeuralNetworks.GNNGraphs ~/.julia/packages/GraphNeuralNetworks/KNr8R/src/GNNGraphs/transform.jl:256
 [7] top-level scope
   @ REPL[12]:1
 [8] top-level scope
   @ ~/.julia/packages/CUDA/iDsKe/src/initialization.jl:52
@CarloLucibello
Copy link
Member

Does defining the methods in https://github.com/JuliaLang/julia/pull/43426/files work for you?

@oysteinsolheim
Copy link
Contributor Author

Yes! Thank you! Didn't see the actual implementation there and got confused by the DEFAULT_UNSTABLE.
By doing

const DEFAULT_UNSTABLE = QuickSort
julia> Base.Sort.defalg(v::AbstractArray{Union{}}) = DEFAULT_UNSTABLE
julia> Base.Sort.defalg(v::AbstractArray{Missing}) = DEFAULT_UNSTABLE

everything seems to work fine. Thank you again!

@CarloLucibello
Copy link
Member

Good! Hope that gets merged soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants