class MLP(nn.Module):def__init__(self):super().__init__()self.lin1 = nn.Linear(28*28, 30)self.lin2 = nn.Linear(30, 20)self.lin3 = nn.Linear(20, 10)def forward(self, x): x = x.view(-1, 28*28) x = torch.relu(self.lin1(x)) x = torch.relu(self.lin2(x)) x =self.lin3(x)return x
model = MLP()model = model.to(device)
for param_name, param in model.named_parameters():print(param_name, param.shape)