do you mean this?

Yes exactly.

I don’t know if they refer to the same problem or which one should I believe.

These two things won’t tell you the exact cause but only point you to the right direction.
You will have to do the last step yourself by checking what are the values of your Tensors to figure out when they actually become nan. But as I mentioned, optimization leading to same values could be the reason here.