Question:
When I encountered this problem on the way to write the model, baidu either said it was the pytorch version problem or the category index exceeded, but it was useless, because the error was a very simple assignment operation.
scores[:, 0] = -float("inf")
#RuntimeError: CUDA error: an illegal memory access was encountered
At the same time, in the process of debugging, it is found that a warning burst after the execution of a network of the model
lm_logits = self.linear(outputs) + self.bias
#warning:Thudacheck FAIL file=/pytorch/aten/c/THC/Thccachinghostallocator cpp Line=278 error=700: an illegal memory access was encountered
At first glance, both places are relatively simple, but they reported strange mistakes.
Solution:
The debug process found an exception
In the data data output by the pytorch network, the variable does not display the specific network output value, but the address information of the data
T:torch.Tensor object at 0x7fb27e7c8f30
data:torch.Tensor object at 0x7fb27e7c8f30
Later, it was found that it was because of self The linear layer is’ CPU ‘, while other networks are on’ CUDA ‘, which is equivalent to the inconsistency caused by the forward propagation of’ CUDA ‘type data to the’ CPU ‘network. Just transfer the network to’ CUDA ‘.
Read More:
- How to Solve Error: RuntimeError CUDA out of memory
- [How to Solve] RuntimeError: CUDA out of memory.
- [Solved] RuntimeError: cuda runtime error (100) : no CUDA-capable device is detected at
- [Solved] Error starting proxy server: oserror (10013), “an attempt was made to access the socket in a way that the access permission is not allowed.”, None, 10013, None)
- [Solved] RuntimeError: DefaultCPUAllocator: not enough memory: you tried to allocate 1105920 bytes.
- [Solved] RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors
- [Solved] theano-GPU Error: pygpu.gpuarray.GpuArrayException: b‘cuMemAlloc: CUDA_ERROR_OUT_OF_MEMORY: out of memory
- pytorch: RuntimeError CUDA error device-side assert triggered
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cubla…
- [Solved] RuntimeError: cuda runtime error (801) : operation not supported at
- [Solved] torchsummary Error: RuntimeError: Input type (torch.cuda.FloatTensor) and weight type (torch.F
- [Solved] Using summary to View network parameters Error: RuntimeError: Input type (torch.cuda.FloatTensor)
- Pytorch CUDA Error: UserWarning: CUDA initialization: CUDA unknown error…
- [Solved] RuntimeError: CUDA error: CUBLAS_STATUS_EXECUTION_FAILED when calling `cublasSgemm
- YOLOX Model conversion error: [TensorRT] ERROR: runtime.cpp (25) – Cuda Error in allocate: 2 (out of memory)
- [DL Common Issue] RuntimeError: CUDA error 59: Device-side assert triggered
- Pytorch torch.cuda.FloatTensor Error: RuntimeError: one of the variables needed for gradient computation has…
- [Solved] RuntimeError: cuda runtime error: device-side assert trigger
- [Solved] RuntimeError : PyTorch was compiled without NumPy support
- [Solved] RuntimeError: Input type (torch.FloatTensor) and weight type (torch.cuda.FloatTensor) should be the