Sigmoid#

  • Domain: ai.onnx

  • Since version: 13

Sigmoid takes one input data (Tensor ) and produces one output data (Tensor ) where the sigmoid function, y = 1 / (1 + exp(-x)), is applied to the tensor element-wise.

Inputs

  • X (T): Input tensor

Outputs

  • Y (T): Output tensor

Type Constraints

  • T: Constrain input and output types to float tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16).

Examples#

test_cc_sigmoid

Node:
  Sigmoid(X) -> (Y)
Inputs:
  X: shape=(2, 3), dtype=float32
    [[-4., -1.,  0.],
     [ 1.,  2.,  4.]]

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[0.01798621, 0.26894143, 0.5       ],
     [0.7310586 , 0.880797  , 0.98201376]]

test_cc_sigmoid_bfloat16

Node:
  Sigmoid(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=bfloat16
    [[-2, -1, 0],
     [0.5, 1, 2]]

Outputs:
  y: shape=(2, 3), dtype=bfloat16
    [[0.119141, 0.269531, 0.5],
     [0.621094, 0.730469, 0.878906]]

test_cc_sigmoid_double

Node:
  Sigmoid(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=float64
    [[-2. , -1. ,  0. ],
     [ 0.5,  1. ,  2. ]]

Outputs:
  y: shape=(2, 3), dtype=float64
    [[0.11920292, 0.26894142, 0.5       ],
     [0.62245933, 0.73105858, 0.88079708]]

test_cc_sigmoid_float16

Node:
  Sigmoid(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=float16
    [[-2. , -1. ,  0. ],
     [ 0.5,  1. ,  2. ]]

Outputs:
  y: shape=(2, 3), dtype=float16
    [[0.1192, 0.269 , 0.5   ],
     [0.6226, 0.731 , 0.881 ]]

Differences with previous version (6)#

SchemaDiff: Sigmoid (domain 'ai.onnx')

  • old version: 6

  • new version: 13

  • breaking: no

Type constraints:

  • changed ‘T’: added types: [‘tensor(bfloat16)’]

Version History#