mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Raise exception in Dynamo if op fails in the interpreter (#158661)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/158661 Approved by: https://github.com/williamwen42 ghstack dependencies: #158660
This commit is contained in:
committed by
PyTorch MergeBot
parent
b67f97c166
commit
0204099762
@ -577,7 +577,14 @@ class BuiltinVariable(VariableTracker):
|
||||
|
||||
def create_cmp_op_handlers(op):
|
||||
def compare_by_value(tx: "InstructionTranslator", a, b):
|
||||
return ConstantVariable(op(a.value, b.value))
|
||||
try:
|
||||
return ConstantVariable(op(a.value, b.value))
|
||||
except TypeError as exc:
|
||||
raise_observed_exception(
|
||||
type(exc),
|
||||
tx,
|
||||
args=list(map(ConstantVariable.create, exc.args)),
|
||||
)
|
||||
|
||||
result: list[
|
||||
tuple[
|
||||
|
Reference in New Issue
Block a user