Moved consider_constant from theano.tensor.extra_ops to theano.gradient, moved the optimization that removes it to theano.tensor.opt. Modified theano.compile.builders so it doesn't import theano.gradient, because theano.gradient now imports ViewOp from theano.compile and this would lead to a circular dependency.