-
由 Olivier Delalleau 提交于
This stability optimization didn't work for at least three reasons: 1. It used tensor.neg(x) to identify -x, while in canonicalized form -x is written -1 * x. 2. There was a typo (calling a function sigm that didn't exist). 3. It wasn't able to parse a tree of multiplications, for instance something like (exp(x) * 2) * sigmoid(-x). This new version fixes all three issues. In order to solve problem #3, it uses a different approach that consists in parsing the optimized node into a so-called "multiplication tree". Currently, the structure of this tree is left unchanged. It would be possible to have this optimization also flatten the tree, which would make the code simpler (but potentially undo work performed by some other optimizations).
c42a7494