Skip to content
Discussion options

You must be logged in to vote

The problem has been solved.
Please refer to the code below to implement hierarchical pooling.

class SAG_h(torch.nn.Module):
    def __init__(self,c_in,c_out,ratio):
        super(SAG_h,self).__init__()
        self.pool = SAGPooling(c_in,ratio)
        self.conv = GCNConv(c_in,c_out)
        self.readout = sum_aggr

    def forward(self,X,Edge,Batch):
        x, edge_index,batch = X,Edge,Batch
        x,edge_index,_,batch,_,_= self.pool(
            x=x,
            edge_index=edge_index,
            batch=batch
        )
        y = self.conv(x,edge_index)
        y = sum_aggr(
            x = y,
            index= batch,
        )
        return x,edge_index,batch,y


class Net_h(torch.nn

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by SongZan222
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant