Yes, I saw that post.
But, still gives me the error although I fix the code to
self.optimizer['classifier'].zero_grad()
foreProb.backward(retain_graph=True)
self.optimizer['classifier'].step()
                
self.optimizer['classifier'].zero_grad()
backProb.backward()
self.optimizer['classifier'].step()

The error is
one of the variables needed for gradient computation has been modified by an inplace operation
This error doesn’t appear with the old pytorch version…