tvm_tirx.tirx.script.function#
- tvm_tirx.tirx.script.function(function=None, **options)#
Parse a Python function into a function of the selected IR language variant.
- Parameters:
function (Callable, optional) – The function to be parsed. May be omitted to use the decorator with keyword options, such as
@T.function(private=True).private (bool, optional) – Whether the function should be treated as private. A private function has no global symbol attribute; a public function has a global symbol matching its name. Defaults to False.
check_well_formed (bool, optional) – Whether to check that the constructed function is well formed. Defaults to True. Module construction does not validate the completed module; call the language analysis API explicitly.
persistent (bool, optional) – For
T.function, mark the resulting function as a persistent kernel. Defaults to False. Seetvm_tirx.tirx.script.ir_builder.function().pure (bool, optional) – For
R.function, declare whether the function is pure, meaning that it has no observable side effects. Defaults to True. Seetvm.relax.script.ir_builder.function_().**options – Keyword options are forwarded to the selected language variant’s
function_()hook, exceptcheck_well_formed, which controls parser validation. Options supported by only one language variant are not shared betweenT.functionandR.function.
- Returns:
result (Function or relax.Function or Callable) – The parsed function, or a decorator when
functionis omitted. Class members retain their Python functions until the enclosing module is constructed.- Return type:
Any