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

Function test_incremental_solving_counter

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

Source from the content-addressed store, hash-verified

835
836
837def test_incremental_solving_counter():
838 @R.function
839 def simple_chain(x: R.Tensor((32, 32), "float32")) -> R.Tensor:
840 with R.dataflow():
841 # sigmoid -> neg
842 lv0 = R.call_dps_packed("extern_sigmoid", (x), R.Tensor((32, 32), dtype="float32"))
843 lv1 = R.call_dps_packed("extern_neg", (lv0), R.Tensor((32, 32), dtype="float32"))
844 R.output(lv1)
845 return lv1
846
847 relu = is_call_dps_packed("extern_relu")
848 sigmoid = is_call_dps_packed("extern_sigmoid")
849 neg = is_call_dps_packed("extern_neg")
850
851 with PatternContext() as ctx0:
852 relu >> sigmoid # cannot match
853
854 with PatternContext(incremental=False) as ctx1:
855 # total constraint: sigmoid >> neg
856 sigmoid >> neg
857 assert ctx1.match_dfb(simple_chain.body.blocks[0])
858
859 with PatternContext(incremental=True) as ctx1:
860 # total constraint: relu >> sigmoid >> neg
861 sigmoid >> neg
862 assert not ctx1.match_dfb(simple_chain.body.blocks[0])
863
864
865def test_rewrite_simple():

Callers

nothing calls this directly

Calls 3

is_call_dps_packedFunction · 0.85
PatternContextClass · 0.85
match_dfbMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…