Tan#

  • Domain: ai.onnx

  • Since version: 22

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

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The tangent 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_tan

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

Outputs:
  y: shape=(2, 3), dtype=float32
    [[-1.5574077 , -0.5463025 ,  0.        ],
     [ 0.25534192,  0.5463025 ,  1.5574077 ]]

test_tan

Node:
  Tan(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
    [[[ 6.77946663e+00, -7.12256074e-01, -6.70666695e-01,  7.20947838e+00,
        6.60606861e-01],
      [-5.33299160e+00,  3.33148074e+00,  3.39567691e-01,  6.89817429e-01,
        2.47078270e-01],
      [-1.24058056e+00, -2.12183809e+00, -9.20650885e-02, -1.26580343e-01,
       -3.12957358e+00],
      [-6.21922791e-01, -9.26484048e-01, -6.71269238e-01, -1.33526921e+00,
       -9.02167559e-01]],

     [[ 1.99147725e+00, -8.34803820e-01,  1.51750743e+00,  1.14461586e-01,
       -1.08645260e+00],
      [ 2.68056846e+00, -2.25967020e-01,  3.41962218e-01, -2.13656977e-01,
        4.49458885e+00],
      [ 1.26291458e-02,  8.15623939e-01, -3.13812089e+00,  2.03253314e-01,
       -2.09530258e+00],
      [-7.43881583e-01,  2.83492527e+01, -2.21474743e+00, -4.54707563e-01,
       -9.20961440e-01]],

     [[ 3.55181999e+01, -9.83196616e-01, -1.80194044e+00,  1.26915109e+00,
       -2.55269200e-01],
      [ 4.61353350e+00, -5.10988593e-01,  9.90588069e-02, -3.81717891e-01,
        7.84354389e-01],
      [-1.61510015e+00, -4.17205602e-01,  4.90164816e-01, -3.58188868e-01,
       -6.11351907e-01],
      [ 6.28859922e-02, -1.45116821e-01, -2.29792738e+00,  5.35964727e-01,
       -1.71153396e-01]]]

test_tan_example

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

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

Differences with previous version (7)#

SchemaDiff: Tan (domain 'ai.onnx')

  • old version: 7

  • new version: 22

  • breaking: no

Type constraints:

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

Version History#