The problem lies within your iterations per epochs: in your keras code, you do 100 epochs with a batchsize of 1 and a dataset of size 1691, resulting in a total number of 1691*100 updates.
In Pytorch you do 100 epochs with only 1 update each, since you calculate the gradient on the whole dataset (which you forwarded all at once). To reproduce the behavior, you’d have to iterate over the first dimension of your tensor too.