图神经网络
文章平均质量分 69
近年来,由于图神经网络的强大表现力,用机器学习方法分析图的研究越来越受到重视。图神经网络(GNN)是一类基于深度学习的处理图域信息的方法。由于其较好的性能和可解释性,GNN最近已成为一种广泛应用的图分析方法。
余额抵扣
助学金抵扣
还需支付
¥199.90
¥299.90
购买须知?
本专栏为图文内容,最终完结不会低于15篇文章。
订阅专栏,享有专栏所有文章阅读权限。
本专栏为虚拟商品,基于网络商品和虚拟商品的性质和特征,专栏一经购买无正当理由不予退款,不支持升级,敬请谅解。
海洋 之心
图神经网络-大数据-推荐系统研究者,专注于计算机领域前沿技术的分享等人工智能算法研究工作
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
PyTorch+PyG实现图神经网络经典模型目录
本专栏整理了《图神经网络代码实战》,内包含了不同图神经网络的相关代码实现(PyG以及自实现),理论与实践相结合,如GCN、GAT、GraphSAGE等经典图网络,每一个代码实例都附带有完整的代码。原创 2023-01-19 21:50:32 · 29676 阅读 · 298 评论
-
成功解决 ImportError: cannot import name ‘XXXX‘ from ‘torch_sparse‘ 的问题
在使用pyg-lib和这个错误通常出现在库的版本不兼容或安装不当时,导致无法正确导入所需的模块。原创 2024-10-24 15:53:20 · 810 阅读 · 0 评论 -
ImportError: cannot import name ‘from_dict‘ from ‘torch_geometric.data‘ (/Users/liam/opt/anaconda3/l
包下没有这个函数,所以会出现导入失败,无法找到该函数的错误。库来自定义图数据,使用函数。这样即可将自定义的字典转化为。的图格式,出现如下问题。原创 2024-07-24 15:55:29 · 383 阅读 · 0 评论 -
RuntimeError: Trying to backward through the graph a second time (or directly access saved tensors a
时,默认情况下,PyTorch 会释放中间计算图,以节省内存。如果你需要多次反向传播(例如在循环中多次调用),需要指定。这是由于在执行反向传播时,尝试了第二次通过计算图进行反向传播,而没有指定。训练模型时出现如下问题。原创 2024-07-14 16:16:58 · 2203 阅读 · 0 评论 -
x1rd.biffh.XLRDError: Excel xlsx file; not supported
【代码】x1rd.biffh.XLRDError:Excelxlsxfile;原创 2024-06-01 21:02:25 · 682 阅读 · 0 评论 -
AttributeError: ‘pandas._libs-properties-CachedProperty‘ object has no attribute ‘func‘
【代码】AttributeError:'pandas._libs-properties-CachedProperty'objecthasnoattribute'func'原创 2024-06-01 21:00:23 · 373 阅读 · 0 评论 -
ValueError:x andy must have same first dimension, but have shapes (15,) and (17,)
进行数据分析建模出现如下问题。出现这个问题的原因是。原创 2024-06-01 20:57:17 · 905 阅读 · 0 评论 -
RuntimeError: CUDA error: invalid device ordinal CUDA kernel errors might be asynchronously reported
但是我的服务器只有一张显卡,所以会出现找不到显卡问题。只需要将设备设置为自己的显卡编号即可,或者没有显卡设置为。深度学习项目,在利用显卡进行训练出现如下问题。出现这个问题的原因是,我的代码。原创 2024-05-25 09:59:07 · 937 阅读 · 0 评论 -
ImportError: cannot import name ‘GraphSAGE‘ from ‘torch_geometric.nn‘ (/home/lab/anaconda3/lib/pytho
库安装错了,所以在导入对应的模块时显示缺失,安装。在运行图神经网络的代码时出现如下问题。,所以在导入相应模块时出现缺失问题。安装的并不是图神经网络的扩展库。出现这种问题的原因是我的。原创 2024-05-16 04:27:15 · 417 阅读 · 0 评论 -
完美解决ImportError: cannot import name ‘HANConv‘ from ‘torch_geometric.nn‘ (/Library/Frameworks/Python.
这个卷积层,所以会出现无法导入的问题。异构图神经网络的代码,当导入。出现这个问题的原因就是当前的。这个卷积层出现如下问题。原创 2024-02-21 08:55:47 · 494 阅读 · 0 评论 -
完美解决torch-geometric WinDLL(os.path.abspath(filename)) OSError: [WinError 126] 找不到指定的模块
这个问题不一定是由这个导致的,一定要看我上面图标记的红框,看你的是不是这个原因,如果不是那么下main的解决办法可能无用,因为。的版本,所以更换他很可能导致用不了。出现了问题,出现这个问题的原因是。这个库来搭建图卷积模块时出现。的版本依赖原因,当前版本的。但是个人不建议这种方式,因为。的版本,可以选择把旧版本的。需要依赖很多其他的库以及。建议使用这种方式,仅仅更新。对于我的问题出现的原因是。可以由很多问题导致。原创 2024-02-21 08:43:46 · 465 阅读 · 0 评论 -
完美解决ModuleNotFoundError: No module named ‘torch_sparse‘
但仍无法正常运行,因为该库还依赖其他一些库。为了解决这个问题,我们需要安装所有的依赖库,包括。这样是不行的,因为需要特定版本之间的依赖关系,有的版本之间不兼容。库在实现图神经网络方面的东西,在运行期间出现如下问题。但是还需注意一点,这个库依赖关系比较严格,仅仅用。大家可以按照我的环境进行安装。出现这个问题的原因是缺少。原创 2024-02-21 08:12:34 · 2332 阅读 · 1 评论 -
解决RuntimeError: CUDA error: out of memory
显卡被占用:当存在多个显卡时,默认使用 0 号显卡。即使 1 号显卡空闲,但如果 0 号显卡被占用,仍然会导致报错。在使用 PyTorch 中加载模型时,出现 CUDA 错误: out of memory。根据具体情况,采取上述解决办法中的一种或多种来解决 CUDA 错误: out of memory 问题。解决办法:可以让其他显卡不可见,从而使 0 号显卡变为空余的 1 号显卡。CUDA 显存不足:可能是因为当前显卡显存不足。解决办法:考虑更换显存更大的显卡。原创 2024-02-21 07:55:16 · 2857 阅读 · 0 评论 -
TypeError: Failed to convert object of type <class ‘tensorflow.python.data.ops.dataset_ops._NestedV
最后,确保模型的输入层能够接受这种新的数据结构,包括名称和形状的匹配。检查模型的输入层定义,确保它们与数据集结构一致。但在某些情况下,输入数据已经是 TensorFlow 数据集,而不是直接的张量。确保输入数据是张量而不是 TensorFlow 数据集。如果输入数据已经是数据集,需要进行相应的处理。如果输入数据是 TensorFlow 数据集,你需要将它们合并为一个数据集,然后通过。两个输入层已经是 TensorFlow 数据集而不是张量。转换为模型所需的结构,最后通过。是输入数据的数据集,通过。原创 2024-02-20 08:34:44 · 326 阅读 · 0 评论 -
RuntimeError: Providing a bool or integral fill value without setting the optional dtype or out argu
参数的情况下,提供布尔值或整数值的填充值是不支持的,我使用的版本是。上的一段代码出现如下问题。原创 2024-02-20 08:13:01 · 359 阅读 · 0 评论 -
ValueError:No gradients provided forany variable, check your graph for ops that do not support gradi
例如,可能是在优化器函数(optimizer function)或损失函数(loss function)中传递的参数存在错误(包括拼写错误),导致TensorFlow的优化器无法对这些参数进行梯度计算。得到的预测值(prediction)在传递给损失函数后,成为一个数值型参数,导致损失函数与模型参数之间的联系被切断,无法进行微分计算。例如,如果损失函数中包含了一些不支持微分计算的操作,比如。解决办法:逐一检查参数是否正确,并进行必要的修改。解决办法:替换这些不支持微分计算的操作或模型。原创 2024-02-20 08:03:04 · 502 阅读 · 0 评论 -
Cannot find reference ‘attention‘ in ‘__init__.py‘
更新到最新或者更新到 2.4.0+以上即可。这条指令时突然找不到这个模块,出现。的版本太低了,目前还没有引入这个模块。出现这个问题的原因就是你的。原创 2024-01-08 15:20:49 · 577 阅读 · 0 评论 -
error while use ‘‘ pip install torch-geometric ‘‘ ,ERROR: Failed building wheel for llvmlite
如果您安装的PyTorch版本低于1.9.*,可能会遇到兼容性问题。旧版本的PyTorch可能无法完全支持最新的。在Anaconda的虚拟环境中使用指令。原创 2024-01-08 13:36:41 · 781 阅读 · 0 评论 -
TypeError: full() received an invalid combination of arguments - got (tuple, int, device=NoneType),
等参数都应该是 PyTorch 的张量(tensor)对象,而不是 Python 列表或 NumPy 数组。内置的DataLoader构造迭代器时出现如下问题。所有对象都创建成了Python中的列表。原创 2023-10-17 14:42:26 · 1256 阅读 · 0 评论 -
The size of tensor a (20) must match the size of tensor b (10) at non-singleton dimension 2 GCN trai
使用PyG搭建一个链路预测的GCNs模型出现了如下问题 `RuntimeError: The size of tensor a (20) must match the size of tensor b (10) at non- singleton dimension 2`原创 2023-09-17 08:55:20 · 678 阅读 · 0 评论 -
OSError: dlopen(/Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so, 0x00
安装好 `torch-geometric` 之后,使用 `import torch_geometric` 时出现如下问题 `OSError: dlopen(/Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so, 0x0006): Library not loaded: /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10原创 2023-09-16 15:03:57 · 1318 阅读 · 0 评论 -
成功解决AttributeError: ‘tuple‘ object has no attribute ‘x‘
从 `Github` 上下载了一个图神经网络的边缘预测项目,使用GCN运行预测时出现如下问题 `AttributeError: 'tuple' object has no attribute 'x'`原创 2023-09-16 14:50:37 · 1970 阅读 · 0 评论 -
RuntimeError: CUDA error: invalid device ordinal CUDA kernel errors might be asynchronously reported
在运行代码 `args.device = torch.device('cuda: ' + str(args.gpu_id))` 设置GPU时出现如下问题 `RuntimeError: CUDA error: invalid device ordinal CUDA kernel errors might be asynchronously reported`原创 2023-08-31 07:35:35 · 1889 阅读 · 0 评论 -
解决ValueError: n_splits=10 cannot be greater than the number of members in each class.
在训练模型时使用到了交叉验证,当我设置 `n_split = 10` 出现如下问题 `ValueError: n_splits=10 cannot be greater than the number of members in each class.`原创 2023-08-28 10:36:44 · 1340 阅读 · 0 评论 -
成功解决BrokenPipeError: [Errno 32] Broken pipe
我出现这个问题是由于多线程加载数据导致,在某些操作系统或环境中(尤其是Windows),多进程支持可能没有很好地实现,这也可能导致问题。使用PyTorch创建一个DataLoader迭代器,进行模型训练时出现如下问题。,利用4个线程去加载数据,这种策略目前是在。原创 2023-08-24 16:17:47 · 2400 阅读 · 1 评论 -
TypeError: GCNConv.forward() missing 1 required positional argument: ‘edge_index‘
使用 `GCN` 网络进行图节点分类任务,然后出现如下问题 `TypeError: GCNConv.forward() missing 1 required positional argument: 'edge_index'`原创 2023-08-10 09:44:19 · 893 阅读 · 0 评论 -
OSError: libc10_hip.so: cannot open shared object file: No such file or directory
安装了 `torch` 和 `torch-geometric` ,然后想运行Github上的一个示例图神经网络的代码,出现了如下问题 `OSError: libc10_hip.so: cannot open shared object file: No such file or directory`原创 2023-08-10 09:32:37 · 801 阅读 · 0 评论 -
RuntimeError: object has no attribute sparse_csc_tensor: File “/home/lbilic/anaconda3/envs/diffdock/
使用 `torch-geometric` 运行一个图神经网络Demo,出现了如下问题 `RuntimeError:object has no attribute sparse_csc_tensor:File "/home/lbilic/anaconda3/envs/diffdock/lib/python3.9/site-packages/torch_sparse/tensor.py", line 520value = torch.ones(self.nnz(), dtype=dtype, device原创 2023-08-09 20:53:04 · 1318 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘torch_geometric.loader
我在学习 `torch-geometric` 这个库,使用 `from torch_geometric.loader import DataLoader` ,然后出现如下问题 `ModuleNotFoundError: No module named 'torch_geometric.loader`原创 2023-08-09 20:44:22 · 2456 阅读 · 0 评论 -
ImportError: ‘SparseTensor‘ requires ‘torch-sparse‘
安装好 `torch-geometric` 、 `torch` 和 `torch-sparse` 之后,运行从 `Github` 拷贝下来的图神经网络项目出现如下问题 `ImportError: 'SparseTensor' requires 'torch-sparse'`原创 2023-08-09 20:33:34 · 1261 阅读 · 0 评论 -
AttributeError: module ‘torch‘ has no attribute ‘sparse_csc‘
在训练图神经网络时,我遭遇了一个问题,即 AttributeError: module 'torch' has no attribute 'sparse_csc'。我使用的是 PyTorch 和 torch-geometric 库。经过排查,我发现这个问题的根源出在库的版本兼容性上。原创 2023-08-09 10:28:30 · 1025 阅读 · 0 评论 -
图神经网络 RuntimeError: expected scalar type Double but found Float
使用 `GCN` 实现图分类任务,然后数据集是我自定义的,有节点特征,然后搭建模型运行出现了如下问题 `RuntimeError: expected scalar type Double but found Float`原创 2023-08-05 10:31:10 · 265 阅读 · 0 评论 -
ModuleNotFoundError: No module named ‘torch_scatter‘
粉丝交流群一位初学 `torch-geometric` 这个工具包的伙伴在使用 `from torch_geometric.data import Data` 出现如下问题 `ModuleNotFoundError: No module named 'torch_scatter'`原创 2023-08-05 10:17:08 · 1906 阅读 · 0 评论 -
OSError: dlopen(/usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/tor
一位订阅了专栏的粉丝私信我他的一个问题,他在导入 `torch_sparse` 出现了如下问题 `OSError: dlopen(/usr/local/Caskroom/miniconda/base/envs/my_conda_env/lib/python3.8/site-packages/torch_sparse/_version.so, 6): Symbol not found: __ZN3c105ErrorC1ENS_14SourceLocationERKNSt3__112basic_stringIc原创 2023-08-05 10:06:09 · 834 阅读 · 0 评论 -
OSError: /anaconda3/lib/python3.7/site-packages/torch_sparse/_version_cuda.so: undefined symbol: _ZN
在使用 `torch-geometric` 这个库编写图分类代码,在运行时出现如下问题 `OSError Traceback (most recent call last)...OSError: /anaconda3/lib/python3.7/site-packages/torch_sparse/_version_cuda.so: undefined symbol: _ZN5torch3jit17parseSchemaOrNameER原创 2023-08-05 09:50:11 · 2675 阅读 · 0 评论 -
error: Microsoft Visual C++ 14.0 is required. Get it with “Build Tools for Visual Studio“: https://v
在安装 `torch_geometric` 、 `torch-sparse` 和 `torch-scatter` 时使用 `pip install ***` 在cmd中出现如下问题 `ERROR: Command errored out with exit status 1: command: 'C:\Users\hastings\anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\User原创 2023-08-05 09:27:04 · 1300 阅读 · 0 评论 -
No matching distribution found for torch-geometri satisfies the requirement torch-geometric
初期学习图神经网络时需要用到 `torch-geometric` 这个工具包,想要安装它,不过出现了如下问题 `ERROR: No matching distribution found for torch-geometri satisfies the requirement torch-geometric`原创 2023-08-05 09:14:36 · 1062 阅读 · 0 评论 -
ERROR: Could not find a version that satisfies the requirement torch-sparse ERROR: No matching distr
在使用 `!pip install --no-index torch-sparse -f https://pytorch-geometric.com/whl/torch-1.7.0+cu102.html` 安装 `torch-sparse` 时出现如下问题 `ERROR: Could not find a version that satisfies the requirement torch-sparseERROR: No matching distribution found for torch-sp原创 2023-08-05 08:54:17 · 1043 阅读 · 0 评论 -
RuntimeError: The size of tensor a (20) must match the size of tensor b (10) at non- singleton dime
使用 `PyG` 搭建 `GCN` 实现链路预测任务时,出现了如下问题 `RuntimeError: The size of tensor a (20) must match the size of tensor b (10) at non- singleton dimension 2`原创 2023-08-04 14:41:24 · 4767 阅读 · 0 评论 -
RuntimeError: Detected that PyTorch and torch_sparse were compiled with different CUDA versions.PyTo
最近一粉丝在学习图神经网络,出现如下问题:`RuntimeError: Detected that PyTorch and torch_sparse were compiled with different CUDA versions.PyTorch has CUDA version 11.3 and torch_sparse has CUDA version 11.0.Please reinstall the torch_sparse that matches your PyTorch install原创 2023-08-04 13:59:13 · 706 阅读 · 0 评论
分享