文章目录
- 1.常见问题解决路径
- 2.我遇到的问题
-
- 2.1 RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat2 in method wrapper_mm)
- 2.2 dgl._ffi.base.DGLError: Cannot assign node feature "h" on device cpu to a graph on device cuda:0. Call DGLGraph.to() to copy the graph to the same device.
- 2.3 ml_edges = G0.filter_edges(lambda edges: edges.data['ml'])
- 3.PyTorch如何使用GPU,训练神经网络时哪些东西可以传到GPU运算
- 4.pytorch保存和加载模型
1.常见问题解决路径
1.1官网问题反馈页面
首先:去DGL的官网问题解答页面,右上角有搜索,搜索你的代码报错的内容,基本上能解决个80%
https://discuss.dgl.ai/
1.2github的issue页面
https://github.com/dmlc/dgl/issues
2.我遇到的问题
2.1 RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cpu and cuda:0! (when checking argument for argument mat2 in method wrapper_mm)
意思是说:我的数据很杂乱,没有统一放到cuda或者cpu里
我去官网搜索相关问题的结果如下:
https

本文详细介绍了如何在DGL中正确使用GPU,包括数据一致性问题的解决方案,如如何将图移到GPU设备,以及PyTorch中模型训练的GPU操作技巧。还涵盖了如何处理RuntimeError和DGLError,以及模型保存与加载的最佳实践。
最低0.47元/天 解锁文章
778

被折叠的 条评论
为什么被折叠?



