.. _op_ai_onnx_HardSigmoid: HardSigmoid =========== - **Domain**: ``ai.onnx`` - **Since version**: 22 HardSigmoid takes one input data (Tensor ) and produces one output data (Tensor ) where the HardSigmoid function, y = max(0, min(1, alpha \* x + beta)), is applied to the tensor elementwise. **Inputs** - **X** (*T*): Input tensor **Outputs** - **Y** (*T*): Output tensor **Attributes** - **alpha** (*float*): Value of alpha. - **beta** (*float*): Value of beta. **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16). Examples -------- **test_cc_hardsigmoid** .. code-block:: text Node: HardSigmoid(X) -> (Y) Attributes: alpha = 0.5 beta = 0.6000000238418579 .. code-block:: text Inputs: X: shape=(2, 3), dtype=float32 [[-3. , -1. , -0.5], [ 0.5, 1. , 3. ]] Outputs: Y: shape=(2, 3), dtype=float32 [[0. , 0.10000002, 0.35000002], [0.85 , 1. , 1. ]] **test_cc_hardsigmoid_default** .. code-block:: text Node: HardSigmoid(X) -> (Y) .. code-block:: text Inputs: X: shape=(2, 3), dtype=float32 [[-3. , -1. , -0.5], [ 0.5, 1. , 3. ]] Outputs: Y: shape=(2, 3), dtype=float32 [[0. , 0.3, 0.4], [0.6, 0.7, 1. ]] **test_cc_hardsigmoid_example** .. code-block:: text Node: HardSigmoid(X) -> (Y) Attributes: alpha = 0.5 beta = 0.6000000238418579 .. code-block:: text Inputs: X: shape=(3,), dtype=float32 [-1., 0., 1.] Outputs: Y: shape=(3,), dtype=float32 [0.10000002, 0.6 , 1. ] Differences with previous version (6) ------------------------------------- **SchemaDiff**: ``HardSigmoid`` (domain ``'ai.onnx'``) * old version: 6 * new version: 22 * breaking: no **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 6 ` - :doc:`Version 1 `