Softsign#

  • Domain: ai.onnx

  • Since version: 22

Calculates the softsign (x/(1+``|x|``)) of the given input tensor element-wise.

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The softsign (x/(1+``|x|``)) values of the input tensor computed element-wise

Type Constraints

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

Examples#

test_cc_softsign

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

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[-0.8      , -0.5      ,  0.       ],
     [ 0.5      ,  0.6666667,  0.8      ]]

test_cc_softsign_bfloat16

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

Outputs:
  y: shape=(2, 3), dtype=bfloat16
    [[-0.667969, -0.5, 0],
     [0.333984, 0.5, 0.667969]]

test_cc_softsign_example

Node:
  Softsign(x) -> (y)
Inputs:
  x: shape=(3,), dtype=float32
    [-1.,  0.,  1.]

Outputs:
  y: shape=(3,), dtype=float32
    [-0.5,  0. ,  0.5]

test_cc_softsign_float16

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

Outputs:
  y: shape=(2, 3), dtype=float16
    [[-0.6665, -0.5   ,  0.    ],
     [ 0.3333,  0.5   ,  0.6665]]

Differences with previous version (1)#

SchemaDiff: Softsign (domain 'ai.onnx')

  • old version: 1

  • new version: 22

  • breaking: no

Type constraints:

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

Version History#