栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

RuntimeError: CUDA error: an illegal memory access was encountered

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

RuntimeError: CUDA error: an illegal memory access was encountered

问题描述
Traceback (most recent call last):
  File "/home/zyc/code/code/mypointcloudnet/pointnet/pointnet/loss.py", line 53, in 
    print(loss)
  File "/home/zyc/miniconda3/lib/python3.7/site-packages/torch/_tensor.py", line 305, in __repr__
    return torch._tensor_str._str(self)
  File "/home/zyc/miniconda3/lib/python3.7/site-packages/torch/_tensor_str.py", line 434, in _str
    return _str_intern(self)
  File "/home/zyc/miniconda3/lib/python3.7/site-packages/torch/_tensor_str.py", line 409, in _str_intern
    tensor_str = _tensor_str(self, indent)
  File "/home/zyc/miniconda3/lib/python3.7/site-packages/torch/_tensor_str.py", line 264, in _tensor_str
    formatter = _Formatter(get_summarized_data(self) if summarize else self)
  File "/home/zyc/miniconda3/lib/python3.7/site-packages/torch/_tensor_str.py", line 100, in __init__
    nonzero_finite_vals = torch.masked_select(tensor_view, torch.isfinite(tensor_view) & tensor_view.ne(0))
RuntimeError: CUDA error: an illegal memory access was encountered
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.

代码块22

class chamfer_function(torch.autograd.Function):
    @staticmethod
    def forward(ctx, xyz1, xyz2):
        
        dist1, dist2, idx1, idx2 = chamfer.forward(xyz1, xyz2 )
        ctx.save_for_backward(xyz1, xyz2, idx1, idx2)

        return dist1, dist2

大概是 ,非法的tesor 进入到了cuda中

解决办法

大概原因是 我没有将要训练的数据放在tensor中,只需要调用 (data).cuda()将数据放在cuda中即可

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/844457.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号