MCPcopy Index your code
hub / github.com/pytorch/examples / ToyModel

Class ToyModel

distributed/tensor_parallelism/sequence_parallel_example.py:47–57  ·  view source on GitHub ↗

MLP based model

Source from the content-addressed store, hash-verified

45from torch.distributed._tensor.device_mesh import init_device_mesh
46
47class ToyModel(nn.Module):
48 """MLP based model"""
49
50 def __init__(self):
51 super().__init__()
52 self.in_proj = nn.Linear(10, 32)
53 self.relu = nn.ReLU()
54 self.out_proj = nn.Linear(32, 5)
55
56 def forward(self, x):
57 return self.out_proj(self.relu(self.in_proj(x)))
58
59
60"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected