tor-browser

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

pow.https.any.js (38701B)


      1 // META: title=test WebNN API element-wise pow 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 power of the two input tensors.
     13 // MLOperand pow(MLOperand a, MLOperand b);
     14 
     15 
     16 const getPowPrecisionTolerance = (graphResources) => {
     17  const toleranceValueDict = {float32: 32, float16: 2};
     18  const expectedDataType =
     19      getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs);
     20  return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]};
     21 };
     22 
     23 const powTests = [
     24  {
     25    'name':
     26        'pow float32 constant 1D base tensor and 1D integer exponent tensor',
     27    'graph': {
     28      'inputs': {
     29        'inputA': {
     30          'data': [
     31            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
     32            11.17772102355957,   -17.346275329589844, 11.862250328063965,
     33            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
     34            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
     35            -15.678689002990723, 10.283306121826172,  14.893174171447754,
     36            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
     37            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
     38            -5.757015705108643,  17.41126823425293,   17.41521453857422
     39          ],
     40          'descriptor': {shape: [24], dataType: 'float32'},
     41          'constant': true
     42        },
     43        'inputB': {
     44          'data': [
     45            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
     46            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
     47          ],
     48          'descriptor': {shape: [24], dataType: 'float32'},
     49          'constant': true
     50        }
     51      },
     52      'operators': [{
     53        'name': 'pow',
     54        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
     55        'outputs': 'output'
     56      }],
     57      'expectedOutputs': {
     58        'output': {
     59          'data': [
     60            17.846010208129883,      6.316321332633379e-8,
     61            -1.0973203501407625e-7,  21800822,
     62            0.0033234376460313797,   11.862250328063965,
     63            80273.3359375,           0.00005692423656000756,
     64            0.12908191978931427,     -0.0000020299064544815337,
     65            0.005799346603453159,    3880.540283203125,
     66            2.7385585465999895e-10,  8.223764069725803e-8,
     67            0.06714485585689545,     -0.008288968354463577,
     68            -4.1750155416186985e-11, 1210.5478515625,
     69            3.8231124932508465e-8,   -1667.201416015625,
     70            -0.16149713099002838,    -0.00015812950732652098,
     71            485079424,               3.584487018315485e-8
     72          ],
     73          'descriptor': {shape: [24], dataType: 'float32'}
     74        }
     75      }
     76    }
     77  },
     78  {
     79    'name': 'pow float32 1D base tensor and 1D integer exponent tensor',
     80    'graph': {
     81      'inputs': {
     82        'inputA': {
     83          'data': [
     84            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
     85            11.17772102355957,   -17.346275329589844, 11.862250328063965,
     86            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
     87            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
     88            -15.678689002990723, 10.283306121826172,  14.893174171447754,
     89            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
     90            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
     91            -5.757015705108643,  17.41126823425293,   17.41521453857422
     92          ],
     93          'descriptor': {shape: [24], dataType: 'float32'}
     94        },
     95        'inputB': {
     96          'data': [
     97            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
     98            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
     99          ],
    100          'descriptor': {shape: [24], dataType: 'float32'}
    101        }
    102      },
    103      'operators': [{
    104        'name': 'pow',
    105        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    106        'outputs': 'output'
    107      }],
    108      'expectedOutputs': {
    109        'output': {
    110          'data': [
    111            17.846010208129883,      6.316321332633379e-8,
    112            -1.0973203501407625e-7,  21800822,
    113            0.0033234376460313797,   11.862250328063965,
    114            80273.3359375,           0.00005692423656000756,
    115            0.12908191978931427,     -0.0000020299064544815337,
    116            0.005799346603453159,    3880.540283203125,
    117            2.7385585465999895e-10,  8.223764069725803e-8,
    118            0.06714485585689545,     -0.008288968354463577,
    119            -4.1750155416186985e-11, 1210.5478515625,
    120            3.8231124932508465e-8,   -1667.201416015625,
    121            -0.16149713099002838,    -0.00015812950732652098,
    122            485079424,               3.584487018315485e-8
    123          ],
    124          'descriptor': {shape: [24], dataType: 'float32'}
    125        }
    126      }
    127    }
    128  },
    129  {
    130    'name': 'pow float32 2D base tensor and 2D integer exponent tensor',
    131    'graph': {
    132      'inputs': {
    133        'inputA': {
    134          'data': [
    135            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    136            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    137            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    138            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    139            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    140            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    141            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    142            -5.757015705108643,  17.41126823425293,   17.41521453857422
    143          ],
    144          'descriptor': {shape: [4, 6], dataType: 'float32'}
    145        },
    146        'inputB': {
    147          'data': [
    148            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
    149            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
    150          ],
    151          'descriptor': {shape: [4, 6], dataType: 'float32'}
    152        }
    153      },
    154      'operators': [{
    155        'name': 'pow',
    156        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    157        'outputs': 'output'
    158      }],
    159      'expectedOutputs': {
    160        'output': {
    161          'data': [
    162            17.846010208129883,      6.316321332633379e-8,
    163            -1.0973203501407625e-7,  21800822,
    164            0.0033234376460313797,   11.862250328063965,
    165            80273.3359375,           0.00005692423656000756,
    166            0.12908191978931427,     -0.0000020299064544815337,
    167            0.005799346603453159,    3880.540283203125,
    168            2.7385585465999895e-10,  8.223764069725803e-8,
    169            0.06714485585689545,     -0.008288968354463577,
    170            -4.1750155416186985e-11, 1210.5478515625,
    171            3.8231124932508465e-8,   -1667.201416015625,
    172            -0.16149713099002838,    -0.00015812950732652098,
    173            485079424,               3.584487018315485e-8
    174          ],
    175          'descriptor': {shape: [4, 6], dataType: 'float32'}
    176        }
    177      }
    178    }
    179  },
    180  {
    181    'name': 'pow float32 3D base tensor and 3D integer exponent tensor',
    182    'graph': {
    183      'inputs': {
    184        'inputA': {
    185          'data': [
    186            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    187            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    188            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    189            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    190            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    191            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    192            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    193            -5.757015705108643,  17.41126823425293,   17.41521453857422
    194          ],
    195          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    196        },
    197        'inputB': {
    198          'data': [
    199            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
    200            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
    201          ],
    202          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    203        }
    204      },
    205      'operators': [{
    206        'name': 'pow',
    207        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    208        'outputs': 'output'
    209      }],
    210      'expectedOutputs': {
    211        'output': {
    212          'data': [
    213            17.846010208129883,      6.316321332633379e-8,
    214            -1.0973203501407625e-7,  21800822,
    215            0.0033234376460313797,   11.862250328063965,
    216            80273.3359375,           0.00005692423656000756,
    217            0.12908191978931427,     -0.0000020299064544815337,
    218            0.005799346603453159,    3880.540283203125,
    219            2.7385585465999895e-10,  8.223764069725803e-8,
    220            0.06714485585689545,     -0.008288968354463577,
    221            -4.1750155416186985e-11, 1210.5478515625,
    222            3.8231124932508465e-8,   -1667.201416015625,
    223            -0.16149713099002838,    -0.00015812950732652098,
    224            485079424,               3.584487018315485e-8
    225          ],
    226          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    227        }
    228      }
    229    }
    230  },
    231  {
    232    'name': 'pow float32 4D base tensor and 4D integer exponent tensor',
    233    'graph': {
    234      'inputs': {
    235        'inputA': {
    236          'data': [
    237            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    238            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    239            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    240            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    241            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    242            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    243            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    244            -5.757015705108643,  17.41126823425293,   17.41521453857422
    245          ],
    246          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    247        },
    248        'inputB': {
    249          'data': [
    250            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
    251            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
    252          ],
    253          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    254        }
    255      },
    256      'operators': [{
    257        'name': 'pow',
    258        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    259        'outputs': 'output'
    260      }],
    261      'expectedOutputs': {
    262        'output': {
    263          'data': [
    264            17.846010208129883,      6.316321332633379e-8,
    265            -1.0973203501407625e-7,  21800822,
    266            0.0033234376460313797,   11.862250328063965,
    267            80273.3359375,           0.00005692423656000756,
    268            0.12908191978931427,     -0.0000020299064544815337,
    269            0.005799346603453159,    3880.540283203125,
    270            2.7385585465999895e-10,  8.223764069725803e-8,
    271            0.06714485585689545,     -0.008288968354463577,
    272            -4.1750155416186985e-11, 1210.5478515625,
    273            3.8231124932508465e-8,   -1667.201416015625,
    274            -0.16149713099002838,    -0.00015812950732652098,
    275            485079424,               3.584487018315485e-8
    276          ],
    277          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    278        }
    279      }
    280    }
    281  },
    282  {
    283    'name': 'pow float32 5D base tensor and 5D integer exponent tensor',
    284    'graph': {
    285      'inputs': {
    286        'inputA': {
    287          'data': [
    288            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    289            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    290            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    291            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    292            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    293            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    294            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    295            -5.757015705108643,  17.41126823425293,   17.41521453857422
    296          ],
    297          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    298        },
    299        'inputB': {
    300          'data': [
    301            1,  6,  -7, 7,  -2, 1, 4,  -10, -2, -5, -2, -10,
    302            -8, -7, -1, -3, -9, 6, -6, 7,   -5, -5, 7,  -6
    303          ],
    304          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    305        }
    306      },
    307      'operators': [{
    308        'name': 'pow',
    309        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    310        'outputs': 'output'
    311      }],
    312      'expectedOutputs': {
    313        'output': {
    314          'data': [
    315            17.846010208129883,      6.316321332633379e-8,
    316            -1.0973203501407625e-7,  21800822,
    317            0.0033234376460313797,   11.862250328063965,
    318            80273.3359375,           0.00005692423656000756,
    319            0.12908191978931427,     -0.0000020299064544815337,
    320            0.005799346603453159,    3880.540283203125,
    321            2.7385585465999895e-10,  8.223764069725803e-8,
    322            0.06714485585689545,     -0.008288968354463577,
    323            -4.1750155416186985e-11, 1210.5478515625,
    324            3.8231124932508465e-8,   -1667.201416015625,
    325            -0.16149713099002838,    -0.00015812950732652098,
    326            485079424,               3.584487018315485e-8
    327          ],
    328          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    329        }
    330      }
    331    }
    332  },
    333  {
    334    'name':
    335        'pow (square) float32 4D base tensor and broadcastable 0D integer exponent scalar',
    336    'graph': {
    337      'inputs': {
    338        'inputA': {
    339          'data': [
    340            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    341            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    342            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    343            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    344            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    345            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    346            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    347            -5.757015705108643,  17.41126823425293,   17.41521453857422
    348          ],
    349          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'},
    350          'constant': true
    351        },
    352        'inputB': {'data': [2], 'descriptor': {shape: [], dataType: 'float32'}}
    353      },
    354      'operators': [{
    355        'name': 'pow',
    356        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    357        'outputs': 'output'
    358      }],
    359      'expectedOutputs': {
    360        'output': {
    361          'data': [
    362            318.4800720214844,  0.00398249039426446, 97.38143157958984,
    363            124.94144439697266, 300.8932800292969,   140.71298217773438,
    364            283.32550048828125, 7.062208652496338,   7.747018814086914,
    365            189.23854064941406, 172.43321228027344,  0.19152326881885529,
    366            245.8212890625,     105.74638366699219,  221.806640625,
    367            24.41554069519043,  202.5444793701172,   10.657630920410156,
    368            296.84356689453125, 8.328523635864258,   2.073643445968628,
    369            33.14323043823242,  303.1522521972656,   303.2897033691406
    370          ],
    371          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    372        }
    373      }
    374    }
    375  },
    376  {
    377    'name':
    378        'pow (sqrt) float32 4D positive base tensor and broadcastable 0D integer exponent scalar',
    379    'graph': {
    380      'inputs': {
    381        'inputA': {
    382          'data': [
    383            1.418652057647705,  19.384845733642578,  12.983916282653809,
    384            2.4603159427642822, 7.818154811859131,   6.94444465637207,
    385            12.183951377868652, 17.912473678588867,  11.356568336486816,
    386            8.924248695373535,  17.636823654174805,  11.49622917175293,
    387            18.516279220581055, 2.2580490112304688,  2.231948137283325,
    388            13.629855155944824, 17.54841423034668,   0.5390734076499939,
    389            5.891367435455322,  0.12803149223327637, 19.654495239257812,
    390            3.4122724533081055, 4.945034980773926,   4.437101364135742
    391          ],
    392          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'},
    393          'constant': true
    394        },
    395        'inputB':
    396            {'data': [0.5], 'descriptor': {shape: [], dataType: 'float32'}}
    397      },
    398      'operators': [{
    399        'name': 'pow',
    400        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    401        'outputs': 'output'
    402      }],
    403      'expectedOutputs': {
    404        'output': {
    405          'data': [
    406            1.19107186794281,   4.402822494506836,   3.6033201217651367,
    407            1.5685393810272217, 2.7960963249206543,  2.6352314949035645,
    408            3.490551710128784,  4.23231315612793,    3.369950771331787,
    409            2.9873480796813965, 4.199621677398682,   3.3906090259552,
    410            4.3030548095703125, 1.5026806592941284,  1.4939706325531006,
    411            3.6918632984161377, 4.189082622528076,   0.7342162132263184,
    412            2.4272139072418213, 0.35781487822532654, 4.4333391189575195,
    413            1.847233772277832,  2.223743438720703,   2.106442928314209
    414          ],
    415          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    416        }
    417      }
    418    }
    419  },
    420  {
    421    'name':
    422        'pow float32 4D base tensor and broadcastable 2D integer exponent tensor',
    423    'graph': {
    424      'inputs': {
    425        'inputA': {
    426          'data': [
    427            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    428            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    429            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    430            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    431            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    432            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    433            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    434            -5.757015705108643,  17.41126823425293,   17.41521453857422
    435          ],
    436          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    437        },
    438        'inputB': {
    439          'data': [5, -10, -10, 7, -7, -9],
    440          'descriptor': {shape: [2, 3], dataType: 'float32'}
    441        }
    442      },
    443      'operators': [{
    444        'name': 'pow',
    445        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    446        'outputs': 'output'
    447      }],
    448      'expectedOutputs': {
    449        'output': {
    450          'data': [
    451            1810113,        998220038144,           1.1418765932802444e-10,
    452            21800822,       -2.11619832768406e-9,   2.1502860603206386e-10,
    453            -1351182.875,   0.00005692423656000756, 0.000035836616007145494,
    454            -93225256,      1.4853429597394552e-8,  -1698.2552490234375,
    455            -947433.5,      7.562621362477984e-11,  1.8626330946375225e-12,
    456            -71917.1015625, -8.45626324519344e-9,   0.00002374253199377563,
    457            1518165.5,      0.00002495513399480842, 0.026081321761012077,
    458            -209595.46875,  2.0615180673644318e-9,  6.786416914539295e-12
    459          ],
    460          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    461        }
    462      }
    463    }
    464  },
    465  {
    466    'name':
    467        'pow float32 4D base tensor and broadcastable 3D integer exponent tensor',
    468    'graph': {
    469      'inputs': {
    470        'inputA': {
    471          'data': [
    472            17.846010208129883,  -0.0631069764494896, -9.868203163146973,
    473            11.17772102355957,   -17.346275329589844, 11.862250328063965,
    474            -16.832275390625,    2.6574816703796387,  -2.783346652984619,
    475            -13.756400108337402, 13.131382942199707,  -0.4376337230205536,
    476            -15.678689002990723, 10.283306121826172,  14.893174171447754,
    477            -4.941208362579346,  -14.231812477111816, 3.2646026611328125,
    478            17.229148864746094,  -2.885918140411377,  -1.4400150775909424,
    479            -5.757015705108643,  17.41126823425293,   17.41521453857422
    480          ],
    481          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    482        },
    483        'inputB': {
    484          'data': [-5, -10, 9, -6],
    485          'descriptor': {shape: [2, 2, 1], dataType: 'float32'}
    486        }
    487      },
    488      'operators': [{
    489        'name': 'pow',
    490        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    491        'outputs': 'output'
    492      }],
    493      'expectedOutputs': {
    494        'output': {
    495          'data': [
    496            5.524516950572433e-7,      -999109.625,
    497            -0.000010685862434911542,  3.284485530774539e-11,
    498            4.0545030440680696e-13,    1.81271334748212e-11,
    499            -108463955968,             6610.47265625,
    500            -10025.4921875,            1.4756086841316574e-7,
    501            1.9504606996179064e-7,     142.34274291992188,
    502            -0.0000010554830396358739, 0.000008696333679836243,
    503            0.0000013647832020069472,  1.1525726506533829e-7,
    504            2.9335795945217846e-12,    0.000007272717084561009,
    505            133774827520,              -13885.326171875,
    506            -26.625843048095703,       0.000027467271138448268,
    507            3.5893645389251105e-8,     3.584487018315485e-8
    508          ],
    509          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    510        }
    511      }
    512    }
    513  },
    514 
    515  // float16 tests
    516  {
    517    'name':
    518        'pow float16 constant 1D base tensor and 1D integer exponent tensor',
    519    'graph': {
    520      'inputs': {
    521        'inputA': {
    522          'data': [
    523            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    524            -17.34375,     11.859375,        -16.828125, 2.658203125,
    525            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    526            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    527            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    528            -1.4404296875, -5.7578125,       17.40625,   17.421875
    529          ],
    530          'descriptor': {shape: [24], dataType: 'float16'},
    531          'constant': true
    532        },
    533        'inputB': {
    534          'data': [
    535            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    536            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    537          ],
    538          'descriptor': {shape: [24], dataType: 'float16'},
    539          'constant': true
    540        }
    541      },
    542      'operators': [{
    543        'name': 'pow',
    544        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    545        'outputs': 'output'
    546      }],
    547      'expectedOutputs': {
    548        'output': {
    549          'data': [
    550            17.84375,               -0.0002512931823730469,
    551            -1.1920928955078125e-7, 125,
    552            0.0033245086669921875,  11.859375,
    553            283.25,                 0.000056743621826171875,
    554            0.129150390625,         -0.0000020265579223632812,
    555            0.00579833984375,       3870,
    556            0,                      5.960464477539063e-8,
    557            0.067138671875,         -0.0082855224609375,
    558            0,                      10.6484375,
    559            5.960464477539063e-8,   -24.0625,
    560            -0.1612548828125,       -0.00015807151794433594,
    561            303,                    5.960464477539063e-8
    562          ],
    563          'descriptor': {shape: [24], dataType: 'float16'}
    564        }
    565      }
    566    }
    567  },
    568  {
    569    'name': 'pow float16 1D base tensor and 1D integer exponent tensor',
    570    'graph': {
    571      'inputs': {
    572        'inputA': {
    573          'data': [
    574            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    575            -17.34375,     11.859375,        -16.828125, 2.658203125,
    576            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    577            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    578            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    579            -1.4404296875, -5.7578125,       17.40625,   17.421875
    580          ],
    581          'descriptor': {shape: [24], dataType: 'float16'}
    582        },
    583        'inputB': {
    584          'data': [
    585            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    586            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    587          ],
    588          'descriptor': {shape: [24], dataType: 'float16'}
    589        }
    590      },
    591      'operators': [{
    592        'name': 'pow',
    593        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    594        'outputs': 'output'
    595      }],
    596      'expectedOutputs': {
    597        'output': {
    598          'data': [
    599            17.84375,               -0.0002512931823730469,
    600            -1.1920928955078125e-7, 125,
    601            0.0033245086669921875,  11.859375,
    602            283.25,                 0.000056743621826171875,
    603            0.129150390625,         -0.0000020265579223632812,
    604            0.00579833984375,       3870,
    605            0,                      5.960464477539063e-8,
    606            0.067138671875,         -0.0082855224609375,
    607            0,                      10.6484375,
    608            5.960464477539063e-8,   -24.0625,
    609            -0.1612548828125,       -0.00015807151794433594,
    610            303,                    5.960464477539063e-8
    611          ],
    612          'descriptor': {shape: [24], dataType: 'float16'}
    613        }
    614      }
    615    }
    616  },
    617  {
    618    'name': 'pow float16 2D base tensor and 2D integer exponent tensor',
    619    'graph': {
    620      'inputs': {
    621        'inputA': {
    622          'data': [
    623            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    624            -17.34375,     11.859375,        -16.828125, 2.658203125,
    625            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    626            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    627            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    628            -1.4404296875, -5.7578125,       17.40625,   17.421875
    629          ],
    630          'descriptor': {shape: [4, 6], dataType: 'float16'}
    631        },
    632        'inputB': {
    633          'data': [
    634            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    635            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    636          ],
    637          'descriptor': {shape: [4, 6], dataType: 'float16'}
    638        }
    639      },
    640      'operators': [{
    641        'name': 'pow',
    642        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    643        'outputs': 'output'
    644      }],
    645      'expectedOutputs': {
    646        'output': {
    647          'data': [
    648            17.84375,               -0.0002512931823730469,
    649            -1.1920928955078125e-7, 125,
    650            0.0033245086669921875,  11.859375,
    651            283.25,                 0.000056743621826171875,
    652            0.129150390625,         -0.0000020265579223632812,
    653            0.00579833984375,       3870,
    654            0,                      5.960464477539063e-8,
    655            0.067138671875,         -0.0082855224609375,
    656            0,                      10.6484375,
    657            5.960464477539063e-8,   -24.0625,
    658            -0.1612548828125,       -0.00015807151794433594,
    659            303,                    5.960464477539063e-8
    660          ],
    661          'descriptor': {shape: [4, 6], dataType: 'float16'}
    662        }
    663      }
    664    }
    665  },
    666  {
    667    'name': 'pow float16 3D base tensor and 3D integer exponent tensor',
    668    'graph': {
    669      'inputs': {
    670        'inputA': {
    671          'data': [
    672            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    673            -17.34375,     11.859375,        -16.828125, 2.658203125,
    674            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    675            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    676            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    677            -1.4404296875, -5.7578125,       17.40625,   17.421875
    678          ],
    679          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    680        },
    681        'inputB': {
    682          'data': [
    683            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    684            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    685          ],
    686          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    687        }
    688      },
    689      'operators': [{
    690        'name': 'pow',
    691        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    692        'outputs': 'output'
    693      }],
    694      'expectedOutputs': {
    695        'output': {
    696          'data': [
    697            17.84375,               -0.0002512931823730469,
    698            -1.1920928955078125e-7, 125,
    699            0.0033245086669921875,  11.859375,
    700            283.25,                 0.000056743621826171875,
    701            0.129150390625,         -0.0000020265579223632812,
    702            0.00579833984375,       3870,
    703            0,                      5.960464477539063e-8,
    704            0.067138671875,         -0.0082855224609375,
    705            0,                      10.6484375,
    706            5.960464477539063e-8,   -24.0625,
    707            -0.1612548828125,       -0.00015807151794433594,
    708            303,                    5.960464477539063e-8
    709          ],
    710          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    711        }
    712      }
    713    }
    714  },
    715  {
    716    'name': 'pow float16 4D base tensor and 4D integer exponent tensor',
    717    'graph': {
    718      'inputs': {
    719        'inputA': {
    720          'data': [
    721            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    722            -17.34375,     11.859375,        -16.828125, 2.658203125,
    723            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    724            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    725            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    726            -1.4404296875, -5.7578125,       17.40625,   17.421875
    727          ],
    728          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    729        },
    730        'inputB': {
    731          'data': [
    732            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    733            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    734          ],
    735          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    736        }
    737      },
    738      'operators': [{
    739        'name': 'pow',
    740        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    741        'outputs': 'output'
    742      }],
    743      'expectedOutputs': {
    744        'output': {
    745          'data': [
    746            17.84375,               -0.0002512931823730469,
    747            -1.1920928955078125e-7, 125,
    748            0.0033245086669921875,  11.859375,
    749            283.25,                 0.000056743621826171875,
    750            0.129150390625,         -0.0000020265579223632812,
    751            0.00579833984375,       3870,
    752            0,                      5.960464477539063e-8,
    753            0.067138671875,         -0.0082855224609375,
    754            0,                      10.6484375,
    755            5.960464477539063e-8,   -24.0625,
    756            -0.1612548828125,       -0.00015807151794433594,
    757            303,                    5.960464477539063e-8
    758          ],
    759          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    760        }
    761      }
    762    }
    763  },
    764  {
    765    'name': 'pow float16 5D base tensor and 5D integer exponent tensor',
    766    'graph': {
    767      'inputs': {
    768        'inputA': {
    769          'data': [
    770            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    771            -17.34375,     11.859375,        -16.828125, 2.658203125,
    772            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    773            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    774            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    775            -1.4404296875, -5.7578125,       17.40625,   17.421875
    776          ],
    777          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    778        },
    779        'inputB': {
    780          'data': [
    781            1,  3,  -7, 2,  -2, 1, 2,  -10, -2, -5, -2, -10,
    782            -8, -7, -1, -3, -9, 2, -6, 3,   -5, -5, 2,  -6
    783          ],
    784          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    785        }
    786      },
    787      'operators': [{
    788        'name': 'pow',
    789        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    790        'outputs': 'output'
    791      }],
    792      'expectedOutputs': {
    793        'output': {
    794          'data': [
    795            17.84375,               -0.0002512931823730469,
    796            -1.1920928955078125e-7, 125,
    797            0.0033245086669921875,  11.859375,
    798            283.25,                 0.000056743621826171875,
    799            0.129150390625,         -0.0000020265579223632812,
    800            0.00579833984375,       3870,
    801            0,                      5.960464477539063e-8,
    802            0.067138671875,         -0.0082855224609375,
    803            0,                      10.6484375,
    804            5.960464477539063e-8,   -24.0625,
    805            -0.1612548828125,       -0.00015807151794433594,
    806            303,                    5.960464477539063e-8
    807          ],
    808          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    809        }
    810      }
    811    }
    812  },
    813  {
    814    'name':
    815        'pow (square) float16 4D base tensor and broadcastable 0D integer exponent scalar',
    816    'graph': {
    817      'inputs': {
    818        'inputA': {
    819          'data': [
    820            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    821            -17.34375,     11.859375,        -16.828125, 2.658203125,
    822            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    823            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    824            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    825            -1.4404296875, -5.7578125,       17.40625,   17.421875
    826          ],
    827          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'},
    828          'constant': true
    829        },
    830        'inputB': {'data': [2], 'descriptor': {shape: [], dataType: 'float16'}}
    831      },
    832      'operators': [{
    833        'name': 'pow',
    834        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    835        'outputs': 'output'
    836      }],
    837      'expectedOutputs': {
    838        'output': {
    839          'data': [
    840            318.5,      0.0039825439453125,
    841            97.375,     125,
    842            300.75,     140.625,
    843            283.25,     7.06640625,
    844            7.74609375, 189.25,
    845            172.5,      0.191650390625,
    846            245.875,    105.6875,
    847            221.75,     24.421875,
    848            202.625,    10.6484375,
    849            297,        8.3359375,
    850            2.07421875, 33.15625,
    851            303,        303.5
    852          ],
    853          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    854        }
    855      }
    856    }
    857  },
    858  {
    859    'name':
    860        'pow (sqrt) float16 4D positive base tensor and broadcastable 0D integer exponent scalar',
    861    'graph': {
    862      'inputs': {
    863        'inputA': {
    864          'data': [
    865            1.4189453125, 19.390625,   12.984375, 2.4609375, 7.81640625,
    866            6.9453125,    12.1875,     17.90625,  11.359375, 8.921875,
    867            17.640625,    11.5,        18.515625, 2.2578125, 2.232421875,
    868            13.6328125,   17.546875,   0.5390625, 5.890625,  0.1280517578125,
    869            19.65625,     3.412109375, 4.9453125, 4.4375
    870          ],
    871          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'},
    872          'constant': true
    873        },
    874        'inputB':
    875            {'data': [0.5], 'descriptor': {shape: [], dataType: 'float16'}}
    876      },
    877      'operators': [{
    878        'name': 'pow',
    879        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    880        'outputs': 'output'
    881      }],
    882      'expectedOutputs': {
    883        'output': {
    884          'data': [
    885            1.19140625,  4.40234375,  3.603515625, 1.568359375,  2.794921875,
    886            2.634765625, 3.490234375, 4.23046875,  3.37109375,   2.986328125,
    887            4.19921875,  3.390625,    4.3046875,   1.5029296875, 1.494140625,
    888            3.69140625,  4.1875,      0.734375,    2.427734375,  0.35791015625,
    889            4.43359375,  1.84765625,  2.224609375, 2.107421875
    890          ],
    891          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    892        }
    893      }
    894    }
    895  },
    896  {
    897    'name':
    898        'pow float16 4D base tensor and broadcastable 2D integer exponent tensor',
    899    'graph': {
    900      'inputs': {
    901        'inputA': {
    902          'data': [
    903            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    904            -17.34375,     11.859375,        -16.828125, 2.658203125,
    905            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    906            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    907            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    908            -1.4404296875, -5.7578125,       17.40625,   17.421875
    909          ],
    910          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    911        },
    912        'inputB': {
    913          'data': [3, -2, -1, 2, -7, -5],
    914          'descriptor': {shape: [2, 3], dataType: 'float16'}
    915        }
    916      },
    917      'operators': [{
    918        'name': 'pow',
    919        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    920        'outputs': 'output'
    921      }],
    922      'expectedOutputs': {
    923        'output': {
    924          'data': [
    925            5680,      251.125,          -0.101318359375,
    926            125,       0,                0.000004291534423828125,
    927            -4764,     0.1414794921875,  -0.359375,
    928            189.25,    0,                -62.21875,
    929            -3854,     0.00946044921875, 0.067138671875,
    930            24.421875, 0,                0.0027008056640625,
    931            5120,      0.1199951171875,  -0.6943359375,
    932            33.15625,  0,                5.960464477539062e-7
    933          ],
    934          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    935        }
    936      }
    937    }
    938  },
    939  {
    940    'name':
    941        'pow float16 4D base tensor and broadcastable 3D integer exponent tensor',
    942    'graph': {
    943      'inputs': {
    944        'inputA': {
    945          'data': [
    946            17.84375,      -0.0631103515625, -9.8671875, 11.1796875,
    947            -17.34375,     11.859375,        -16.828125, 2.658203125,
    948            -2.783203125,  -13.7578125,      13.1328125, -0.437744140625,
    949            -15.6796875,   10.28125,         14.890625,  -4.94140625,
    950            -14.234375,    3.263671875,      17.234375,  -2.88671875,
    951            -1.4404296875, -5.7578125,       17.40625,   17.421875
    952          ],
    953          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    954        },
    955        'inputB': {
    956          'data': [-1, 1, 3, -2],
    957          'descriptor': {shape: [2, 2, 1], dataType: 'float16'}
    958        }
    959      },
    960      'operators': [{
    961        'name': 'pow',
    962        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    963        'outputs': 'output'
    964      }],
    965      'expectedOutputs': {
    966        'output': {
    967          'data': [
    968            0.0560302734375,      -15.84375,            -0.101318359375,
    969            11.1796875,           -17.34375,            11.859375,
    970            -4764,                18.78125,             -21.5625,
    971            0.005283355712890625, 0.00579833984375,     5.21875,
    972            -0.06378173828125,    0.0972900390625,      0.067138671875,
    973            -4.94140625,          -14.234375,           3.263671875,
    974            5120,                 -24.0625,             -2.98828125,
    975            0.0301666259765625,   0.003299713134765625, 0.0032939910888671875
    976          ],
    977          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    978        }
    979      }
    980    }
    981  }
    982 ];
    983 
    984 webnn_conformance_test(
    985    powTests, buildAndExecuteGraph, getPowPrecisionTolerance);