in torch:

loss = error.pow(2).sum()

in numpy:

loss = (error ** 2).mean()

that’s the point. learning rate is too small, maybe change it to lr*(end-start) or:

loss =error.pow(2).mean()

fixes it in my computer