Sin#

  • Domain: ai.onnx

  • Since version: 22

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

Inputs

  • input (T): Input tensor

Outputs

  • output (T): The sine 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_sin

Node:
  Sin(x) -> (y)
Inputs:
  x: shape=(2, 3), dtype=float32
    [[-3.14159, -1.5708 ,  0.     ],
     [ 1.0472 ,  1.5708 ,  3.14159]]

Outputs:
  y: shape=(2, 3), dtype=float32
    [[-2.5351817e-06, -1.0000000e+00,  0.0000000e+00],
     [ 8.6602664e-01,  1.0000000e+00,  2.5351817e-06]]

test_sin

Node:
  Sin(x) -> (y)
Inputs:
  x: shape=(3, 4, 5), dtype=float32
    [[[0.5665616 , 0.7457818 , 0.97100276, 0.4443592 , 0.4442647 ],
      [0.7628944 , 0.87734866, 0.5230672 , 0.2855087 , 0.79399663],
      [0.40414217, 0.60542035, 0.4549379 , 0.530079  , 0.4359654 ],
      [0.16703498, 0.64533466, 0.8153506 , 0.681705  , 0.88432455]],

     [[0.06596019, 0.08141465, 0.49587995, 0.12310889, 0.28691137],
      [0.04790118, 0.5155199 , 0.7137708 , 0.04374827, 0.9977479 ],
      [0.5978522 , 0.5865951 , 0.39716926, 0.43898672, 0.25327316],
      [0.5297574 , 0.5436708 , 0.74823534, 0.8180335 , 0.66857344]],

     [[0.86182827, 0.70817924, 0.23636054, 0.6562355 , 0.86890894],
      [0.8393313 , 0.32443324, 0.15917933, 0.893939  , 0.91269016],
      [0.30185628, 0.13158494, 0.32568365, 0.9401739 , 0.39366215],
      [0.08773083, 0.60704976, 0.1554775 , 0.9583321 , 0.8756153 ]]]

Outputs:
  y: shape=(3, 4, 5), dtype=float32
    [[[0.53673404, 0.6785463 , 0.82545215, 0.4298794 , 0.42979407],
      [0.6910165 , 0.76904684, 0.49953955, 0.2816456 , 0.7131606 ],
      [0.39323017, 0.5691078 , 0.43940654, 0.5056015 , 0.42228568],
      [0.16625933, 0.6014658 , 0.727966  , 0.6301179 , 0.77348703]],

     [[0.06591237, 0.08132474, 0.4758058 , 0.12279815, 0.2829912 ],
      [0.04788287, 0.49298728, 0.6546888 , 0.04373432, 0.84025204],
      [0.5628685 , 0.55352855, 0.3868095 , 0.42502248, 0.25057402],
      [0.505324  , 0.517281  , 0.68034655, 0.72980285, 0.6198672 ]],

     [[0.7590341 , 0.6504519 , 0.2341659 , 0.6101386 , 0.76362497],
      [0.74419665, 0.31877163, 0.15850796, 0.77954495, 0.79115194],
      [0.29729307, 0.13120554, 0.31995657, 0.80766064, 0.38357303],
      [0.08761834, 0.5704468 , 0.15485185, 0.81823385, 0.7679378 ]]]

test_sin_example

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

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

Differences with previous version (7)#

SchemaDiff: Sin (domain 'ai.onnx')

  • old version: 7

  • new version: 22

  • breaking: no

Type constraints:

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

Version History#