Hi folks, I’m quite new to Pytorch and am trying to learn a model on top of graph representations. So I have a model that takes in my data, uses a graph neural network to learn representations, then concats the representations (node pairs) and passes these through a linear layer. However, it looks like when i do loss.backward, the layers aren’t being updated at all. I’m wondering if I’m doing anything wrong here? Here’s a short code snippet for clarification in my model’s forward function.
        x = self.gcn1.forward(graph_feats, edge_index=edge_index, edge_weight=edge_weight)
        x = F.relu(x)
        x = self.gcn2(x, edge_index=edge_index, edge_weight=edge_weight)
        x = F.relu(x)
        x = self.gcn3(x, edge_index=edge_index, edge_weight=edge_weight)
        
        # Take the d p vectors, and concat them, followed by putting classifier on top 
        stop_num = int(edge_index.shape[1]/2)
        
        node_idx = edge_index.T[0:stop_num]
        
        d_rep = x[node_idx[:,0]]
        p_rep = x[node_idx[:,1]]
        edge_weight_half = edge_weight[0:stop_num].type(torch.FloatTensor).view(-1,1).cuda()
        
        d_p_pair = torch.cat((d_rep, p_rep, edge_weight_half), dim=1)
        
        x = self.lin(d_p_pair)
        y = self.act_lin(x)