refine leaky_relu docs (#26558)

test_feature_precision_test_c
zhupengyang 5 years ago committed by GitHub
parent 66596bd20f
commit 81c127d4ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -419,7 +419,7 @@ def leaky_relu(x, negative_slope=0.01, name=None):
paddle.disable_static()
x = paddle.to_tensor(np.array([-2, 0, 1]))
x = paddle.to_tensor(np.array([-2, 0, 1], 'float32'))
out = F.leaky_relu(x) # [-0.02, 0., 1.]
"""
@ -466,11 +466,11 @@ def prelu(x, weight, name=None):
paddle.disable_static()
data = np.array([[[[-2.0, 3.0, -4.0, 5.0],
[ 3.0, -4.0, 5.0, -6.0],
[-7.0, -8.0, 8.0, 9.0]],
[[ 1.0, -2.0, -3.0, 4.0],
[-5.0, 6.0, 7.0, -8.0],
[ 6.0, 7.0, 8.0, 9.0]]]], 'float32')
[ 3.0, -4.0, 5.0, -6.0],
[-7.0, -8.0, 8.0, 9.0]],
[[ 1.0, -2.0, -3.0, 4.0],
[-5.0, 6.0, 7.0, -8.0],
[ 6.0, 7.0, 8.0, 9.0]]]], 'float32')
x = paddle.to_tensor(data)
w = paddle.to_tensor(np.array([0.25]).astype('float32'))
out = F.prelu(x, w)

@ -625,7 +625,7 @@ class LeakyReLU(layers.Layer):
paddle.disable_static()
m = paddle.nn.LeakyReLU()
x = paddle.to_tensor(np.array([-2, 0, 1]))
x = paddle.to_tensor(np.array([-2, 0, 1], 'float32'))
out = m(x) # [-0.02, 0., 1.]
"""

Loading…
Cancel
Save