Solved by jin8495 in post #2 
              
              
                Ok. I have figured it out. 
‘state_dict_before’ and ‘state_dict_after’ has pointers of parameters. It was not deep-copied when I assigned them.