leaky_relu

paddle.sparse.nn.functional. leaky_relu ( x, negative_slope=0.01, name=None ) [source]

sparse leaky_relu activation, requiring x to be a SparseCooTensor or SparseCsrTensor.

\[leaky\_relu(x)= \left\{ egin{array}{rcl} x, & & if \ x >= 0 \ negative\_slope * x, & & otherwise \ \end{array}\]

ight.

Parameters:

x (Tensor): The input Sparse Tensor with data type float32, float64. negative_slope (float, optional): Slope of the activation function at

System Message: ERROR/3 (/usr/local/lib/python3.8/site-packages/paddle/sparse/nn/functional/activation.py:docstring of paddle.sparse.nn.functional.activation.leaky_relu, line 16)

Unexpected indentation.

\(x < 0\) . Default is 0.01.

System Message: WARNING/2 (/usr/local/lib/python3.8/site-packages/paddle/sparse/nn/functional/activation.py:docstring of paddle.sparse.nn.functional.activation.leaky_relu, line 17)

Block quote ends without a blank line; unexpected unindent.

name (str, optional): Name for the operation (optional, default is None).

For more information, please refer to Name.

Returns:

A Sparse Tensor with the same data type and shape as x .

Examples:
import paddle

dense_x = paddle.to_tensor([-2., 0., 5.])
sparse_x = dense_x.to_sparse_coo(1)
out = paddle.sparse.nn.functional.leaky_relu(sparse_x, 0.5)