From 279462319402d48559fa9700337eb7c276ec4baa Mon Sep 17 00:00:00 2001 From: mcDandy Date: Sun, 25 Jan 2026 14:49:55 +0100 Subject: [PATCH] (AI) fix --- more_math/Parser/UnifiedMathVisitor.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/more_math/Parser/UnifiedMathVisitor.py b/more_math/Parser/UnifiedMathVisitor.py index b9acec2..8fd841a 100644 --- a/more_math/Parser/UnifiedMathVisitor.py +++ b/more_math/Parser/UnifiedMathVisitor.py @@ -159,7 +159,11 @@ class UnifiedMathVisitor(MathExprVisitor): true_t = self._promote_to_tensor(true_val) false_t = self._promote_to_tensor(false_val) - cond_t = torch.isclose(condition, torch.tensor(0.0, device=self.device)) == False + if true_t.dtype != false_t.dtype: + true_t = true_t.float() + false_t = false_t.float() + + cond_t = torch.isclose(condition.float(), torch.tensor(0.0, device=self.device)) == False return torch.where(cond_t, true_t, false_t).contiguous() if self._is_list(condition):