Error when use casadi.conditional function

Hi,
In python code, my code cause following error when I use casadi.conditional function:

RuntimeError: …/casadi/core/matrix_impl.hpp:1178: Assertion “is_scalar()” failed:
Can only convert 1-by-1 matrices to scalars

Why do these errors occur? And how do I fix it?
Thanks a lot!