JuliaAttic / ReverseDiffSource.jl

Reverse automated differentiation from source
MIT License
47 stars 12 forks source link

no rule for differentiating a+b+c #25

Closed baggepinnen closed 8 years ago

baggepinnen commented 8 years ago

Differentiating x + y + z does not work, but (x + y) + z is okay

function foo(x,y,z)
    return x + y + z
end
rdiff(foo,(1,1,1))
ERROR: no derivation rule for + at arg #1 for signature Tuple{Int64,Int64,Int64}

function foo(x,y,z)
    return (x + y) + z
end

rdiff(foo,(1,1,1))
fredo-dedup commented 8 years ago

n-ary operations, with n > 2, are supposed to be broken down into binary ops automatically by ReverseDiffSource. It does work with expressions but not anymore with functions. It is probably caused by a change in the AST format produced by Julia. This is a bug, I'll look into it.

fredo-dedup commented 8 years ago

Corrected in latest commit in master.