easy5 pts · first answer countsdeep-learningnumerical-stabilityloss-functions
NaN from a hand-written log loss
A custom loss computes -(y * torch.log(p)).sum() and turns NaN when some p values reach exactly 0. What is the simplest fix?
Discussion 0
Join free to post in the discussion.
Related questions
- Expected starting loss, 10 classesMachine Learning Engineer
- Parameters in nn.Linear(10, 5)Machine Learning Engineer
- Why sigmoid slows deep trainingMachine Learning Engineer
- Range of tanhMachine Learning Engineer
- Cross-entropy loss by handMachine Learning Engineer
- Telling autograd to track a tensorMachine Learning Engineer
- Why wrap inference in no_gradMachine Learning Engineer
- Logging loss without leaking memoryMachine Learning Engineer