The derivative of your loss function wrt the parameters is independent of tar.
If you use a loss function like loss = (zz-tar)**2, you’ll see the behavior you are expecting.
PS: I’m not a huge fan of tagging people, as this might demotivate others to post a solution.