Thanks for your help. I was able to fix the issue. you were right it was with the leaf tensor t.
Recreating the tensor at each epoch detached it from the computation graph. I have been able to get it working now.
On another note, I am obtaining the loss curve and it appears to be declining as expected, however, curve does not seem to converge, here is a figure of the learning curve.

image3067×2086 115 KB

Do you have an suggestions?