RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously

RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously,第1张

RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might be asynchronously 报错
Traceback (most recent call last):
  File "E:/Program Files/PyCharm 2019.2/PyG/test.py", line 70, in 
    loss.backward()  # 反向传播计算梯度
  File "F:Anaconda3libsite-packagestorch_tensor.py", line 307, in backward
    torch.autograd.backward(self, gradient, retain_graph, create_graph, inputs=inputs)
  File "F:Anaconda3libsite-packagestorchautograd__init__.py", line 156, in backward
    allow_unreachable=True, accumulate_grad=True)  # allow_unreachable flag
RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.
原因

搭建GCN模型时:

self.conv1 = GCNConv(features, 32)
self.conv2 = GCNConv(32, classes)

classes与原始数据的类别数不一致。

解决
self.conv2 = GCNConv(32, dataset.num_classes)

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5712103.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存