Hi,
How big is the difference.
Unfortunately, floating point computations are not associative. That means that if your version computes the same thing in a different order, it will be slightly different.
When doing gradient descent, such small differences will be amplified.
The way we usually check is by running a single backward pass with double precision numbers and make sure that the output is close enough to the input.
You can also try the gradcheck function to test your implementation.