()
| 407 | |
| 408 | |
| 409 | def 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 | |
| 438 | def test_diamond_counter_oub(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…