当使用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 mallo