@mmisiur thanks for your reply.
I have tried setting learning_rate to be as low as 0.001 and as high as 1. The code pasted was from the second iteration.
Also i being a loop variable inside the loop, I guess it wouldn’t matter. Just to be sure though, I have changed it to j. Still no luck .