()
| 551 | |
| 552 | |
| 553 | def test_operators(): |
| 554 | @R.function |
| 555 | def foo(x: R.Tensor): |
| 556 | return R.unique(x, sorted=True, axis=-1) |
| 557 | |
| 558 | foo_str = strip_whitespace( |
| 559 | dump_ast( |
| 560 | foo, |
| 561 | include_struct_info_annotations=False, |
| 562 | ) |
| 563 | ) |
| 564 | assert 'Op(name="relax.unique")' in foo_str |
| 565 | # the sorted argument is true, so it will be a PrimValue of 1 |
| 566 | assert "PrimExpr(value=`T.int64(1)`)" in foo_str |
| 567 | # axis is -1 |
| 568 | assert "PrimExpr(value=`T.int64(-1)`)" in foo_str |
| 569 | |
| 570 | @R.function(pure=False) |
| 571 | def bar(x: R.Tensor): |
| 572 | return R.print(x, format="{}") |
| 573 | |
| 574 | bar_str = strip_whitespace( |
| 575 | dump_ast( |
| 576 | bar, |
| 577 | include_struct_info_annotations=False, |
| 578 | ) |
| 579 | ) |
| 580 | # the format string is a StringImm argument |
| 581 | assert 'StringImm(value="{}")' in bar_str |
| 582 | |
| 583 | |
| 584 | def test_print_struct_info_annotation_non_var(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…