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

Method visit_match_cast_

tests/python/relax/test_expr_functor.py:312–323  ·  view source on GitHub ↗

Identical with ExprMutator::VisitBinding_(const MatchCastNode* binding) on the C++ side.

(self, binding: MatchCast)

Source from the content-addressed store, hash-verified

310 self.builder_.emit_normalized(VarBinding(new_var, new_value))
311
312 def visit_match_cast_(self, binding: MatchCast) -> None:
313 """Identical with ExprMutator::VisitBinding_(const MatchCastNode* binding) on the C++ side."""
314 new_var = self.visit_var_def(binding.var)
315 new_value = self.visit_expr(binding.value)
316
317 temp = self.with_struct_info(new_var, binding.struct_info)
318 if not temp.same_as(new_var):
319 new_var = temp
320 self.set_var_remap(binding.var.vid, new_var)
321
322 self.log.add("MatchCast")
323 self.builder_.emit_normalized(MatchCast(new_var, new_value, binding.struct_info))
324
325 def visit_binding_block_(self, block: BindingBlock) -> BindingBlock:
326 """Identical with ExprMutator::VisitBindingBlock_(const BindingBlockNode* block) on the C++ side."""

Callers

nothing calls this directly

Calls 8

MatchCastClass · 0.90
with_struct_infoMethod · 0.80
set_var_remapMethod · 0.80
emit_normalizedMethod · 0.80
visit_var_defMethod · 0.45
visit_exprMethod · 0.45
same_asMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected