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

Class ToyModel

distributed/tensor_parallelism/tensor_parallel_example.py:57–67  ·  view source on GitHub ↗

MLP based model

Source from the content-addressed store, hash-verified

55from torch.distributed._tensor.device_mesh import init_device_mesh
56
57class ToyModel(nn.Module):
58 """MLP based model"""
59
60 def __init__(self):
61 super(ToyModel, self).__init__()
62 self.in_proj = nn.Linear(10, 32)
63 self.relu = nn.ReLU()
64 self.out_proj = nn.Linear(32, 5)
65
66 def forward(self, x):
67 return self.out_proj(self.relu(self.in_proj(x)))
68
69
70"""

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected