Erf#

  • Domain: ai.onnx

  • Since version: 13

Computes the Erf value of the input tensor element-wise.

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The error function of the input tensor computed element-wise. It has the same shape and type of the input.

Type Constraints

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

Examples#

test_cc_erf

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

Outputs:
  y: shape=(2, 3), dtype=float32
    [[-0.9953223, -0.8427008,  0.       ],
     [ 0.5204999,  0.8427008,  0.9953223]]

test_cc_erf_bfloat16

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

Outputs:
  y: shape=(2, 3), dtype=bfloat16
    [[-0.996094, -0.84375, 0],
     [0.519531, 0.84375, 0.996094]]

test_cc_erf_float16

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

Outputs:
  y: shape=(2, 3), dtype=float16
    [[-0.995 , -0.843 ,  0.    ],
     [ 0.5205,  0.843 ,  0.995 ]]

test_erf

Node:
  Erf(x) -> (y)
Inputs:
  x: shape=(3, 4, 5), dtype=float32
    [[[ 1.4243481 , -0.61890423, -0.5907667 ,  1.4329695 ,  0.5837956 ],
      [-1.3854368 ,  1.2791865 ,  0.32735094,  0.6038593 ,  0.24222691],
      [-0.89236253, -1.1303798 , -0.09180629, -0.12591071, -1.2615176 ],
      [-0.55638343, -0.747256  , -0.59118223, -0.9279915 , -0.73401135]],

     [[ 1.1054384 , -0.69560546, -2.1534553 ,  0.11396561, -0.8268097 ],
      [ 1.2137318 , -0.22223468,  0.32949635, -0.21049212,  1.3518724 ],
      [ 0.01262847,  0.6841954 , -1.2623075 ,  0.20052178, -1.1255072 ],
      [-0.6395738 ,  1.5355366 , -1.1466801 , -0.42676184, -0.74427605]],

     [[-1.5989435 ,  2.3646672 , -1.0641551 ,  0.90345967, -0.24993172],
      [-1.784248  , -0.47239977,  0.09873669, -0.36464727,  0.6651279 ],
      [-1.01641   , -0.39525023,  0.45574856, -0.3439513 , -0.5487247 ],
      [ 0.06280329, -0.14411083, -1.1603392 ,  0.49200374, -0.16951095]]]

Outputs:
  y: shape=(3, 4, 5), dtype=float32
    [[[ 0.95602536, -0.6185691 , -0.59654707,  0.957289  ,  0.5909756 ],
      [-0.94992274,  0.92955565,  0.3565956 ,  0.6068873 ,  0.26807094],
      [-0.793048  , -0.89009017, -0.103302  , -0.14132778, -0.9255853 ],
      [-0.5686274 , -0.7093878 , -0.5968777 , -0.81060743, -0.7007527 ]],

     [[ 0.88202405, -0.674754  , -0.9976767 ,  0.12804183, -0.75771135],
      [ 0.91392505, -0.24669716,  0.3587689 , -0.23405321,  0.9441028 ],
      [ 0.01424895,  0.666755  , -0.92576665,  0.22326821, -0.88854957],
      [-0.63426644,  0.9701124 , -0.8951218 , -0.4538454 , -0.70745975]],

     [[-0.9762561 ,  0.99917465, -0.8676612 ,  0.7986395 , -0.276254  ],
      [-0.98837435, -0.49591374,  0.11105143, -0.39392844,  0.653107  ],
      [-0.84940153, -0.4238166 ,  0.48076546, -0.373331  , -0.56225926],
      [ 0.07077286, -0.16149293, -0.89919585,  0.5134449 , -0.1894563 ]]]

test_erf_example

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

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

Differences with previous version (9)#

SchemaDiff: Erf (domain 'ai.onnx')

  • old version: 9

  • new version: 13

  • breaking: yes

Breaking reasons:

  • type constraint ‘T’ (changed): added types: [‘tensor(bfloat16)’]; removed types: [‘tensor(int16)’, ‘tensor(int32)’, ‘tensor(int64)’, ‘tensor(int8)’, ‘tensor(uint16)’, ‘tensor(uint32)’, ‘tensor(uint64)’, ‘tensor(uint8)’]

Type constraints:

  • [BREAKING] changed ‘T’: added types: [‘tensor(bfloat16)’]; removed types: [‘tensor(int16)’, ‘tensor(int32)’, ‘tensor(int64)’, ‘tensor(int8)’, ‘tensor(uint16)’, ‘tensor(uint32)’, ‘tensor(uint64)’, ‘tensor(uint8)’]

Version History#