-
Notifications
You must be signed in to change notification settings - Fork 115
Fix zero gradient for subtensor assignment. #127
base: master
Are you sure you want to change the base?
Conversation
Will merge when Assignment test passes on CI On Fri, May 27, 2016 at 5:38 PM Bart van Merriënboer <
|
The test that I added fails on the current master as well, it's a bug somewhere in optimized mode. I'd have to get a bit more familiar with the details of optimized mode before I can fix that. |
Maybe someone with better knowledge of the optimized mode internals can understand what is going on. The problem seems to be this line in mutationFlow:alias(self.inputs[1], valueAlias) Unlike aliasOp = graph.mutationFlow.history[i]
addNodeTargets(aliasOp.from.source.node, hazardNodes)
|
The variable that is being assigned has its gradient correctly calculated (g[k]) but later on when the gradient of the variable being assigned to is calculated g[k] is set to 0. This gives the correct gradient for the variable being assigned to, but because it shares the same storage it actually overrides the earlier gradient incorrectly to zero. This fixes that.
Because I need this for something else as well now, another stab at it. I'm using However, now the test for optimized mode fails for another reason: The gradient gets computed correctly the first time |
@luketwitter @alexbw Although I can't figure out the current bug in optimized mode triggered by the new unit test I added, can I propose at least merging my changes to I made a new PR for this: #139 |
|
@alexbw Partially fixes #126 and adds a unit test. It gives the correct answer in direct mode now, but still crashes in optimized mode.