mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 12:54:11 +08:00
Fixes for CPython int/float tests (#155978)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/155978 Approved by: https://github.com/zou3519
This commit is contained in:
committed by
PyTorch MergeBot
parent
d0cfa3e5bf
commit
216bd6091e
@ -1277,6 +1277,12 @@ class BuiltinVariable(VariableTracker):
|
||||
if isinstance(args[0], ConstantVariable):
|
||||
return args[0].call_method(tx, name, args[1:], kwargs)
|
||||
|
||||
if self.fn is float and len(args) >= 1:
|
||||
if isinstance(args[0], ConstantVariable):
|
||||
return ConstantVariable.create(
|
||||
getattr(float, name)(args[0].as_python_constant())
|
||||
)
|
||||
|
||||
return super().call_method(tx, name, args, kwargs)
|
||||
|
||||
def _call_int_float(self, tx: "InstructionTranslator", arg):
|
||||
@ -2062,7 +2068,6 @@ class BuiltinVariable(VariableTracker):
|
||||
"assertNotWarns",
|
||||
"assertWarnsRegex",
|
||||
"assertDictEqual",
|
||||
"assertSequenceEqual",
|
||||
"assertWarns",
|
||||
)
|
||||
):
|
||||
|
Reference in New Issue
Block a user