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

Method get_dispatch_token

python/tvm/script/parser/core/parser.py:408–417  ·  view source on GitHub ↗
(self, node: doc.FunctionDef)

Source from the content-addressed store, hash-verified

406 self.visit(node)
407
408 def get_dispatch_token(self, node: doc.FunctionDef) -> str:
409 if not isinstance(node, doc.FunctionDef):
410 self.report_error(node, "Only can get dispatch token for function.")
411 if not node.decorator_list:
412 self.report_error(node, "Function must be decorated")
413 # TODO: only the last decorator is parsed
414 decorator = self.eval_expr(node.decorator_list[-1])
415 if not hasattr(decorator, "dispatch_token"):
416 self.report_error(node, "The parser does not understand the decorator")
417 return decorator.dispatch_token
418
419 def with_dispatch_token(self, token: str):
420 """Add a new dispatching token as with statement.

Callers 2

visit_FunctionDefMethod · 0.95

Calls 2

report_errorMethod · 0.95
eval_exprMethod · 0.95

Tested by

no test coverage detected