未验证 提交 ddc6feab 编写于 作者: L LielinJiang 提交者: GitHub

polish kl_div doc (#55781)

上级 0c3b3698
......@@ -1610,7 +1610,10 @@ def kl_div(input, label, reduction='mean', name=None):
import paddle.nn.functional as F
shape = (5, 20)
x = paddle.uniform(shape, min=-10, max=10).astype('float32')
# input(x) should be a distribution in the log space
x = F.log_softmax(paddle.randn(shape), axis=1).astype('float32')
target = paddle.uniform(shape, min=-10, max=10).astype('float32')
# 'batchmean' reduction, loss shape will be [], who is 0-D Tensor
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册