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 <module>
    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中即可

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值