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

Function test_two_cbr

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

Source from the content-addressed store, hash-verified

559
560
561def test_two_cbr():
562 with PatternContext() as ctx:
563 cbr0 = (
564 is_call_dps_packed("conv1x1")
565 >> is_call_dps_packed("bias_add")
566 >> is_call_dps_packed("my_relu")
567 )
568 cbr1 = cbr0.dup()
569
570 assert cbr0.patterns[0] != cbr1.patterns[0]
571 assert cbr0.patterns[1] != cbr1.patterns[1]
572 assert cbr0.patterns[2] != cbr1.patterns[2]
573
574 is_var("x").fork_to(cbr0, cbr1)
575 dfb = CBRx2["main"].body.blocks[0]
576 assert ctx.match_dfb(dfb)
577
578 with PatternContext() as ctx:
579 # Deny the pattern
580 cbr0 = (
581 is_call_dps_packed("conv1x1")
582 >> is_call_dps_packed("bias_add")
583 >> is_call_dps_packed("my_relu")
584 )
585 cbr1 = cbr0.dup()
586
587 # input has no fork at y.
588 is_var("y").fork_to(cbr0, cbr1)
589 dfb = CBRx2["main"].body.blocks[0]
590 assert not ctx.match_dfb(dfb)
591
592
593def test_two_matmul():

Callers

nothing calls this directly

Calls 6

PatternContextClass · 0.85
is_call_dps_packedFunction · 0.85
is_varFunction · 0.85
fork_toMethod · 0.80
match_dfbMethod · 0.80
dupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…