MCPcopy Index your code
hub / github.com/apache/tvm / __call__

Method __call__

python/tvm/ir/expr.py:83–108  ·  view source on GitHub ↗

Call the global variable. Parameters ---------- args: List[RelaxExpr] The arguments to the call. Returns ------- call: BaseExpr A call taking the variable as a function.

(self, *args: RelaxExpr)

Source from the content-addressed store, hash-verified

81 self.__init_handle_by_constructor__(_ffi_api.GlobalVar, name_hint)
82
83 def __call__(self, *args: RelaxExpr) -> BaseExpr:
84 """Call the global variable.
85
86 Parameters
87 ----------
88 args: List[RelaxExpr]
89 The arguments to the call.
90
91 Returns
92 -------
93 call: BaseExpr
94 A call taking the variable as a function.
95 """
96 # pylint: disable=import-outside-toplevel
97
98 # TODO(@relax-team): replace with Relax base class after it's introduced
99 if all(isinstance(x, RelaxExpr) for x in args):
100 from tvm import relax
101
102 return relax.Call(self, args)
103
104 elif all(isinstance(x, Number | PrimExpr) for x in args):
105 return tvm.tirx.call_tir(self, *args)
106
107 arg_types = [type(x) for x in args]
108 raise RuntimeError(f"Do not know how to handle GlobalVar.__call__ for types {arg_types}")
109
110
111@tvm_ffi.register_object("ir.Range")

Callers

nothing calls this directly

Calls 2

call_tirMethod · 0.80
allFunction · 0.50

Tested by

no test coverage detected