goodfeli/Theano — pull request #8 by pascanur (2012-09-10 19:19:18+00:00)
Title: deal with the case when the grad on one output is undefined

This should fix the problem you were having with scan.