.. _op_ai_onnx_LeakyRelu: LeakyRelu ========= - **Domain**: ``ai.onnx`` - **Since version**: 16 LeakyRelu takes input data (Tensor ) and an argument alpha, and produces one output data (Tensor ) where the function ``f(x) = alpha * x for x = 0``, is applied to the data tensor elementwise. **Inputs** - **X** (*T*): Input tensor **Outputs** - **Y** (*T*): Output tensor **Attributes** - **alpha** (*float*): Coefficient of leakage. **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_cc_leakyrelu** .. code-block:: text Node: LeakyRelu(X) -> (Y) Attributes: alpha = 0.10000000149011612 .. code-block:: text Inputs: X: shape=(2, 3), dtype=float32 [[-3., -1., 0.], [ 1., 2., 3.]] Outputs: Y: shape=(2, 3), dtype=float32 [[-0.3, -0.1, 0. ], [ 1. , 2. , 3. ]] **test_cc_leakyrelu_default** .. code-block:: text Node: LeakyRelu(X) -> (Y) .. code-block:: text Inputs: X: shape=(2, 3), dtype=float32 [[-3., -1., 0.], [ 1., 2., 3.]] Outputs: Y: shape=(2, 3), dtype=float32 [[-0.03, -0.01, 0. ], [ 1. , 2. , 3. ]] **test_cc_leakyrelu_example** .. code-block:: text Node: LeakyRelu(X) -> (Y) Attributes: alpha = 0.10000000149011612 .. code-block:: text Inputs: X: shape=(3, 4, 5), dtype=float32 [[[-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.]], [[-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.]], [[-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.], [-1., -1., -1., -1., -1.]]] Outputs: Y: shape=(3, 4, 5), dtype=float32 [[[-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1]], [[-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1]], [[-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1], [-0.1, -0.1, -0.1, -0.1, -0.1]]] Differences with previous version (6) ------------------------------------- **SchemaDiff**: ``LeakyRelu`` (domain ``'ai.onnx'``) * old version: 6 * new version: 16 * breaking: no **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 6 ` - :doc:`Version 1 `