We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好,我想请问下。在dhg文档中,有份示例代码,是用于构造具有不同超边权重的超图卷积模型(代码附在下面)。我想问的是,这个超边特征Y是不是得先进将顶点信息传递到边后,即先调用 hg.v2e才可以拿到这个超边特征。 class HGATConv(nn.Module): def init( self, in_channels: int, out_channels: int, bias: bool = True, drop_rate: float = 0.5, atten_neg_slope: float = 0.2, ): super().init() self.atten_dropout = nn.Dropout(drop_rate) self.atten_act = nn.LeakyReLU(atten_neg_slope) self.act = nn.ELU(inplace=True) self.theta_vertex = nn.Linear(in_channels, out_channels, bias=bias) self.theta_hyperedge = nn.Linear(in_channels, out_channels, bias=bias) self.atten_vertex = nn.Linear(out_channels, 1, bias=False) self.atten_hyperedge = nn.Linear(out_channels, 1, bias=False)
def forward(self, X: torch.Tensor, Y: torch.Tensor, hg: dhg.Hypergraph) -> torch.Tensor: X = self.theta_vertex(X) Y = self.theta_hyperedge(Y) x_for_vertex = self.atten_vertex(X) y_for_hyperedge = self.atten_hyperedge(Y) v2e_atten_score = x_for_vertex[hg.v2e_src] + y_for_hyperedge[hg.v2e_dst] e2v_atten_score = y_for_hyperedge[hg.e2v_src] + x_for_vertex[hg.e2v_dst] v2e_atten_score = self.atten_dropout(self.atten_act(v2e_atten_score).squeeze()) e2v_atten_score = self.atten_dropout(self.atten_act(e2v_atten_score).squeeze()) Y_ = hg.v2e(X, aggr="softmax_then_sum", v2e_weight=v2e_atten_score) X_ = hg.e2v(Y_, aggr="softmax_then_sum", e2v_weight=e2v_atten_score) X_ = self.act(X_) Y_ = self.act(Y_) return X_
The text was updated successfully, but these errors were encountered:
No branches or pull requests
您好,我想请问下。在dhg文档中,有份示例代码,是用于构造具有不同超边权重的超图卷积模型(代码附在下面)。我想问的是,这个超边特征Y是不是得先进将顶点信息传递到边后,即先调用 hg.v2e才可以拿到这个超边特征。
class HGATConv(nn.Module):
def init(
self,
in_channels: int,
out_channels: int,
bias: bool = True,
drop_rate: float = 0.5,
atten_neg_slope: float = 0.2,
):
super().init()
self.atten_dropout = nn.Dropout(drop_rate)
self.atten_act = nn.LeakyReLU(atten_neg_slope)
self.act = nn.ELU(inplace=True)
self.theta_vertex = nn.Linear(in_channels, out_channels, bias=bias)
self.theta_hyperedge = nn.Linear(in_channels, out_channels, bias=bias)
self.atten_vertex = nn.Linear(out_channels, 1, bias=False)
self.atten_hyperedge = nn.Linear(out_channels, 1, bias=False)
The text was updated successfully, but these errors were encountered: