Back to Course
Deep Learning with PyTorch
Module 2 of 12
2. The nn.Module
The Blueprint
All PyTorch models inherit from nn.Module.
You must define:
__init__: The layers.forward: The flow of data.
pythonclass Net(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(10, 5) def forward(self, x): return torch.relu(self.fc1(x))