当使用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.
这个还没试