We need it there. Only the op know the output shape. The infer_shape mechanism isn't developed enough to move the allocation of the output elsewhere in most case. So we can't verify it automatically. Also, what currently happen if you disable Theano gc and you call a theano function multiple time with different input shape, the preallocated output will be the previous one the apply node allocated. So it is normal that we can have wrong shape here, as the function input shape can change.

But yes, in the future, we could change that, but I don't have see a plan for that.