Softplus#

  • Domain: ai.onnx

  • Since version: 22

Softplus takes one input data (Tensor ) and produces one output data (Tensor ) where the softplus function, y = ln(exp(x) + 1), is applied to the tensor elementwise.

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_softplus

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

Outputs:
  Y: shape=(2, 3), dtype=float32
    [[0.01814993, 0.3132617 , 0.6931472 ],
     [1.3132617 , 2.126928  , 4.01815   ]]

test_cc_softplus_bfloat16

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

Outputs:
  y: shape=(2, 3), dtype=bfloat16
    [[0.126953, 0.3125, 0.691406],
     [0.972656, 1.3125, 2.125]]

test_cc_softplus_example

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

Outputs:
  y: shape=(3,), dtype=float32
    [0.3132617, 0.6931472, 1.3132617]

test_cc_softplus_float16

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

Outputs:
  y: shape=(2, 3), dtype=float16
    [[0.127 , 0.3132, 0.6934],
     [0.974 , 1.313 , 2.127 ]]

Differences with previous version (1)#

SchemaDiff: Softplus (domain 'ai.onnx')

  • old version: 1

  • new version: 22

  • breaking: no

Type constraints:

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

Version History#