-
CrossEntropy의 이해카테고리 없음 2022. 6. 13. 21:47
https://gaussian37.github.io/dl-concept-nll_loss/
https://pytorch.org/docs/stable/generated/torch.nn.CrossEntropyLoss.html
(+211123)
pytorch의 default : 최종 linear output을 softmax -> 모든 값을 nll 에 각각 태워줌
pytorch의 default X
argmax값만 nll에 태워줌
torch.nn.CrossEntropy는 log_softmax 를 거친 값을 target과 비교한다.
softmax NLL loss pytorch의 CrossEntropy는 다음과 같이 풀어쓰기 가능하다.
torch의 crossentropy
https://pytorch.org/docs/stable/generated/torch.sum.html
NLL loss 쓰기위해 output을 log_softmax 태워준 모습
scale값 통일을 위해선, preference 를 보기 위해 log_softmax 거친 값을 봐야 할 듯.