The if is nested inside at least one T.serial loop There is at least one TIR-level conditional between the T.serial and the if The workaround (T.cast(sparse_mode, "int32")) works because it prevents ...