Custom conditional Keras metric
I'm assuming y_true and y_pred both are vectors. You are trying to apply a conditional on the value of a tensor. The library is telling you that it is not possible (tf.Tensor as Python bool).

You may want to check tensorflow control flow operations like tensorflow.equal