| 491 | |
| 492 | |
| 493 | class MLP(nn.Module): |
| 494 | def __init__( |
| 495 | self, |
| 496 | in_channels, |
| 497 | hidden_channels=None, |
| 498 | out_channels=None, |
| 499 | act_layer=nn.GELU, |
| 500 | drop=0.0, |
| 501 | ): |
| 502 | super().__init__() |
| 503 | out_channels = out_channels or in_channels |
| 504 | hidden_channels = hidden_channels or in_channels |
| 505 | self.fc1 = nn.Linear(in_channels, hidden_channels) |
| 506 | self.act = act_layer() |
| 507 | self.fc2 = nn.Linear(hidden_channels, out_channels) |
| 508 | self.drop = nn.Dropout(drop) |
| 509 | |
| 510 | def forward(self, x): |
| 511 | x = self.fc1(x) |
| 512 | x = self.act(x) |
| 513 | x = self.drop(x) |
| 514 | x = self.fc2(x) |
| 515 | x = self.drop(x) |
| 516 | return x |
| 517 | |
| 518 | |
| 519 | class Block(PointModule): |