RuntimeError: cuda runtime error (9) when implementing Kalman Filter

Hi, I’m implementing a baseline tracker using Kalman Filter and bbox matching. I implemented my Kalman Filter with many cuda tensor broadcastings going on. However, when I run inference, the script always crashes after a few frames (weirdly, not at the 0-th frame), and I got all sorts of “configuration errors” during debugging. The most frequent one looks like the following:

RuntimeError: cuda runtime error (9) : invalid configuration argument at /pytorch/aten/src/THC/THCTensorMathCompare.cuh:82

when I’m trying to determine if a detection confidence is below a threshold, using bbox[d, 4] < thresh.

I also tried to use pdb to poke into the pipeline to see if I got any tensor shapes wrong. However, at some break point when I got the error message above generated by some expression, if I enter that same expression again, the right tensor came out without error (exactly the same expression!). This behavior really confused me as I cannot find where my bug is.

Any help or suggestions will be appreciated! Thanks!

Did you write a custom CUDA extension or are you using plain PyTorch methods?
Could you post your code so that we could take a look at it, please?