Throw clearererror

This commit is contained in:
mcDandy
2026-04-14 13:31:04 +02:00
parent 58287392fb
commit ad9f747c5b
+7 -4
View File
@@ -2550,10 +2550,13 @@ class UnifiedMathVisitor(MathExprVisitor):
def _bitwise_op(self, a, b, torch_op, scalar_op,ctx):
"""Binary bitwise operation handler supporting tensors, lists, and scalars."""
if self._is_tensor(a) and a.numel() == 1:
a = int(a.flatten()[0].item())
if self._is_tensor(b) and b.numel() == 1:
b = int(b.flatten()[0].item())
try:
if self._is_tensor(a) and a.numel() == 1:
a = int(a.flatten()[0].item())
if self._is_tensor(b) and b.numel() == 1:
b = int(b.flatten()[0].item())
except Exception as e:
raise ValueError(f"Invalid tensor value for bitwise operation: {e}")
# Handle tensor-list combinations
if self._is_tensor(a) and self._is_list(b):