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

Method with_dispatch_token

python/tvm/script/parser/core/parser.py:419–444  ·  view source on GitHub ↗

Add a new dispatching token as with statement. Parameters ---------- token : str The dispatching token. Returns ------- res : Any The context with new dispatching token.

(self, token: str)

Source from the content-addressed store, hash-verified

417 return decorator.dispatch_token
418
419 def with_dispatch_token(self, token: str):
420 """Add a new dispatching token as with statement.
421
422 Parameters
423 ----------
424 token : str
425 The dispatching token.
426
427 Returns
428 -------
429 res : Any
430 The context with new dispatching token.
431 """
432
433 self.dispatch_tokens.append(token)
434 enter_func = dispatch.get(token=token, type_name="enter_token", default=lambda *args: None)
435 context = enter_func(self)
436
437 def pop_token():
438 exit_func = dispatch.get(
439 token=token, type_name="exit_token", default=lambda *args: None
440 )
441 exit_func(self, context)
442 self.dispatch_tokens.pop()
443
444 return _deferred(pop_token)
445
446 def set_class_context(self, class_name: str, is_base_py_module: bool = False):
447 """Set the current class context for parsing.

Callers 4

visit_function_defFunction · 0.80
_visit_class_defFunction · 0.80
visit_function_defFunction · 0.80

Calls 3

_deferredFunction · 0.85
appendMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected