Giter Club home page Giter Club logo

Comments (5)

MikeInnes avatar MikeInnes commented on June 18, 2024 1

Maybe this can be fixed by making trace try all the options in the union separately and then trying to do a union of the types.

That's probably a good way to go for a general fix; basically try and generate an appropriate switch statement that calls the right method.

In this specific case we should really just do type narrowing; i.e. knowing that we are in the body of the loop, so i can't be nothing.

If you have a need for this I can take a look at implementing it. Right now I haven't had a use case since loops get unrolled for e.g. XLA.

from mjolnir.jl.

shashi avatar shashi commented on June 18, 2024 1

No need immediately. Just thought there should be an issue.

from mjolnir.jl.

shashi avatar shashi commented on June 18, 2024

In this specific case we should really just do type narrowing; i.e. knowing that we are in the body of the loop, so i can't be nothing.

good point, I think that would also lead to this actually compute the result as opposed to an IR with switch statements.

from mjolnir.jl.

Roger-luo avatar Roger-luo commented on June 18, 2024

I got this error too, is there any update on this?

from mjolnir.jl.

femtomc avatar femtomc commented on June 18, 2024

The error is now different on master:

ERROR: LoadError: Tracing Error: MethodError: abstract(::Main.BrokenUnion.Mjolnir.Basic, ::Main.BrokenUnion.Mjolnir.Const{typeof(getindex)}, ::Main.BrokenUnion.Mjolnir.Const{Array{Int64,1}}, ::Main.BrokenUnion.Mjolnir.Const{Int64}) is ambiguous. Candidates:
  abstract(::Main.BrokenUnion.Mjolnir.Basic, 461::Union{Main.BrokenUnion.Mjolnir.Const{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Node{typeof(getindex)}, Type{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Partial{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Shape{typeof(getindex)}}, xs::Main.BrokenUnion.Mjolnir.Const{var"#s35"} where var"#s35"<:Array, i::Main.BrokenUnion.Mjolnir.Const...) in Main.BrokenUnion.Mjolnir at /home/mccoy/code/julia/Mjolnir.jl/src/macros.jl:55
  abstract(::Main.BrokenUnion.Mjolnir.Basic, 475::Union{Main.BrokenUnion.Mjolnir.Const{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Node{typeof(getindex)}, Type{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Partial{typeof(getindex)}, Main.BrokenUnion.Mjolnir.Shape{typeof(getindex)}}, xs::Union{Type{var"#s34"}, Main.BrokenUnion.Mjolnir.Const{var"#s34"}, Main.BrokenUnion.Mjolnir.Node{var"#s34"}, Main.BrokenUnion.Mjolnir.Partial{var"#s34"}, Main.BrokenUnion.Mjolnir.Shape{var"#s34"}} where var"#s34"<:(AbstractArray{T,N} where N), is::Union{Type{var"#s28"}, Main.BrokenUnion.Mjolnir.Const{var"#s28"}, Main.BrokenUnion.Mjolnir.Node{var"#s28"}, Main.BrokenUnion.Mjolnir.Partial{var"#s28"}, Main.BrokenUnion.Mjolnir.Shape{var"#s28"}} where var"#s28"<:Integer...) where T in Main.BrokenUnion.Mjolnir at /home/mccoy/code/julia/Mjolnir.jl/src/macros.jl:55
To resolve the ambiguity, try making one of the methods more specific, or adding a new method more specific than any of the existing applicable methods.
in Tuple{typeof(Main.BrokenUnion.g),Array{Int64,1}}

from mjolnir.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.