MCPcopy
hub / github.com/huggingface/peft / MLP

Class MLP

tests/test_custom_models.py:1449–1466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1447
1448
1449class MLP(nn.Module):
1450 def __init__(self, bias=True):
1451 super().__init__()
1452 self.lin0 = nn.Linear(10, 20, bias=bias)
1453 self.relu = nn.ReLU()
1454 self.drop = nn.Dropout(0.5)
1455 self.lin1 = nn.Linear(20, 2, bias=bias)
1456 self.sm = nn.LogSoftmax(dim=-1)
1457 self.dtype = torch.float
1458
1459 def forward(self, X):
1460 X = X.to(self.dtype)
1461 X = self.lin0(X)
1462 X = self.relu(X)
1463 X = self.drop(X)
1464 X = self.lin1(X)
1465 X = self.sm(X)
1466 return X
1467
1468
1469class MLPWithGRU(nn.Module):

Calls

no outgoing calls