Summary:
This diff replaces the local optimizer with one that implements a little embedded DSL (domain specific language) so that it is easy to add local transformations. In fact, each transformation is specified as a single line. For example, to eliminate double negation we have the rule
{-(-x), x},
or to handle common identities, we have rules like
Summary: This diff replaces the local optimizer with one that implements a little embedded DSL (domain specific language) so that it is easy to add local transformations. In fact, each transformation is specified as a single line. For example, to eliminate double negation we have the rule
or to handle common identities, we have rules like
We also add a whole buncha new rules. This improves the performance of NUTS slightly beyond its previous performance.
The optimizer using this approach is actually quite a bit smaller than the brute force one.
This diff also reorganizes the sources a bit to put all the graph and node rewriters in their own directory.
Differential Revision: D40838954