()
| 806 | |
| 807 | |
| 808 | def test_incremental_solving(): |
| 809 | @R.function |
| 810 | def simple_chain(x: R.Tensor((32, 32), "float32")) -> R.Tensor: |
| 811 | with R.dataflow(): |
| 812 | # relu -> sigmoid -> neg |
| 813 | lv0 = R.call_dps_packed("extern_relu", (x), R.Tensor((32, 32), dtype="float32")) |
| 814 | lv1 = R.call_dps_packed("extern_sigmoid", (lv0), R.Tensor((32, 32), dtype="float32")) |
| 815 | lv2 = R.call_dps_packed("extern_neg", (lv1), R.Tensor((32, 32), dtype="float32")) |
| 816 | R.output(lv2) |
| 817 | return lv2 |
| 818 | |
| 819 | relu = is_call_dps_packed("extern_relu") |
| 820 | sigmoid = is_call_dps_packed("extern_sigmoid") |
| 821 | neg = is_call_dps_packed("extern_neg") |
| 822 | |
| 823 | with PatternContext() as ctx0: |
| 824 | relu >> sigmoid |
| 825 | with PatternContext(incremental=True) as ctx1: |
| 826 | # because we are doing incremental solving |
| 827 | # relu >> sigmoid is still a constraint in this context. |
| 828 | # that said the total constraint is: |
| 829 | # relu >> sigmoid >> neg |
| 830 | sigmoid >> neg |
| 831 | assert ctx1.match_dfb(simple_chain.body.blocks[0]) |
| 832 | |
| 833 | # match relue -> sigmoid |
| 834 | assert ctx0.match_dfb(simple_chain.body.blocks[0]) |
| 835 | |
| 836 | |
| 837 | def test_incremental_solving_counter(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…