try using
import theano.tensor as tt
tt.printing.Print('a')(a.shape)
to find out the shape of a[2] and b[1:5].
Also, your sub-vectors are probably 1-dimensional. Try to use the axis keyword to explicitly state in which direction to join them, as in
pm.math.stack( [ a[2], b[1:5] ] , axis = 0)
(sorry that i cannot test/confirm that atm)