Giter VIP home page Giter VIP logo

Comments (3)

mcabbott avatar mcabbott commented on May 23, 2024 2

That's not good! Can reproduce the crash. I think it's reading out of bounds, but am not yet sure why. It seems to be inferring the correct ranges, but the result clearly doesn't come from arr:

julia> using Tullio

julia> @tullio verbose=true

julia> function f(arr)
           @tullio res1 = arr[i, k] - arr[i - 1, k]
           @tullio res2 = arr[i, k] - arr[i, k + 1]
           return res1 + res2
       end

julia> arr = [1 2; 3 4]

julia> f(arr)
[ Info: left index ranges
┌ Info: reduction index ranges
│   i = 2:2
└   k = Base.OneTo(2)
[ Info: left index ranges
┌ Info: reduction index ranges
│   i = Base.OneTo(2)
└   k = 1:1
-5679683831

I think it's a scope problem, that one of the functions defined by the first macro is escaping and being called by the second, now with the wrong ranges. (I thought I had tests for this, but clearly not sensitive enough ones.) Probably just needs one more let block:

julia> function h(arr)
           res1 = let 
           @tullio res1 = arr[i, k] - arr[i - 1, k]
           end
           res2 = let
           @tullio res2 = arr[i, k] - arr[i, k + 1]
           end
           return res1 + res2
       end
h (generic function with 1 method)

julia> h(arr)
2

julia> print(Zygote.gradient(h, arr))
([0 -2; 2 0],)

from tullio.jl.

mcabbott avatar mcabbott commented on May 23, 2024 1

I will fix it for sure, but it might not be today.

from tullio.jl.

roflmaostc avatar roflmaostc commented on May 23, 2024

I can confirm that the let blocks work 🥰

You still want to fix it or keep it like that?
At least for me the workaround is good for the moment.

from tullio.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.