Cosh#

  • Domain: ai.onnx

  • Since version: 22

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

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The hyperbolic cosine 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_cosh

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

Outputs:
  y: shape=(2, 3), dtype=float32
    [[ 3.7621958,  1.127626 ,  1.       ],
     [ 1.127626 ,  1.5430806, 10.067662 ]]

test_cosh

Node:
  Cosh(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
    [[[2.197907 , 1.1977133, 1.1796373, 2.2148626, 1.1753038],
      [2.1233928, 1.9359893, 1.0540595, 1.1879311, 1.0294807],
      [1.4252882, 1.7098715, 1.0042171, 1.0079372, 1.9069998],
      [1.1588156, 1.2924317, 1.1798973, 1.4623853, 1.2817005]],

     [[1.675807 , 1.2518475, 4.3653274, 1.0065011, 1.3617283],
      [1.8315544, 1.0247959, 1.0547768, 1.0222354, 2.061705 ],
      [1.0000798, 1.2433362, 1.908283 , 1.020172 , 1.7031338],
      [1.211595 , 2.4295785, 1.7327075, 1.0924534, 1.2899976]],

     [[2.574956 , 5.367239 , 1.6217042, 1.4366463, 1.0313959],
      [3.0615118, 1.1136713, 1.0048784, 1.0672238, 1.2294735],
      [1.5625743, 1.0791335, 1.1056634, 1.0597367, 1.1543651],
      [1.0019728, 1.010402 , 1.7521976, 1.1234951, 1.0144014]]]

test_cosh_example

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

Outputs:
  y: shape=(3,), dtype=float32
    [1.5430806, 1.       , 1.5430806]

Differences with previous version (9)#

SchemaDiff: Cosh (domain 'ai.onnx')

  • old version: 9

  • new version: 22

  • breaking: no

Type constraints:

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

Version History#