未验证 提交 81c127d4 编写于 作者: Z zhupengyang 提交者: GitHub

refine leaky_relu docs (#26558)

上级 66596bd2
...@@ -419,7 +419,7 @@ def leaky_relu(x, negative_slope=0.01, name=None): ...@@ -419,7 +419,7 @@ def leaky_relu(x, negative_slope=0.01, name=None):
paddle.disable_static() 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.] out = F.leaky_relu(x) # [-0.02, 0., 1.]
""" """
...@@ -466,11 +466,11 @@ def prelu(x, weight, name=None): ...@@ -466,11 +466,11 @@ def prelu(x, weight, name=None):
paddle.disable_static() paddle.disable_static()
data = np.array([[[[-2.0, 3.0, -4.0, 5.0], data = np.array([[[[-2.0, 3.0, -4.0, 5.0],
[ 3.0, -4.0, 5.0, -6.0], [ 3.0, -4.0, 5.0, -6.0],
[-7.0, -8.0, 8.0, 9.0]], [-7.0, -8.0, 8.0, 9.0]],
[[ 1.0, -2.0, -3.0, 4.0], [[ 1.0, -2.0, -3.0, 4.0],
[-5.0, 6.0, 7.0, -8.0], [-5.0, 6.0, 7.0, -8.0],
[ 6.0, 7.0, 8.0, 9.0]]]], 'float32') [ 6.0, 7.0, 8.0, 9.0]]]], 'float32')
x = paddle.to_tensor(data) x = paddle.to_tensor(data)
w = paddle.to_tensor(np.array([0.25]).astype('float32')) w = paddle.to_tensor(np.array([0.25]).astype('float32'))
out = F.prelu(x, w) out = F.prelu(x, w)
......
...@@ -625,7 +625,7 @@ class LeakyReLU(layers.Layer): ...@@ -625,7 +625,7 @@ class LeakyReLU(layers.Layer):
paddle.disable_static() paddle.disable_static()
m = paddle.nn.LeakyReLU() 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.] out = m(x) # [-0.02, 0., 1.]
""" """
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册