未验证 提交 cde2b24d 编写于 作者: L Linjie Chen 提交者: GitHub

Update api docs (#42725)

上级 2012672c
......@@ -392,20 +392,24 @@ def hsigmoid_loss(input,
paddle.set_device('cpu')
input = paddle.uniform([2, 3])
# [[-0.8018668 0.8736385 -0.9064771 ] # random
# [-0.10228515 -0.87188244 -0.8783718 ]] # random
input = paddle.uniform([4, 3])
# [[0.45424712 -0.77296764 0.82943869] # random
# [0.85062802 0.63303483 0.35312140] # random
# [0.57170701 0.16627562 0.21588242] # random
# [0.27610803 -0.99303514 -0.17114788]] # random
label = paddle.to_tensor([0, 1, 4, 5])
num_classes = 5
weight=paddle.uniform([num_classes-1, 3])
# [[-0.24148715 0.8449961 -0.7399121 ] # random
# [-0.9800559 0.43509364 0.9091208 ] # random
# [ 0.60194826 0.10430074 -0.4521166 ] # random
# [-0.4469818 -0.01536179 -0.604454 ]] # random
# [[-0.64477652 0.24821866 -0.17456549] # random
# [-0.04635394 0.07473493 -0.25081766] # random
# [ 0.05986035 -0.12185556 0.45153677] # random
# [-0.66236806 0.91271877 -0.88088769]] # random
out=F.hsigmoid_loss(input, label, num_classes, weight)
# [[3.0159328]
# [2.2407534]]
# [[1.96709502]
# [2.40019274]
# [2.11009121]
# [1.92374969]]
"""
if _non_static_mode():
......
......@@ -465,14 +465,18 @@ class HSigmoidLoss(Layer):
import paddle
paddle.set_device('cpu')
input = paddle.uniform([2, 3])
# [[-0.2820413 0.9528898 -0.81638825] # random
# [-0.6733154 -0.33866507 0.25770962]] # random
input = paddle.uniform([4, 3])
# [[0.56194401 -0.22450298 -0.10741806] # random
# [0.36136317 0.23556745 0.88748658] # random
# [0.18151939 0.80947340 -0.31078976] # random
# [0.68886101 -0.14239830 -0.41297770]] # random
label = paddle.to_tensor([0, 1, 4, 5])
m = paddle.nn.HSigmoidLoss(3, 5)
out = m(input, label)
# [[2.4543471]
# [1.9359267]]
# [[2.42524505]
# [1.74917245]
# [3.14571381]
# [2.34564662]]
"""
def __init__(self,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册