Download models/GroundingDINO/mlp_loca.py from nikigoli/CountGDPlusPlus: direct link, hf CLI and curl.
- Browser
- Download file 546 Bytes
-
https://huggingface.co/nikigoli/CountGDPlusPlus/resolve/main/models/GroundingDINO/mlp_loca.py
- Command line
-
hf download hf://nikigoli/CountGDPlusPlus/models/GroundingDINO/mlp_loca.py
-
curl -L -o mlp_loca.py https://huggingface.co/nikigoli/CountGDPlusPlus/resolve/main/models/GroundingDINO/mlp_loca.py
546 Bytes
| from torch import nn | |
| class MLP(nn.Module): | |
| def __init__( | |
| self, | |
| input_dim: int, | |
| hidden_dim: int, | |
| dropout: float, | |
| activation: nn.Module | |
| ): | |
| super(MLP, self).__init__() | |
| self.linear1 = nn.Linear(input_dim, hidden_dim) | |
| self.linear2 = nn.Linear(hidden_dim, input_dim) | |
| self.dropout = nn.Dropout(dropout) | |
| self.activation = activation() | |
| def forward(self, x): | |
| return ( | |
| self.linear2(self.dropout(self.activation(self.linear1(x)))) | |
| ) | |