怎么理解torch_geometric中的dense_to_sparse()方法?

新手上路,请多包涵

官方文档对方法进行以下描述:

"Converts a dense adjacency matrix to a sparse adjacency matrix defined
by edge indices and edge attributes."
assert tensor.dim() == 2
index = tensor.nonzero().t().contiguous()
value = tensor[index[0], index[1]]
return index, value
我想知道将稠密邻接矩阵转换为稀疏邻接矩阵的意义是什么?

阅读 1.6k
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进