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
作者您好,作为GNN的初学者对discrete_graph_learning.py代码中Equation(2)实现的这部分还存在一些疑惑: self.rel_rec = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[0]), dtype=np.float32)) self.rel_send = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[1]), dtype=np.float32)) 这里我理解的作用是将每个node看作reciever和sender的角色,然后将节点之间的关系表示为one-hot向量矩阵,但我好奇这个为什么能这么表示呢?譬如self.num_nodes为3的时候这两个属性分别为tensor([[1., 0., 0.], [1., 0., 0.], [1., 0., 0.], [0., 1., 0.], [0., 1., 0.], [0., 1., 0.], [0., 0., 1.], [0., 0., 1.], [0., 0., 1.]])与tensor([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.]]),这两个属性的值怎么就能表示节点之间的关系了呢? 以及在下方有将这两个属性与node feature相乘,分别得到receiver和sender的特征表示: receivers = torch.matmul(self.rel_rec.to(node_feat.device), node_feat) senders = torch.matmul(self.rel_send.to(node_feat.device), node_feat) 为什么这两个矩阵相乘就能作为receiver和sender的特征表示呢?
self.rel_rec = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[0]), dtype=np.float32))
self.rel_send = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[1]), dtype=np.float32))
tensor([[1., 0., 0.], [1., 0., 0.], [1., 0., 0.], [0., 1., 0.], [0., 1., 0.], [0., 1., 0.], [0., 0., 1.], [0., 0., 1.], [0., 0., 1.]])
tensor([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
receivers = torch.matmul(self.rel_rec.to(node_feat.device), node_feat)
senders = torch.matmul(self.rel_send.to(node_feat.device), node_feat)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
作者您好,作为GNN的初学者对discrete_graph_learning.py代码中Equation(2)实现的这部分还存在一些疑惑:
self.rel_rec = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[0]), dtype=np.float32))
self.rel_send = torch.FloatTensor(np.array(encode_one_hot(np.where(np.ones((self.num_nodes, self.num_nodes)))[1]), dtype=np.float32))
这里我理解的作用是将每个node看作reciever和sender的角色,然后将节点之间的关系表示为one-hot向量矩阵,但我好奇这个为什么能这么表示呢?譬如self.num_nodes为3的时候这两个属性分别为
tensor([[1., 0., 0.], [1., 0., 0.], [1., 0., 0.], [0., 1., 0.], [0., 1., 0.], [0., 1., 0.], [0., 0., 1.], [0., 0., 1.], [0., 0., 1.]])
与tensor([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.], [1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])
,这两个属性的值怎么就能表示节点之间的关系了呢?以及在下方有将这两个属性与node feature相乘,分别得到receiver和sender的特征表示:
receivers = torch.matmul(self.rel_rec.to(node_feat.device), node_feat)
senders = torch.matmul(self.rel_send.to(node_feat.device), node_feat)
为什么这两个矩阵相乘就能作为receiver和sender的特征表示呢?
The text was updated successfully, but these errors were encountered: