当前位置:网站首页>CUDA error:invalid argument

CUDA error:invalid argument

2021-06-23 23:45:00 网奇

当使用torch.view()时


出现 RuntimeError: invalid argument 1: input is not contiguous at /pytorch/torch/lib/TH/generic/THTensor.c:231

可以使用 tensor.contiguous() 解决

比如:

mask[idx, :].view(bat_size, 1) 变成 mask[idx, :].contiguous().view(bat_size, 1)

不能解决问题

https://stackoverflow.com/questions/13994799/cuda-invalid-argument-error-on-second-kernel

cudaLimitMallocHeapSize controls the size in bytes of the heap used by the malloc() and free() device system calls. Setting cudaLimitMallocHeapSize must be performed before launching any kernel that uses the malloc() or free() device system calls, otherwise cudaErrorInvalidValue will be returned. This limit is only applicable to devices of compute capability 2.0 and higher. Attempting to set this limit on devices of compute capability less than 2.0 will result in the error cudaErrorUnsupportedLimit being returned.

这个还没试

版权声明
本文为[网奇]所创,转载请带上原文链接,感谢
https://blog.csdn.net/jacke121/article/details/118160916

随机推荐