MCPcopy Create free account
hub / github.com/pytorch/executorch / test_split_model

Function test_split_model

examples/apple/coreml/llama/test.py:34–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

32
33
34def 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
47if __name__ == "__main__":

Callers 1

test.pyFile · 0.85

Calls 1

get_split_modelFunction · 0.85

Tested by

no test coverage detected