| 758 | |
| 759 | |
| 760 | def test_trace_naming(): |
| 761 | @trace(symbolic=True, capture_as_const=True) |
| 762 | def func(x): |
| 763 | return F.max(x, axis=2, keepdims=False) + 1 |
| 764 | |
| 765 | inp = tensor(np.random.random((1, 3, 3, 3))) |
| 766 | func(inp) |
| 767 | file = io.BytesIO() |
| 768 | func.dump(file, optimize_for_inference=False) |
| 769 | file.seek(0) |
| 770 | import megengine.utils.network as network |
| 771 | |
| 772 | net = network.Network.load(file) |
| 773 | names = set() |
| 774 | for var in net.all_vars: |
| 775 | assert var.name not in names |
| 776 | names.add(var.name) |
| 777 | |
| 778 | |
| 779 | def test_invalid_inp_error(): |