MCPcopy Create free account
hub / github.com/pytorch/pytorch / create

Method create

torch/_dynamo/variables/tensor.py:782–793  ·  view source on GitHub ↗
(cls, tx, proxy, sym_num, **options)

Source from the content-addressed store, hash-verified

780
781 @classmethod
782 def create(cls, tx, proxy, sym_num, **options):
783 if "example_value" in proxy.node.meta:
784 assert proxy.node.meta["example_value"] == sym_num
785 if sym_num is None:
786 sym_num = get_fake_value(proxy.node, tx)
787 proxy.node.meta["example_value"] = sym_num
788
789 if isinstance(sym_num, (sympy.Integer, int, bool)):
790 sym_num = int(sym_num) if isinstance(sym_num, sympy.Integer) else sym_num
791 return ConstantVariable.create(sym_num)
792
793 return SymNodeVariable(proxy, sym_num, **options)
794
795 def __init__(self, proxy, sym_num, **kwargs):
796 super().__init__(**kwargs)

Callers 15

dynamo_enable_gradFunction · 0.45
call_functionMethod · 0.45
call_functionMethod · 0.45
call_functionMethod · 0.45
call_functionMethod · 0.45
_call_min_max_binaryMethod · 0.45
call_absMethod · 0.45
call_rangeMethod · 0.45
call_callableMethod · 0.45
call_enumerateMethod · 0.45
call_isinstanceMethod · 0.45

Calls 3

get_fake_valueFunction · 0.85
isinstanceFunction · 0.85
SymNodeVariableClass · 0.85

Tested by

no test coverage detected