MCPcopy
hub / github.com/THUDM/CogDL / Encoder

Class Encoder

examples/bgrl/models.py:49–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47
48
49class 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
73def init_weights(m):

Callers 1

__init__Method · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected