joschu / cgt

Computation Graph Toolkit
Other
628 stars 87 forks source link

Bug in graph simplification #49

Closed sbos closed 8 years ago

sbos commented 8 years ago

I have a baseline parameter in my program which is subtracted from gradients and not used to compute the actual function I'm optimizing. However, changing that parameter affects not just gradient computation, but the returned function value as well. This behaviour is present only if enable_simplification = True.

The code is here https://gist.github.com/sbos/65ea08d5885660625fd3 The three values it prints should be nearly equal, but setting enable_simplification = True makes the second one close to zero.

joschu commented 8 years ago

Thanks for pointing out this bug with a simple code example. I'm looking into it now.

joschu commented 8 years ago

Oops, I misspoke in my recent commit -- I fixed a bug in the in-place optimization, but there's still a problem with your script. I'll keep at it...

(This part of the code needs MUCH more careful testing/specification/documentation, I know)