| 47 | |
| 48 | |
| 49 | class Encoder(nn.Module): |
| 50 | |
| 51 | def __init__(self, layer_config, dropout=None, project=False, **kwargs): |
| 52 | super().__init__() |
| 53 | |
| 54 | self.conv1 = GCNLayer(layer_config[0], layer_config[1], bias=False, norm=None) |
| 55 | self.bn1 = nn.BatchNorm1d(layer_config[1], momentum=0.99) |
| 56 | self.prelu1 = nn.PReLU() |
| 57 | self.conv2 = GCNLayer(layer_config[1], layer_config[2], bias=False, norm=None) |
| 58 | self.bn2 = nn.BatchNorm1d(layer_config[2], momentum=0.99) |
| 59 | self.prelu2 = nn.PReLU() |
| 60 | |
| 61 | def forward(self, x, graph, edge_weight=None): |
| 62 | |
| 63 | # x = self.conv1(x, edge_index, edge_weight=edge_weight) |
| 64 | x = self.conv1(graph, x) |
| 65 | x = self.prelu1(self.bn1(x)) |
| 66 | # x = self.conv2(x, edge_index, edge_weight=edge_weight) |
| 67 | x = self.conv2(graph, x) |
| 68 | x = self.prelu2(self.bn2(x)) |
| 69 | |
| 70 | return x |
| 71 | |
| 72 | |
| 73 | def init_weights(m): |