Comments (5)
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.
No need immediately. Just thought there should be an issue.
from mjolnir.jl.
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.
I got this error too, is there any update on this?
from mjolnir.jl.
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)
- Sytanx sugar for automatically finding the return type in @abstract HOT 4
- Tracing through setfield! throws error
- Macro Hygiene issue? HOT 1
- Recursion and type inference HOT 3
- Organize test suite
- inline not defined HOT 1
- Cut a new tag with updated IRTools compat HOT 5
- Stabilize Mjolnir use inside of dynamos HOT 5
- simple function triggers an unexpected dimension mismatch error HOT 2
- @trace broken with some loops HOT 9
- Infer misses some branches
- Missing Key
- Minimum example of transpiling
- deepcopy of Modules not supported HOT 1
- Running tracked code as anon functions HOT 1
- Multiple dispatch fails in @trace
- self-test fails "Tracing Error: deepcopy of Modules not supported" HOT 3
- `@inbounds` HOT 3
- Ambiguous meaning of @trace f(Int) HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mjolnir.jl.