我的数据对象有 data.adj_t
参数,给我稀疏邻接矩阵。如何从中获取大小为 [2, num_edges]
的 edge_index
张量?
最佳答案
正如您在 docs 中看到的那样:
Since this feature is still experimental, some operations, e.g., graph pooling methods, may still require you to input the
edge_index
format. You can convertadj_t
back to(edge_index, edge_attr)
via:row, col, edge_attr = adj_t.t().coo() edge_index = torch.stack([row, col], dim=0)
关于python - Pytorch 几何稀疏邻接矩阵到边索引张量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69091074/