All Questions
3 questions
2
votes
0
answers
672
views
How can I avoid log(0) in the implementation of the categorical cross-entropy loss function?
I have implemented the cross-entropy and its gradient in Python, but I'm not sure if it's correct. My implementation is for a neural network.
yEst = np.array([1, 6, 3, 5]).T # output of a softmax ...
3
votes
2
answers
3k
views
Derivative in both arguments of torch.nn.BCELoss()
When using a torch.nn.BCELoss() on two arguments that are both results of some earlier computation, I get some curious error, which this question is about:
RuntimeError: the derivative for 'target' ...
2
votes
2
answers
2k
views
RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes' failed
I get:
RuntimeError: Assertion `cur_target >= 0 && cur_target < n_classes'
failed. at
/opt/conda/conda-bld/pytorch_1550796191843/work/aten/src/THNN/generic/ClassNLLCriterion.c:93
...