During the backward pass, I saw that stride wasn't multiplied with h and w. And it's affecting the output.