I was writing code for backpropagation.

*{moderator edit - solution code removed}*

the two sets of code are giving me different accuracy, why is that even tho these to mean the same

can someone make sense of it?

I was writing code for backpropagation.

*{moderator edit - solution code removed}*

the two sets of code are giving me different accuracy, why is that even tho these to mean the same

can someone make sense of it?

Have a slightly closer look at the code. How are those the equivalent?

But even once you fix that, you can still get different answers. E.g. these two lines will have different rounding behavior:

When you are operating in floating point, you have literally 2^{32} or 2^{64} numbers that you can represent between -\infty and +\infty, which is pretty sad compared to the abstract beauty of \mathbb{R}. It’s easy to find cases in which mathematically equivalent implementations give different behavior due to different error propagation.

oops sorry… my bad

thanks, i get it now