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

Use nograd keyword for functions too #71

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Use nograd keyword for functions too #71

wants to merge 6 commits into from

Conversation

mcabbott
Copy link
Owner

@mcabbott mcabbott commented Dec 18, 2020

julia> using Tullio, Tracker, ForwardDiff

julia> plus10(x) = x + 10; # a function unknown to DiffRules

julia> Tracker.gradient(rand(3)) do x
         @tullio res := x[k] * plus10(k)  verbose=true
       end
┌ Warning: symbolic gradient failed
│   err = "no diffrule found for function plus10(_)."
└ @ Tullio ~/.julia/dev/Tullio/src/macro.jl:1260
ERROR: no gradient definition here!

julia> Tracker.gradient(rand(3)) do x
         @tullio res := x[k] * plus10(k)  grad=Dual  # old solution
       end
([11.0, 12.0, 13.0] (tracked),)

julia> Tracker.gradient(rand(3)) do x
         @tullio res := x[k] * plus10(k)  nograd=plus10  # new solution
       end
([11.0, 12.0, 13.0] (tracked),)

Needs a test, but #57 is re-organising them.

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 this pull request may close these issues.

1 participant