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

Function test_diamond

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

Source from the content-addressed store, hash-verified

407
408
409def test_diamond():
410 with PatternContext() as ctx:
411 n0 = is_call_dps_packed("extern_matmul")
412 n1 = is_call_dps_packed("extern_relu")
413 n2 = is_call_dps_packed("extern_sigmoid")
414 n3 = is_call_dps_packed("extern_add")
415
416 n0 ^ n1
417 n0 ^ n2
418 n1 >> n3
419 n2 >> n3
420
421 dfb = Diamond["main"].body.blocks[0]
422
423 assert ctx.match_dfb(dfb)
424 # simplify it with fork_to
425 with PatternContext() as ctx:
426 n1 = is_call_dps_packed("extern_relu")
427 n2 = is_call_dps_packed("extern_sigmoid")
428 n3 = is_call_dps_packed("extern_add")
429
430 is_call_dps_packed("extern_matmul").fork_to(n1, n2)
431 n1 >> n3
432 n2 >> n3
433
434 dfb = Diamond["main"].body.blocks[0]
435 assert ctx.match_dfb(dfb)
436
437
438def test_diamond_counter_oub():

Callers

nothing calls this directly

Calls 4

PatternContextClass · 0.85
is_call_dps_packedFunction · 0.85
match_dfbMethod · 0.80
fork_toMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…