问题描述
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中即可