Theano/Theano — pull request #2323 by carriepl (2014-12-04 22:01:14+00:00)
Title: Scan push out sum of dot

This is work in progress to implement to optimization necessary to push a "Sum of dots" out of a scan. It is **not** ready for merge because the optimization doesn't get applied in the unit test TestPushOutSumOfDot.test_non_zero_init() which means that there is currently no test for the case where the initial value of the scan output to which the dot products are added is non-zero.

The optimization is, however, correctly applied in the TestPushOutSumOfDot.test_machine_translation() test case which comes from from https://github.com/rizar/scan-grad-speed

This also includes some refactoring of the optimization PushOutScanOutput to make the code simpler and more readable and also factor out the bits of code that are common between the different use cases of the optimization.