Hi,
As long as you don’t use the now deprecated .data, the autograd engine will detect anything that would lead to wrong gradient being computed. In your case for example, this inplace modification. Cloning here is the right fix and will give you the correct gradient.