PyMC3 elementwise if condition

Phi is a TensorVariable that is drawn from a Bernoulli.
If I determine phi before initializing the model as a numpy array the code works.
Could it be that where or switchdoes not work for TensorVariables?