tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

mul.https.any.js (37086B)


      1 // META: title=test WebNN API element-wise mul operation
      2 // META: global=window
      3 // META: variant=?cpu
      4 // META: variant=?gpu
      5 // META: variant=?npu
      6 // META: script=../resources/utils.js
      7 // META: timeout=long
      8 
      9 'use strict';
     10 
     11 // https://www.w3.org/TR/webnn/#api-mlgraphbuilder-binary
     12 // Compute the element-wise binary multiplication of the two input tensors.
     13 // MLOperand mul(MLOperand a, MLOperand b);
     14 
     15 const mulTests = [
     16  {
     17    'name': 'mul float32 1D constant tensors',
     18    'graph': {
     19      'inputs': {
     20        'inputA': {
     21          'data': [
     22            49.1112174987793,    11.907459259033203,   -21.115795135498047,
     23            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
     24            11.178888320922852,  -32.80592346191406,   83.31897735595703,
     25            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
     26            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
     27            -6.616114139556885,  21.72757911682129,    22.03150749206543,
     28            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
     29            -63.059783935546875, 3.3092827796936035,   9.884003639221191
     30          ],
     31          'descriptor': {shape: [24], dataType: 'float32'},
     32          'constant': true
     33        },
     34        'inputB': {
     35          'data': [
     36            74.96137237548828,   -34.53953170776367,  -33.316162109375,
     37            53.92023849487305,   -83.69075012207031,  19.785221099853516,
     38            36.28113555908203,   -34.31147766113281,  49.10429000854492,
     39            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
     40            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
     41            87.6099853515625,    -8.881865501403809,  71.79511260986328,
     42            -26.158620834350586, -18.935443878173828, 34.6467170715332,
     43            -60.95826721191406,  -11.119653701782227, 77.50324249267578
     44          ],
     45          'descriptor': {shape: [24], dataType: 'float32'},
     46          'constant': true
     47        }
     48      },
     49      'operators': [{
     50        'name': 'mul',
     51        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
     52        'outputs': 'output'
     53      }],
     54      'expectedOutputs': {
     55        'output': {
     56          'data': [
     57            3681.4443359375,    -411.278076171875,   703.4972534179688,
     58            3814.802978515625,  7910.138671875,      -1855.63720703125,
     59            405.582763671875,   1125.6197509765625,  4091.3193359375,
     60            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
     61            1264.6595458984375, -3041.78955078125,   2891.103759765625,
     62            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
     63            2197.89208984375,   1781.2109375,        2037.47900390625,
     64            3844.01513671875,   -36.79807662963867,  766.0423583984375
     65          ],
     66          'descriptor': {shape: [24], dataType: 'float32'}
     67        }
     68      }
     69    }
     70  },
     71  {
     72    'name': 'mul float32 1D tensors',
     73    'graph': {
     74      'inputs': {
     75        'inputA': {
     76          'data': [
     77            49.1112174987793,    11.907459259033203,   -21.115795135498047,
     78            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
     79            11.178888320922852,  -32.80592346191406,   83.31897735595703,
     80            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
     81            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
     82            -6.616114139556885,  21.72757911682129,    22.03150749206543,
     83            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
     84            -63.059783935546875, 3.3092827796936035,   9.884003639221191
     85          ],
     86          'descriptor': {shape: [24], dataType: 'float32'}
     87        },
     88        'inputB': {
     89          'data': [
     90            74.96137237548828,   -34.53953170776367,  -33.316162109375,
     91            53.92023849487305,   -83.69075012207031,  19.785221099853516,
     92            36.28113555908203,   -34.31147766113281,  49.10429000854492,
     93            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
     94            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
     95            87.6099853515625,    -8.881865501403809,  71.79511260986328,
     96            -26.158620834350586, -18.935443878173828, 34.6467170715332,
     97            -60.95826721191406,  -11.119653701782227, 77.50324249267578
     98          ],
     99          'descriptor': {shape: [24], dataType: 'float32'}
    100        }
    101      },
    102      'operators': [{
    103        'name': 'mul',
    104        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    105        'outputs': 'output'
    106      }],
    107      'expectedOutputs': {
    108        'output': {
    109          'data': [
    110            3681.4443359375,    -411.278076171875,   703.4972534179688,
    111            3814.802978515625,  7910.138671875,      -1855.63720703125,
    112            405.582763671875,   1125.6197509765625,  4091.3193359375,
    113            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
    114            1264.6595458984375, -3041.78955078125,   2891.103759765625,
    115            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
    116            2197.89208984375,   1781.2109375,        2037.47900390625,
    117            3844.01513671875,   -36.79807662963867,  766.0423583984375
    118          ],
    119          'descriptor': {shape: [24], dataType: 'float32'}
    120        }
    121      }
    122    }
    123  },
    124  {
    125    'name': 'mul float32 2D tensors',
    126    'graph': {
    127      'inputs': {
    128        'inputA': {
    129          'data': [
    130            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    131            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    132            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    133            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    134            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    135            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    136            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    137            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    138          ],
    139          'descriptor': {shape: [4, 6], dataType: 'float32'}
    140        },
    141        'inputB': {
    142          'data': [
    143            74.96137237548828,   -34.53953170776367,  -33.316162109375,
    144            53.92023849487305,   -83.69075012207031,  19.785221099853516,
    145            36.28113555908203,   -34.31147766113281,  49.10429000854492,
    146            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
    147            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
    148            87.6099853515625,    -8.881865501403809,  71.79511260986328,
    149            -26.158620834350586, -18.935443878173828, 34.6467170715332,
    150            -60.95826721191406,  -11.119653701782227, 77.50324249267578
    151          ],
    152          'descriptor': {shape: [4, 6], dataType: 'float32'}
    153        }
    154      },
    155      'operators': [{
    156        'name': 'mul',
    157        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    158        'outputs': 'output'
    159      }],
    160      'expectedOutputs': {
    161        'output': {
    162          'data': [
    163            3681.4443359375,    -411.278076171875,   703.4972534179688,
    164            3814.802978515625,  7910.138671875,      -1855.63720703125,
    165            405.582763671875,   1125.6197509765625,  4091.3193359375,
    166            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
    167            1264.6595458984375, -3041.78955078125,   2891.103759765625,
    168            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
    169            2197.89208984375,   1781.2109375,        2037.47900390625,
    170            3844.01513671875,   -36.79807662963867,  766.0423583984375
    171          ],
    172          'descriptor': {shape: [4, 6], dataType: 'float32'}
    173        }
    174      }
    175    }
    176  },
    177  {
    178    'name': 'mul float32 3D tensors',
    179    'graph': {
    180      'inputs': {
    181        'inputA': {
    182          'data': [
    183            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    184            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    185            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    186            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    187            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    188            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    189            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    190            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    191          ],
    192          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    193        },
    194        'inputB': {
    195          'data': [
    196            74.96137237548828,   -34.53953170776367,  -33.316162109375,
    197            53.92023849487305,   -83.69075012207031,  19.785221099853516,
    198            36.28113555908203,   -34.31147766113281,  49.10429000854492,
    199            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
    200            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
    201            87.6099853515625,    -8.881865501403809,  71.79511260986328,
    202            -26.158620834350586, -18.935443878173828, 34.6467170715332,
    203            -60.95826721191406,  -11.119653701782227, 77.50324249267578
    204          ],
    205          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    206        }
    207      },
    208      'operators': [{
    209        'name': 'mul',
    210        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    211        'outputs': 'output'
    212      }],
    213      'expectedOutputs': {
    214        'output': {
    215          'data': [
    216            3681.4443359375,    -411.278076171875,   703.4972534179688,
    217            3814.802978515625,  7910.138671875,      -1855.63720703125,
    218            405.582763671875,   1125.6197509765625,  4091.3193359375,
    219            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
    220            1264.6595458984375, -3041.78955078125,   2891.103759765625,
    221            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
    222            2197.89208984375,   1781.2109375,        2037.47900390625,
    223            3844.01513671875,   -36.79807662963867,  766.0423583984375
    224          ],
    225          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    226        }
    227      }
    228    }
    229  },
    230  {
    231    'name': 'mul float32 4D tensors',
    232    'graph': {
    233      'inputs': {
    234        'inputA': {
    235          'data': [
    236            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    237            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    238            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    239            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    240            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    241            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    242            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    243            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    244          ],
    245          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    246        },
    247        'inputB': {
    248          'data': [
    249            74.96137237548828,   -34.53953170776367,  -33.316162109375,
    250            53.92023849487305,   -83.69075012207031,  19.785221099853516,
    251            36.28113555908203,   -34.31147766113281,  49.10429000854492,
    252            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
    253            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
    254            87.6099853515625,    -8.881865501403809,  71.79511260986328,
    255            -26.158620834350586, -18.935443878173828, 34.6467170715332,
    256            -60.95826721191406,  -11.119653701782227, 77.50324249267578
    257          ],
    258          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    259        }
    260      },
    261      'operators': [{
    262        'name': 'mul',
    263        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    264        'outputs': 'output'
    265      }],
    266      'expectedOutputs': {
    267        'output': {
    268          'data': [
    269            3681.4443359375,    -411.278076171875,   703.4972534179688,
    270            3814.802978515625,  7910.138671875,      -1855.63720703125,
    271            405.582763671875,   1125.6197509765625,  4091.3193359375,
    272            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
    273            1264.6595458984375, -3041.78955078125,   2891.103759765625,
    274            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
    275            2197.89208984375,   1781.2109375,        2037.47900390625,
    276            3844.01513671875,   -36.79807662963867,  766.0423583984375
    277          ],
    278          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    279        }
    280      }
    281    }
    282  },
    283  {
    284    'name': 'mul float32 5D tensors',
    285    'graph': {
    286      'inputs': {
    287        'inputA': {
    288          'data': [
    289            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    290            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    291            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    292            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    293            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    294            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    295            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    296            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    297          ],
    298          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    299        },
    300        'inputB': {
    301          'data': [
    302            74.96137237548828,   -34.53953170776367,  -33.316162109375,
    303            53.92023849487305,   -83.69075012207031,  19.785221099853516,
    304            36.28113555908203,   -34.31147766113281,  49.10429000854492,
    305            -54.538848876953125, 70.77384948730469,   -55.18768310546875,
    306            -93.96234130859375,  60.08298110961914,   -92.7341537475586,
    307            87.6099853515625,    -8.881865501403809,  71.79511260986328,
    308            -26.158620834350586, -18.935443878173828, 34.6467170715332,
    309            -60.95826721191406,  -11.119653701782227, 77.50324249267578
    310          ],
    311          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    312        }
    313      },
    314      'operators': [{
    315        'name': 'mul',
    316        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    317        'outputs': 'output'
    318      }],
    319      'expectedOutputs': {
    320        'output': {
    321          'data': [
    322            3681.4443359375,    -411.278076171875,   703.4972534179688,
    323            3814.802978515625,  7910.138671875,      -1855.63720703125,
    324            405.582763671875,   1125.6197509765625,  4091.3193359375,
    325            -4969.61962890625,  -7.951977252960205,  -849.7775268554688,
    326            1264.6595458984375, -3041.78955078125,   2891.103759765625,
    327            -579.6376342773438, -192.98143005371094, 1581.7545166015625,
    328            2197.89208984375,   1781.2109375,        2037.47900390625,
    329            3844.01513671875,   -36.79807662963867,  766.0423583984375
    330          ],
    331          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    332        }
    333      }
    334    }
    335  },
    336  {
    337    'name': 'mul float32 broadcast 1D to 4D',
    338    'graph': {
    339      'inputs': {
    340        'inputA': {
    341          'data': [67.50372314453125],
    342          'descriptor': {shape: [1], dataType: 'float32'}
    343        },
    344        'inputB': {
    345          'data': [
    346            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    347            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    348            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    349            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    350            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    351            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    352            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    353            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    354          ],
    355          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    356        }
    357      },
    358      'operators': [{
    359        'name': 'mul',
    360        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    361        'outputs': 'output'
    362      }],
    363      'expectedOutputs': {
    364        'output': {
    365          'data': [
    366            3315.18994140625,   803.7978515625,      -1425.394775390625,
    367            4775.82080078125,   -6380.20068359375,   -6331.1103515625,
    368            754.6165771484375,  -2214.52197265625,   5624.34130859375,
    369            6150.98828125,      -7.5845537185668945, 1039.4193115234375,
    370            -908.5472412109375, -3417.4755859375,    -2104.513427734375,
    371            -446.6123352050781, 1466.6925048828125,  1487.208740234375,
    372            -5671.7783203125,   -6349.91064453125,   3969.7099609375,
    373            -4256.77001953125,  223.388916015625,    667.20703125
    374          ],
    375          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    376        }
    377      }
    378    }
    379  },
    380  {
    381    'name': 'mul float32 broadcast 2D to 4D',
    382    'graph': {
    383      'inputs': {
    384        'inputA': {
    385          'data': [
    386            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    387            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    388            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    389            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    390            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    391            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    392            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    393            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    394          ],
    395          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    396        },
    397        'inputB': {
    398          'data': [
    399            -97.29339599609375, -81.70872497558594, -63.859336853027344,
    400            -25.192203521728516, 94.61557006835938, -20.381790161132812
    401          ],
    402          'descriptor': {shape: [2, 3], dataType: 'float32'}
    403        }
    404      },
    405      'operators': [{
    406        'name': 'mul',
    407        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    408        'outputs': 'output'
    409      }],
    410      'expectedOutputs': {
    411        'output': {
    412          'data': [
    413            -4778.197265625,     -972.9432983398438,
    414            1348.440673828125,   -1782.3232421875,
    415            -8942.7119140625,    1911.5888671875,
    416            -1087.6319580078125, 2680.5302734375,
    417            -5320.69482421875,   -2295.531982421875,
    418            -10.630775451660156, -313.8379211425781,
    419            1309.492919921875,   4136.625,
    420            1990.89501953125,    166.67449951171875,
    421            2055.767333984375,   -449.04156494140625,
    422            8174.7578125,        7686.14013671875,
    423            -3755.3935546875,    1588.6148681640625,
    424            313.10968017578125,  -201.4536895751953
    425          ],
    426          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    427        }
    428      }
    429    }
    430  },
    431  {
    432    'name': 'mul float32 broadcast 3D to 4D',
    433    'graph': {
    434      'inputs': {
    435        'inputA': {
    436          'data': [
    437            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    438            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    439            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    440            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    441            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    442            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    443            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    444            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    445          ],
    446          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    447        },
    448        'inputB': {
    449          'data': [
    450            8.696772575378418, 48.377689361572266, 97.7515869140625,
    451            62.21574783325195
    452          ],
    453          'descriptor': {shape: [2, 2, 1], dataType: 'float32'}
    454        }
    455      },
    456      'operators': [{
    457        'name': 'mul',
    458        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    459        'outputs': 'output'
    460      }],
    461      'expectedOutputs': {
    462        'output': {
    463          'data': [
    464            427.1091003417969,   103.55646514892578, -183.63926696777344,
    465            3422.673095703125,   -4572.4794921875,   -4537.2978515625,
    466            1092.7540283203125,  -3206.8310546875,   8144.5625,
    467            5669.14404296875,    -6.990409851074219, 957.995361328125,
    468            -117.05175018310547, -440.2869567871094, -271.1328125,
    469            -320.07232666015625, 1051.130126953125,  1065.8333740234375,
    470            -8213.255859375,     -9195.2529296875,   5748.50439453125,
    471            -3923.3115234375,    205.88949584960938, 614.940673828125
    472          ],
    473          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    474        }
    475      }
    476    }
    477  },
    478  {
    479    'name': 'mul float32 broadcast 4D to 4D',
    480    'graph': {
    481      'inputs': {
    482        'inputA': {
    483          'data': [67.50372314453125],
    484          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}
    485        },
    486        'inputB': {
    487          'data': [
    488            49.1112174987793,    11.907459259033203,   -21.115795135498047,
    489            70.7490005493164,    -94.51628112792969,   -93.78905487060547,
    490            11.178888320922852,  -32.80592346191406,   83.31897735595703,
    491            91.1207275390625,    -0.11235756427049637, 15.397955894470215,
    492            -13.459217071533203, -50.6264762878418,    -31.17625617980957,
    493            -6.616114139556885,  21.72757911682129,    22.03150749206543,
    494            -84.02171325683594,  -94.06755828857422,   58.807273864746094,
    495            -63.059783935546875, 3.3092827796936035,   9.884003639221191
    496          ],
    497          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    498        }
    499      },
    500      'operators': [{
    501        'name': 'mul',
    502        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    503        'outputs': 'output'
    504      }],
    505      'expectedOutputs': {
    506        'output': {
    507          'data': [
    508            3315.18994140625,   803.7978515625,      -1425.394775390625,
    509            4775.82080078125,   -6380.20068359375,   -6331.1103515625,
    510            754.6165771484375,  -2214.52197265625,   5624.34130859375,
    511            6150.98828125,      -7.5845537185668945, 1039.4193115234375,
    512            -908.5472412109375, -3417.4755859375,    -2104.513427734375,
    513            -446.6123352050781, 1466.6925048828125,  1487.208740234375,
    514            -5671.7783203125,   -6349.91064453125,   3969.7099609375,
    515            -4256.77001953125,  223.388916015625,    667.20703125
    516          ],
    517          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    518        }
    519      }
    520    }
    521  },
    522 
    523  // float16 tests
    524  {
    525    'name': 'mul float16 1D constant tensors',
    526    'graph': {
    527      'inputs': {
    528        'inputA': {
    529          'data': [
    530            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    531            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    532            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    533            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    534            58.8125,           -63.0625,   3.30859375,  9.8828125
    535          ],
    536          'descriptor': {shape: [24], dataType: 'float16'},
    537          'constant': true
    538        },
    539        'inputB': {
    540          'data': [
    541            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    542            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    543            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    544            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    545          ],
    546          'descriptor': {shape: [24], dataType: 'float16'},
    547          'constant': true
    548        }
    549      },
    550      'operators': [{
    551        'name': 'mul',
    552        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    553        'outputs': 'output'
    554      }],
    555      'expectedOutputs': {
    556        'output': {
    557          'data': [
    558            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    559            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    560            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    561          ],
    562          'descriptor': {shape: [24], dataType: 'float16'}
    563        }
    564      }
    565    }
    566  },
    567  {
    568    'name': 'mul float16 1D tensors',
    569    'graph': {
    570      'inputs': {
    571        'inputA': {
    572          'data': [
    573            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    574            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    575            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    576            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    577            58.8125,           -63.0625,   3.30859375,  9.8828125
    578          ],
    579          'descriptor': {shape: [24], dataType: 'float16'}
    580        },
    581        'inputB': {
    582          'data': [
    583            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    584            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    585            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    586            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    587          ],
    588          'descriptor': {shape: [24], dataType: 'float16'}
    589        }
    590      },
    591      'operators': [{
    592        'name': 'mul',
    593        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    594        'outputs': 'output'
    595      }],
    596      'expectedOutputs': {
    597        'output': {
    598          'data': [
    599            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    600            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    601            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    602          ],
    603          'descriptor': {shape: [24], dataType: 'float16'}
    604        }
    605      }
    606    }
    607  },
    608  {
    609    'name': 'mul float16 2D tensors',
    610    'graph': {
    611      'inputs': {
    612        'inputA': {
    613          'data': [
    614            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    615            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    616            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    617            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    618            58.8125,           -63.0625,   3.30859375,  9.8828125
    619          ],
    620          'descriptor': {shape: [4, 6], dataType: 'float16'}
    621        },
    622        'inputB': {
    623          'data': [
    624            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    625            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    626            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    627            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    628          ],
    629          'descriptor': {shape: [4, 6], dataType: 'float16'}
    630        }
    631      },
    632      'operators': [{
    633        'name': 'mul',
    634        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    635        'outputs': 'output'
    636      }],
    637      'expectedOutputs': {
    638        'output': {
    639          'data': [
    640            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    641            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    642            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    643          ],
    644          'descriptor': {shape: [4, 6], dataType: 'float16'}
    645        }
    646      }
    647    }
    648  },
    649  {
    650    'name': 'mul float16 3D tensors',
    651    'graph': {
    652      'inputs': {
    653        'inputA': {
    654          'data': [
    655            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    656            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    657            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    658            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    659            58.8125,           -63.0625,   3.30859375,  9.8828125
    660          ],
    661          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    662        },
    663        'inputB': {
    664          'data': [
    665            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    666            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    667            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    668            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    669          ],
    670          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    671        }
    672      },
    673      'operators': [{
    674        'name': 'mul',
    675        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    676        'outputs': 'output'
    677      }],
    678      'expectedOutputs': {
    679        'output': {
    680          'data': [
    681            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    682            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    683            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    684          ],
    685          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    686        }
    687      }
    688    }
    689  },
    690  {
    691    'name': 'mul float16 4D tensors',
    692    'graph': {
    693      'inputs': {
    694        'inputA': {
    695          'data': [
    696            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    697            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    698            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    699            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    700            58.8125,           -63.0625,   3.30859375,  9.8828125
    701          ],
    702          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    703        },
    704        'inputB': {
    705          'data': [
    706            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    707            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    708            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    709            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    710          ],
    711          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    712        }
    713      },
    714      'operators': [{
    715        'name': 'mul',
    716        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    717        'outputs': 'output'
    718      }],
    719      'expectedOutputs': {
    720        'output': {
    721          'data': [
    722            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    723            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    724            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    725          ],
    726          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    727        }
    728      }
    729    }
    730  },
    731  {
    732    'name': 'mul float16 5D tensors',
    733    'graph': {
    734      'inputs': {
    735        'inputA': {
    736          'data': [
    737            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    738            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    739            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    740            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    741            58.8125,           -63.0625,   3.30859375,  9.8828125
    742          ],
    743          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    744        },
    745        'inputB': {
    746          'data': [
    747            74.9375,   -34.53125, -33.3125, 53.90625,  -83.6875,    19.78125,
    748            36.28125,  -34.3125,  49.09375, -54.53125, 70.75,       -55.1875,
    749            -93.9375,  60.09375,  -92.75,   87.625,    -8.8828125,  71.8125,
    750            -26.15625, -18.9375,  34.65625, -60.96875, -11.1171875, 77.5
    751          ],
    752          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    753        }
    754      },
    755      'operators': [{
    756        'name': 'mul',
    757        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    758        'outputs': 'output'
    759      }],
    760      'expectedOutputs': {
    761        'output': {
    762          'data': [
    763            3682, -411.25, 703,         3814, 7908, -1856, 405.5,     1126,
    764            4090, -4968,   -7.94921875, -850, 1264, -3042, 2892,      -580,
    765            -193, 1582,    2198,        1781, 2038, 3844,  -36.78125, 766
    766          ],
    767          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    768        }
    769      }
    770    }
    771  },
    772  {
    773    'name': 'mul float16 broadcast 1D to 4D',
    774    'graph': {
    775      'inputs': {
    776        'inputA':
    777            {'data': [67.5], 'descriptor': {shape: [1], dataType: 'float16'}},
    778        'inputB': {
    779          'data': [
    780            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    781            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    782            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    783            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    784            58.8125,           -63.0625,   3.30859375,  9.8828125
    785          ],
    786          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    787        }
    788      },
    789      'operators': [{
    790        'name': 'mul',
    791        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    792        'outputs': 'output'
    793      }],
    794      'expectedOutputs': {
    795        'output': {
    796          'data': [
    797            3316, 803.5, -1425,      4776,  -6380,  -6332, 754.5,   -2214,
    798            5624, 6152,  -7.5859375, 1039,  -908.5, -3418, -2104,   -446.75,
    799            1467, 1487,  -5672,      -6348, 3970,   -4256, 223.375, 667
    800          ],
    801          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    802        }
    803      }
    804    }
    805  },
    806  {
    807    'name': 'mul float16 broadcast 2D to 4D',
    808    'graph': {
    809      'inputs': {
    810        'inputA': {
    811          'data': [
    812            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    813            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    814            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    815            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    816            58.8125,           -63.0625,   3.30859375,  9.8828125
    817          ],
    818          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    819        },
    820        'inputB': {
    821          'data': [-97.3125, -81.6875, -63.84375, -25.1875, 94.625, -20.375],
    822          'descriptor': {shape: [2, 3], dataType: 'float16'}
    823        }
    824      },
    825      'operators': [{
    826        'name': 'mul',
    827        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    828        'outputs': 'output'
    829      }],
    830      'expectedOutputs': {
    831        'output': {
    832          'data': [
    833            -4780, -972.5, 1348,        -1782,   -8944, 1911, -1088, 2680,
    834            -5320, -2296,  -10.6328125, -313.75, 1310,  4136, 1990,  166.625,
    835            2056,  -449,   8176,        7684,    -3754, 1588, 313,   -201.375
    836          ],
    837          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    838        }
    839      }
    840    }
    841  },
    842  {
    843    'name': 'mul float16 broadcast 3D to 4D',
    844    'graph': {
    845      'inputs': {
    846        'inputA': {
    847          'data': [
    848            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    849            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    850            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    851            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    852            58.8125,           -63.0625,   3.30859375,  9.8828125
    853          ],
    854          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    855        },
    856        'inputB': {
    857          'data': [8.6953125, 48.375, 97.75, 62.21875],
    858          'descriptor': {shape: [2, 2, 1], dataType: 'float16'}
    859        }
    860      },
    861      'operators': [{
    862        'name': 'mul',
    863        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    864        'outputs': 'output'
    865      }],
    866      'expectedOutputs': {
    867        'output': {
    868          'data': [
    869            427.25,    103.5,   -183.5, 3422,  -4572,      -4540,
    870            1093,      -3208,   8144,   5668,  -6.9921875, 958,
    871            -117.0625, -440.25, -271,   -320,  1051,       1066,
    872            -8208,     -9192,   5748,   -3924, 205.875,    615
    873          ],
    874          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    875        }
    876      }
    877    }
    878  },
    879  {
    880    'name': 'mul float16 broadcast 4D to 4D',
    881    'graph': {
    882      'inputs': {
    883        'inputA': {
    884          'data': [67.5],
    885          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'}
    886        },
    887        'inputB': {
    888          'data': [
    889            49.125,            11.90625,   -21.109375,  70.75,    -94.5,
    890            -93.8125,          11.1796875, -32.8125,    83.3125,  91.125,
    891            -0.11236572265625, 15.3984375, -13.4609375, -50.625,  -31.171875,
    892            -6.6171875,        21.734375,  22.03125,    -84,      -94.0625,
    893            58.8125,           -63.0625,   3.30859375,  9.8828125
    894          ],
    895          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    896        }
    897      },
    898      'operators': [{
    899        'name': 'mul',
    900        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    901        'outputs': 'output'
    902      }],
    903      'expectedOutputs': {
    904        'output': {
    905          'data': [
    906            3316, 803.5, -1425,      4776,  -6380,  -6332, 754.5,   -2214,
    907            5624, 6152,  -7.5859375, 1039,  -908.5, -3418, -2104,   -446.75,
    908            1467, 1487,  -5672,      -6348, 3970,   -4256, 223.375, 667
    909          ],
    910          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    911        }
    912      }
    913    }
    914  }
    915 ];
    916 
    917 webnn_conformance_test(mulTests, buildAndExecuteGraph, getPrecisionTolerance);