HardSigmoid#
Domain:
ai.onnxSince 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
Node:
HardSigmoid(X) -> (Y)
Attributes:
alpha = 0.5
beta = 0.6000000238418579
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
Node:
HardSigmoid(X) -> (Y)
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
Node:
HardSigmoid(X) -> (Y)
Attributes:
alpha = 0.5
beta = 0.6000000238418579
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)’]