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

Method eval_expr

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

Expression evaluation when parsing. Parameters ---------- node : Union[doc.expr, doc.Expression] The root node of AST tree node of expression to evaluate. extra_vars : Optional[Dict[str, Any]] The optional global value table for expression ev

(
        self,
        node: doc.Expression | doc.expr,
        extra_vars: dict[str, Any] | None = None,
    )

Source from the content-addressed store, hash-verified

499 return _deferred(pop_source)
500
501 def eval_expr(
502 self,
503 node: doc.Expression | doc.expr,
504 extra_vars: dict[str, Any] | None = None,
505 ) -> Any:
506 """Expression evaluation when parsing.
507
508 Parameters
509 ----------
510 node : Union[doc.expr, doc.Expression]
511 The root node of AST tree node of expression to evaluate.
512
513 extra_vars : Optional[Dict[str, Any]]
514 The optional global value table for expression evaluation.
515
516 Returns
517 -------
518 res : Any
519 The evaluation result.
520 """
521 var_values = self.var_table.get()
522 if extra_vars is not None:
523 for k, v in extra_vars.items():
524 var_values[k] = v
525 var_values[ScriptMacro.parser_object_name] = self
526 return eval_expr(self, node, var_values)
527
528 def _duplicate_lhs_check(self, target: doc.expr) -> bool | set[str]:
529 """Check whether duplicate lhs exists in assignment.

Callers 15

get_dispatch_tokenMethod · 0.95
eval_struct_info_proxyFunction · 0.80
eval_struct_infoFunction · 0.80
visit_function_defFunction · 0.80
visit_expr_stmtFunction · 0.80
visit_withFunction · 0.80
visit_assignFunction · 0.80
visit_ann_assignFunction · 0.80
visit_returnFunction · 0.80
visit_ifFunction · 0.80
parse_macroMethod · 0.80

Calls 3

eval_exprFunction · 0.85
getMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected