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

Function test_nested_context

tests/python/relax/test_dataflow_pattern.py:541–558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

539
540
541def test_nested_context():
542 dfb = CBRx2["main"].body.blocks[0]
543 with PatternContext() as ctx0:
544 (
545 is_call_dps_packed("conv1x1")
546 >> is_call_dps_packed("bias_add")
547 >> is_call_dps_packed("my_relu")
548 )
549 with PatternContext() as ctx1:
550 is_call_dps_packed("conv1x1") >> is_call_dps_packed("my_relu") # pattern to miss
551 with PatternContext() as ctx2:
552 is_call_dps_packed("bias_add") >> is_call_dps_packed("my_relu")
553 assert ctx2.match_dfb(dfb)
554 assert PatternContext.current() == ctx2
555 assert not ctx1.match_dfb(dfb)
556 assert PatternContext.current() == ctx1
557 assert ctx0.match_dfb(dfb)
558 assert PatternContext.current() == ctx0
559
560
561def test_two_cbr():

Callers

nothing calls this directly

Calls 4

PatternContextClass · 0.85
is_call_dps_packedFunction · 0.85
match_dfbMethod · 0.80
currentMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…