Thanks, @albanD for your quick response.
I tried downgrading the PyTorch version from 1.9 to PyTorch 1.4 and the issue gets resolved.
Why is that happening? Does that mean there are issues in PyTorch 1.4 also? Will the results won’t be correct?
I am using this code from a GitHub repository of a published paper in 2019.