Update celoss.py

This commit is contained in:
Bin Lu 2021-05-31 14:28:52 +08:00 committed by GitHub
parent 8edec09dd4
commit 182bf94343
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,3 +112,4 @@ class KLDivLoss(paddle.nn.Layer):
p = paddle.nn.functional.softmax(p)
q = paddle.nn.functional.softmax(q)
return -(p * paddle.log(q + 1e-8)).sum(1).mean()