This error in my case is from zero-division error, which means the sum of exp(output_i) is 0.
You could try to think how to avoid zero-division error in your problem, if your error was also caused by zero-division error.