Add assert about the shape in the graph.

Theano remove shapes errors at many places where 0s and 1s are involved. This PR remove such a case by puting an Assert op in the graph. So it replace an ValueError by an AssertionError instead of removing it.

I think we should do it in this case, as we replace a dot by an assert. But I'm not sure this is a general solution for all such cases. What do you think?

reported in gh-1738 by Marc-Alexandre Côté.