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

Class Var

python/tvm/relax/expr.py:762–805  ·  view source on GitHub ↗

The variable class for all Relax bindings. Parameters ---------- name_hint: str | Id The name hint of the variable. struct_info: Optional[StructInfo] The struct info annotation of the variable. span: Optional[Span] Span that points to original source co

Source from the content-addressed store, hash-verified

760
761@tvm_ffi.register_object("relax.expr.Var")
762class Var(ExprWithOp):
763 """The variable class for all Relax bindings.
764
765 Parameters
766 ----------
767 name_hint: str | Id
768 The name hint of the variable.
769
770 struct_info: Optional[StructInfo]
771 The struct info annotation of the variable.
772
773 span: Optional[Span]
774 Span that points to original source code
775 """
776
777 vid: Id
778 span: Span | None
779
780 def __init__(
781 self,
782 name_hint: str | Id,
783 struct_info: StructInfo | None = None,
784 span: Span | None = None,
785 ) -> None:
786 if struct_info is not None:
787 struct_info = tvm.runtime.convert(struct_info)
788 if not isinstance(struct_info, StructInfo):
789 raise TypeError(
790 "struct_info needs to be an instance of StructInfo. "
791 "If you attempt to pass in shape, "
792 "use relax.TensorStructInfo(shape, dtype)."
793 )
794 self.__init_handle_by_constructor__(
795 _ffi_api.Var if isinstance(name_hint, str) else _ffi_api.VarFromId, # type: ignore
796 name_hint,
797 struct_info,
798 span,
799 )
800
801 @property
802 def name_hint(self) -> str:
803 """Get name hint of the current var."""
804 name = str(self.vid.name_hint)
805 return name
806
807
808@tvm_ffi.register_object("relax.expr.DataflowVar")

Callers 4

_create_param_varFunction · 0.50
get_functionMethod · 0.50
get_functionMethod · 0.50
get_functionMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected