RuntimeError: Event device type CUDA does not match blocking stream's device type CPU

when I do the unittest of test_autograd.py on pytorch1.11.0, it throw an RuntimeError: Event device type CUDA does not match blocking stream’s device type CPU. I want to know what causes this mistake.

I cannot reproduce the issue in v1.11.0 and a current source build from master and get:

root@dd61f7adc653:/opt/pytorch/pytorch/test# python test_autograd.py -v -k test_type_conversions
test_type_conversions (__main__.TestAutograd) ... ok

----------------------------------------------------------------------
Ran 1 test in 3.296s

OK

Is this test still passable on ROCM?

Oh, I don’t know as I’m not familiar with ROCm.
If this test is failing on your system using ROCm, please feel free to open an issue of GitHub so that the code owners can take a look at it.