def __init__(self, g, in_feats, n_classes, n_hidden, n_layers, k, bias): super(ChebNet, self).__init__() self.g = g self.layers = nn.ModuleList() self.layers.append(ChebConv(in_feats, n_hidden, k, bias)) for _ in range(n_layers - 1): self.layers.append(ChebConv(n_hidden, n_hidden, k, bias)) self.layers.append(ChebConv(n_hidden, n_classes, k, bias))
def __init__(self, in_feats, hidden_size, hidden_size1, hidden_size2, hidden_size3, hidden_size4, num_classes): super(GCN, self).__init__() self.conv1 = SAGEConv(in_feats, hidden_size, aggregator_type='pool', activation=torch.tanh) self.conv2 = ChebConv(hidden_size, hidden_size1, 4) self.conv3 = TAGConv(hidden_size1, hidden_size2, activation=F.leaky_relu, k=3) self.conv4 = SAGEConv(hidden_size2, hidden_size3, aggregator_type='pool', activation=torch.tanh) self.conv5 = ChebConv(hidden_size3, hidden_size4, 4) self.conv6 = TAGConv(hidden_size4, num_classes, activation=F.leaky_relu, k=3) x = 150 self.encoder = nn.Sequential( nn.Conv2d(1, x, (3, 3)), nn.LeakyReLU(), nn.Dropout2d(), nn.Conv2d(x, 2*x, (3, 2)), nn.LeakyReLU(), nn.Dropout2d(), nn.Conv2d(2*x, 1, (3, 2)), )