()
| 32 | |
| 33 | |
| 34 | def test_split_model(): |
| 35 | inputs = torch.randn(10, 5, 1, 512) |
| 36 | |
| 37 | model = torch.nn.Sequential(*[torch.nn.Linear(512, 1024, bias=False)]) |
| 38 | model1 = get_split_model(model, 64, 2, 64, 1000) |
| 39 | model2 = get_split_model(model, 64, 2, 64, 1) |
| 40 | model3 = get_split_model(model, 64, 1, 64, 1000) |
| 41 | |
| 42 | assert torch.allclose(model(inputs), model1(inputs), atol=1e-5) |
| 43 | assert torch.allclose(model(inputs), model2(inputs), atol=1e-5) |
| 44 | assert torch.allclose(model(inputs), model3(inputs), atol=1e-5) |
| 45 | |
| 46 | |
| 47 | if __name__ == "__main__": |
no test coverage detected