MCPcopy Create free account
hub / github.com/apache/tvm / _eval_op

Function _eval_op

python/tvm/script/parser/core/evaluator.py:531–560  ·  view source on GitHub ↗

Operation expression evaluation implementation for TVMScript parser. Parameters ---------- op : doc.AST The root node of AST tree node of operation expression to evaluate. values : List[Any] The list of values of operands. Returns ------- res : Any

(
    op: doc.AST,
    values: list[Any],
)

Source from the content-addressed store, hash-verified

529
530
531def _eval_op(
532 op: doc.AST,
533 values: list[Any],
534):
535 """Operation expression evaluation implementation for TVMScript parser.
536
537 Parameters
538 ----------
539 op : doc.AST
540 The root node of AST tree node of operation expression to evaluate.
541
542 values : List[Any]
543 The list of values of operands.
544
545 Returns
546 -------
547 res : Any
548 The evaluation result.
549 """
550 op_type = type(op) # pylint: disable=protected-access
551 for i, v in enumerate(values):
552 v_type = getattr(type(v), "_dispatch_type", None)
553 if v_type is None:
554 continue
555 f = dispatch.get_op(
556 operand_type=v_type, op_node_type=op_type, operand_index=i, default=None
557 )
558 if f is not None:
559 return f(*values)
560 return DEFAULT_OP[op_type](*values)
561
562
563def _eval_assign(

Callers 4

_eval_bool_opMethod · 0.85
_eval_compareMethod · 0.85
_eval_unary_opMethod · 0.85
_eval_bin_opMethod · 0.85

Calls 1

fFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…