tor-browser

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

div.https.any.js (40118B)


      1 // META: title=test WebNN API element-wise div 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 division of the two input tensors.
     13 // MLOperand div(MLOperand a, MLOperand b);
     14 
     15 
     16 const getDivPrecisionTolerance = (graphResources) => {
     17  const toleranceValueDict = {float32: 2, float16: 2};
     18  const expectedDataType =
     19      getExpectedDataTypeOfSingleOutput(graphResources.expectedOutputs);
     20  return {metricType: 'ULP', value: toleranceValueDict[expectedDataType]};
     21 };
     22 
     23 const divTests = [
     24  {
     25    'name': 'div float32 1D constant tensors',
     26    'graph': {
     27      'inputs': {
     28        'inputA': {
     29          'data': [
     30            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
     31            -15.150615692138672, 13.455190658569336,  45.433597564697266,
     32            61.082862854003906,  70.71882629394531,   -31.278579711914062,
     33            56.08354187011719,   38.992767333984375,  -3.27536940574646,
     34            32.28932189941406,   -3.676541805267334,  88.4349136352539,
     35            14.369060516357422,  13.943194389343262,  16.861190795898438,
     36            4.816806316375732,   44.15916442871094,   -13.083211898803711,
     37            44.56599807739258,   -34.892784118652344, -74.09375
     38          ],
     39          'descriptor': {shape: [24], dataType: 'float32'},
     40          'constant': true
     41        },
     42        'inputB': {
     43          'data': [
     44            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
     45            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
     46            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
     47            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
     48            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
     49            74.99787139892578,   25.865373611450195,  91.5443344116211,
     50            81.65287017822266,   48.2148323059082,    63.370121002197266,
     51            10.626384735107422,  46.126625061035156,  77.22327423095703
     52          ],
     53          'descriptor': {shape: [24], dataType: 'float32'},
     54          'constant': true
     55        }
     56      },
     57      'operators': [{
     58        'name': 'div',
     59        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
     60        'outputs': 'output'
     61      }],
     62      'expectedOutputs': {
     63        'output': {
     64          'data': [
     65            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
     66            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
     67            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
     68            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
     69            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
     70            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
     71            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
     72            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
     73          ],
     74          'descriptor': {shape: [24], dataType: 'float32'}
     75        }
     76      }
     77    }
     78  },
     79  {
     80    'name': 'div float32 1D tensors',
     81    'graph': {
     82      'inputs': {
     83        'inputA': {
     84          'data': [
     85            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
     86            -15.150615692138672, 13.455190658569336,  45.433597564697266,
     87            61.082862854003906,  70.71882629394531,   -31.278579711914062,
     88            56.08354187011719,   38.992767333984375,  -3.27536940574646,
     89            32.28932189941406,   -3.676541805267334,  88.4349136352539,
     90            14.369060516357422,  13.943194389343262,  16.861190795898438,
     91            4.816806316375732,   44.15916442871094,   -13.083211898803711,
     92            44.56599807739258,   -34.892784118652344, -74.09375
     93          ],
     94          'descriptor': {shape: [24], dataType: 'float32'}
     95        },
     96        'inputB': {
     97          'data': [
     98            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
     99            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
    100            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
    101            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
    102            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
    103            74.99787139892578,   25.865373611450195,  91.5443344116211,
    104            81.65287017822266,   48.2148323059082,    63.370121002197266,
    105            10.626384735107422,  46.126625061035156,  77.22327423095703
    106          ],
    107          'descriptor': {shape: [24], dataType: 'float32'}
    108        }
    109      },
    110      'operators': [{
    111        'name': 'div',
    112        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    113        'outputs': 'output'
    114      }],
    115      'expectedOutputs': {
    116        'output': {
    117          'data': [
    118            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
    119            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
    120            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
    121            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
    122            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
    123            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
    124            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
    125            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
    126          ],
    127          'descriptor': {shape: [24], dataType: 'float32'}
    128        }
    129      }
    130    }
    131  },
    132  {
    133    'name': 'div float32 2D tensors',
    134    'graph': {
    135      'inputs': {
    136        'inputA': {
    137          'data': [
    138            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    139            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    140            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    141            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    142            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    143            14.369060516357422,  13.943194389343262,  16.861190795898438,
    144            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    145            44.56599807739258,   -34.892784118652344, -74.09375
    146          ],
    147          'descriptor': {shape: [4, 6], dataType: 'float32'}
    148        },
    149        'inputB': {
    150          'data': [
    151            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
    152            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
    153            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
    154            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
    155            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
    156            74.99787139892578,   25.865373611450195,  91.5443344116211,
    157            81.65287017822266,   48.2148323059082,    63.370121002197266,
    158            10.626384735107422,  46.126625061035156,  77.22327423095703
    159          ],
    160          'descriptor': {shape: [4, 6], dataType: 'float32'}
    161        }
    162      },
    163      'operators': [{
    164        'name': 'div',
    165        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    166        'outputs': 'output'
    167      }],
    168      'expectedOutputs': {
    169        'output': {
    170          'data': [
    171            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
    172            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
    173            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
    174            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
    175            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
    176            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
    177            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
    178            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
    179          ],
    180          'descriptor': {shape: [4, 6], dataType: 'float32'}
    181        }
    182      }
    183    }
    184  },
    185  {
    186    'name': 'div float32 3D tensors',
    187    'graph': {
    188      'inputs': {
    189        'inputA': {
    190          'data': [
    191            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    192            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    193            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    194            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    195            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    196            14.369060516357422,  13.943194389343262,  16.861190795898438,
    197            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    198            44.56599807739258,   -34.892784118652344, -74.09375
    199          ],
    200          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    201        },
    202        'inputB': {
    203          'data': [
    204            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
    205            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
    206            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
    207            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
    208            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
    209            74.99787139892578,   25.865373611450195,  91.5443344116211,
    210            81.65287017822266,   48.2148323059082,    63.370121002197266,
    211            10.626384735107422,  46.126625061035156,  77.22327423095703
    212          ],
    213          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    214        }
    215      },
    216      'operators': [{
    217        'name': 'div',
    218        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    219        'outputs': 'output'
    220      }],
    221      'expectedOutputs': {
    222        'output': {
    223          'data': [
    224            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
    225            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
    226            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
    227            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
    228            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
    229            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
    230            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
    231            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
    232          ],
    233          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    234        }
    235      }
    236    }
    237  },
    238  {
    239    'name': 'div float32 4D tensors',
    240    'graph': {
    241      'inputs': {
    242        'inputA': {
    243          'data': [
    244            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    245            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    246            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    247            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    248            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    249            14.369060516357422,  13.943194389343262,  16.861190795898438,
    250            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    251            44.56599807739258,   -34.892784118652344, -74.09375
    252          ],
    253          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    254        },
    255        'inputB': {
    256          'data': [
    257            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
    258            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
    259            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
    260            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
    261            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
    262            74.99787139892578,   25.865373611450195,  91.5443344116211,
    263            81.65287017822266,   48.2148323059082,    63.370121002197266,
    264            10.626384735107422,  46.126625061035156,  77.22327423095703
    265          ],
    266          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    267        }
    268      },
    269      'operators': [{
    270        'name': 'div',
    271        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    272        'outputs': 'output'
    273      }],
    274      'expectedOutputs': {
    275        'output': {
    276          'data': [
    277            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
    278            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
    279            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
    280            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
    281            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
    282            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
    283            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
    284            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
    285          ],
    286          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    287        }
    288      }
    289    }
    290  },
    291  {
    292    'name': 'div float32 5D tensors',
    293    'graph': {
    294      'inputs': {
    295        'inputA': {
    296          'data': [
    297            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    298            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    299            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    300            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    301            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    302            14.369060516357422,  13.943194389343262,  16.861190795898438,
    303            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    304            44.56599807739258,   -34.892784118652344, -74.09375
    305          ],
    306          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    307        },
    308        'inputB': {
    309          'data': [
    310            -95.0290298461914,   62.804866790771484,  -85.32865905761719,
    311            -68.20919799804688,  79.45568084716797,   -68.69049072265625,
    312            -94.46466827392578,  -10.000411033630371, 18.318864822387695,
    313            -3.6232800483703613, -5.957828044891357,  89.49882507324219,
    314            94.9579086303711,    -79.0005874633789,   -79.87596893310547,
    315            74.99787139892578,   25.865373611450195,  91.5443344116211,
    316            81.65287017822266,   48.2148323059082,    63.370121002197266,
    317            10.626384735107422,  46.126625061035156,  77.22327423095703
    318          ],
    319          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    320        }
    321      },
    322      'operators': [{
    323        'name': 'div',
    324        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    325        'outputs': 'output'
    326      }],
    327      'expectedOutputs': {
    328        'output': {
    329          'data': [
    330            -0.6358450651168823,  -1.3840086460113525,  0.22848258912563324,
    331            0.22211983799934387,  0.16934208571910858,  -0.6614248752593994,
    332            -0.6466212868690491,  -7.071591854095459,   -1.7074518203735352,
    333            -15.478666305541992,  -6.544795513153076,   -0.036596786230802536,
    334            0.3400382697582245,   0.046538159251213074, -1.1071529388427734,
    335            0.19159291684627533,  0.5390679836273193,   0.18418607115745544,
    336            0.058991268277168274, 0.9158834218978882,   -0.20645710825920105,
    337            4.193900108337402,    -0.7564564943313599,  -0.9594743251800537
    338          ],
    339          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    340        }
    341      }
    342    }
    343  },
    344  {
    345    'name': 'div float32 broadcast 1D to 4D',
    346    'graph': {
    347      'inputs': {
    348        'inputA': {
    349          'data': [-41.827415466308594],
    350          'descriptor': {shape: [1], dataType: 'float32'}
    351        },
    352        'inputB': {
    353          'data': [
    354            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    355            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    356            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    357            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    358            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    359            14.369060516357422,  13.943194389343262,  16.861190795898438,
    360            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    361            44.56599807739258,   -34.892784118652344, -74.09375
    362          ],
    363          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    364        }
    365      },
    366      'operators': [{
    367        'name': 'div',
    368        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    369        'outputs': 'output'
    370      }],
    371      'expectedOutputs': {
    372        'output': {
    373          'data': [
    374            -0.6922348141670227, 0.48120367527008057, 2.145423412322998,
    375            2.7607734203338623,  -3.10864520072937,   -0.9206274151802063,
    376            -0.6847651600837708, -0.5914608240127563, 1.337254285812378,
    377            -0.7458055019378662, -1.0726968050003052, 12.770289421081543,
    378            -1.2953946590423584, 11.376836776733398,  -0.4729740023612976,
    379            -2.910935878753662,  -2.999844551086426,  -2.48069167137146,
    380            -8.683640480041504,  -0.9471967220306396, 3.1970295906066895,
    381            -0.9385499358177185, 1.19874107837677,    0.5645201802253723
    382          ],
    383          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    384        }
    385      }
    386    }
    387  },
    388  {
    389    'name': 'div float32 broadcast 2D to 4D',
    390    'graph': {
    391      'inputs': {
    392        'inputA': {
    393          'data': [
    394            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    395            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    396            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    397            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    398            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    399            14.369060516357422,  13.943194389343262,  16.861190795898438,
    400            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    401            44.56599807739258,   -34.892784118652344, -74.09375
    402          ],
    403          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    404        },
    405        'inputB': {
    406          'data': [
    407            97.32406616210938, 36.325218200683594, 26.037858963012695,
    408            99.47166442871094, 10.395523071289062, -30.788942337036133
    409          ],
    410          'descriptor': {shape: [2, 3], dataType: 'float32'}
    411        }
    412      },
    413      'operators': [{
    414        'name': 'div',
    415        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    416        'outputs': 'output'
    417      }],
    418      'expectedOutputs': {
    419        'output': {
    420          'data': [
    421            0.6208509802818298,   -2.3928961753845215,  -0.7487602233886719,
    422            -0.15231086313724518, 1.2943254709243774,   -1.4756466150283813,
    423            0.627623438835144,    1.946824550628662,    -1.2012730836868286,
    424            0.5638142228126526,   3.7509193420410156,   0.106381356716156,
    425            0.33177119493484497,  -0.10121183097362518, 3.396397352218628,
    426            0.14445380866527557,  1.3412691354751587,   -0.5476378798484802,
    427            0.049492448568344116, 1.2156614065170288,   -0.5024688243865967,
    428            0.4480270743370056,   -3.356520175933838,   2.4065051078796387
    429          ],
    430          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    431        }
    432      }
    433    }
    434  },
    435  {
    436    'name': 'div float32 broadcast 3D to 4D',
    437    'graph': {
    438      'inputs': {
    439        'inputA': {
    440          'data': [
    441            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    442            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    443            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    444            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    445            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    446            14.369060516357422,  13.943194389343262,  16.861190795898438,
    447            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    448            44.56599807739258,   -34.892784118652344, -74.09375
    449          ],
    450          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    451        },
    452        'inputB': {
    453          'data': [
    454            75.08295440673828, -46.22666931152344, 15.761880874633789,
    455            8.9222993850708
    456          ],
    457          'descriptor': {shape: [2, 2, 1], dataType: 'float32'}
    458        }
    459      },
    460      'operators': [{
    461        'name': 'div',
    462        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    463        'outputs': 'output'
    464      }],
    465      'expectedOutputs': {
    466        'output': {
    467          'data': [
    468            0.8047597408294678,  -1.1576858758926392,  -0.2596609592437744,
    469            0.3277462124824524,  -0.2910698652267456,  -0.9828438758850098,
    470            3.8753535747528076,  4.48669958114624,     -1.9844446182250977,
    471            6.285772323608398,   4.370259761810303,    -0.36709925532341003,
    472            0.4300486445426941,  -0.04896639660000801, 1.177829384803772,
    473            -0.3108392059803009, -0.30162662267684937, -0.36475029587745667,
    474            0.3055984377861023,  2.801643133163452,    -0.830053985118866,
    475            4.994900703430176,   -3.910738945007324,   -8.304333686828613
    476          ],
    477          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    478        }
    479      }
    480    }
    481  },
    482  {
    483    'name': 'div float32 broadcast 4D to 4D',
    484    'graph': {
    485      'inputs': {
    486        'inputA': {
    487          'data': [-41.827415466308594],
    488          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}
    489        },
    490        'inputB': {
    491          'data': [
    492            60.42374038696289,   -86.92247772216797,  -19.496112823486328,
    493            -15.150615692138672, 13.455190658569336,  45.433597564697266,
    494            61.082862854003906,  70.71882629394531,   -31.278579711914062,
    495            56.08354187011719,   38.992767333984375,  -3.27536940574646,
    496            32.28932189941406,   -3.676541805267334,  88.4349136352539,
    497            14.369060516357422,  13.943194389343262,  16.861190795898438,
    498            4.816806316375732,   44.15916442871094,   -13.083211898803711,
    499            44.56599807739258,   -34.892784118652344, -74.09375
    500          ],
    501          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    502        }
    503      },
    504      'operators': [{
    505        'name': 'div',
    506        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    507        'outputs': 'output'
    508      }],
    509      'expectedOutputs': {
    510        'output': {
    511          'data': [
    512            -0.6922348141670227, 0.48120367527008057, 2.145423412322998,
    513            2.7607734203338623,  -3.10864520072937,   -0.9206274151802063,
    514            -0.6847651600837708, -0.5914608240127563, 1.337254285812378,
    515            -0.7458055019378662, -1.0726968050003052, 12.770289421081543,
    516            -1.2953946590423584, 11.376836776733398,  -0.4729740023612976,
    517            -2.910935878753662,  -2.999844551086426,  -2.48069167137146,
    518            -8.683640480041504,  -0.9471967220306396, 3.1970295906066895,
    519            -0.9385499358177185, 1.19874107837677,    0.5645201802253723
    520          ],
    521          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    522        }
    523      }
    524    }
    525  },
    526 
    527  // float16 tests
    528  {
    529    'name': 'div float16 1D constant tensors',
    530    'graph': {
    531      'inputs': {
    532        'inputA': {
    533          'data': [
    534            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    535            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    536            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    537            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    538            -13.0859375, 44.5625,      -34.90625, -74.125
    539          ],
    540          'descriptor': {shape: [24], dataType: 'float16'},
    541          'constant': true
    542        },
    543        'inputB': {
    544          'data': [
    545            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    546            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    547            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    548            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    549          ],
    550          'descriptor': {shape: [24], dataType: 'float16'},
    551          'constant': true
    552        }
    553      },
    554      'operators': [{
    555        'name': 'div',
    556        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    557        'outputs': 'output'
    558      }],
    559      'expectedOutputs': {
    560        'output': {
    561          'data': [
    562            -0.63623046875,   -1.3837890625,     0.228515625,
    563            0.22216796875,    0.1693115234375,   -0.66162109375,
    564            -0.64697265625,   -7.07421875,       -1.7080078125,
    565            -15.484375,       -6.546875,         -0.036590576171875,
    566            0.340087890625,   0.046539306640625, -1.107421875,
    567            0.1915283203125,  0.5390625,         0.18408203125,
    568            0.05902099609375, 0.91552734375,     -0.20654296875,
    569            4.1953125,        -0.7568359375,     -0.95947265625
    570          ],
    571          'descriptor': {shape: [24], dataType: 'float16'}
    572        }
    573      }
    574    }
    575  },
    576  {
    577    'name': 'div float16 1D tensors',
    578    'graph': {
    579      'inputs': {
    580        'inputA': {
    581          'data': [
    582            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    583            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    584            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    585            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    586            -13.0859375, 44.5625,      -34.90625, -74.125
    587          ],
    588          'descriptor': {shape: [24], dataType: 'float16'}
    589        },
    590        'inputB': {
    591          'data': [
    592            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    593            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    594            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    595            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    596          ],
    597          'descriptor': {shape: [24], dataType: 'float16'}
    598        }
    599      },
    600      'operators': [{
    601        'name': 'div',
    602        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    603        'outputs': 'output'
    604      }],
    605      'expectedOutputs': {
    606        'output': {
    607          'data': [
    608            -0.63623046875,   -1.3837890625,     0.228515625,
    609            0.22216796875,    0.1693115234375,   -0.66162109375,
    610            -0.64697265625,   -7.07421875,       -1.7080078125,
    611            -15.484375,       -6.546875,         -0.036590576171875,
    612            0.340087890625,   0.046539306640625, -1.107421875,
    613            0.1915283203125,  0.5390625,         0.18408203125,
    614            0.05902099609375, 0.91552734375,     -0.20654296875,
    615            4.1953125,        -0.7568359375,     -0.95947265625
    616          ],
    617          'descriptor': {shape: [24], dataType: 'float16'}
    618        }
    619      }
    620    }
    621  },
    622  {
    623    'name': 'div float16 2D tensors',
    624    'graph': {
    625      'inputs': {
    626        'inputA': {
    627          'data': [
    628            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    629            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    630            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    631            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    632            -13.0859375, 44.5625,      -34.90625, -74.125
    633          ],
    634          'descriptor': {shape: [4, 6], dataType: 'float16'}
    635        },
    636        'inputB': {
    637          'data': [
    638            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    639            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    640            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    641            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    642          ],
    643          'descriptor': {shape: [4, 6], dataType: 'float16'}
    644        }
    645      },
    646      'operators': [{
    647        'name': 'div',
    648        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    649        'outputs': 'output'
    650      }],
    651      'expectedOutputs': {
    652        'output': {
    653          'data': [
    654            -0.63623046875,   -1.3837890625,     0.228515625,
    655            0.22216796875,    0.1693115234375,   -0.66162109375,
    656            -0.64697265625,   -7.07421875,       -1.7080078125,
    657            -15.484375,       -6.546875,         -0.036590576171875,
    658            0.340087890625,   0.046539306640625, -1.107421875,
    659            0.1915283203125,  0.5390625,         0.18408203125,
    660            0.05902099609375, 0.91552734375,     -0.20654296875,
    661            4.1953125,        -0.7568359375,     -0.95947265625
    662          ],
    663          'descriptor': {shape: [4, 6], dataType: 'float16'}
    664        }
    665      }
    666    }
    667  },
    668  {
    669    'name': 'div float16 3D tensors',
    670    'graph': {
    671      'inputs': {
    672        'inputA': {
    673          'data': [
    674            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    675            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    676            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    677            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    678            -13.0859375, 44.5625,      -34.90625, -74.125
    679          ],
    680          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    681        },
    682        'inputB': {
    683          'data': [
    684            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    685            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    686            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    687            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    688          ],
    689          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    690        }
    691      },
    692      'operators': [{
    693        'name': 'div',
    694        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    695        'outputs': 'output'
    696      }],
    697      'expectedOutputs': {
    698        'output': {
    699          'data': [
    700            -0.63623046875,   -1.3837890625,     0.228515625,
    701            0.22216796875,    0.1693115234375,   -0.66162109375,
    702            -0.64697265625,   -7.07421875,       -1.7080078125,
    703            -15.484375,       -6.546875,         -0.036590576171875,
    704            0.340087890625,   0.046539306640625, -1.107421875,
    705            0.1915283203125,  0.5390625,         0.18408203125,
    706            0.05902099609375, 0.91552734375,     -0.20654296875,
    707            4.1953125,        -0.7568359375,     -0.95947265625
    708          ],
    709          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    710        }
    711      }
    712    }
    713  },
    714  {
    715    'name': 'div float16 4D tensors',
    716    'graph': {
    717      'inputs': {
    718        'inputA': {
    719          'data': [
    720            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    721            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    722            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    723            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    724            -13.0859375, 44.5625,      -34.90625, -74.125
    725          ],
    726          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    727        },
    728        'inputB': {
    729          'data': [
    730            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    731            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    732            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    733            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    734          ],
    735          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    736        }
    737      },
    738      'operators': [{
    739        'name': 'div',
    740        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    741        'outputs': 'output'
    742      }],
    743      'expectedOutputs': {
    744        'output': {
    745          'data': [
    746            -0.63623046875,   -1.3837890625,     0.228515625,
    747            0.22216796875,    0.1693115234375,   -0.66162109375,
    748            -0.64697265625,   -7.07421875,       -1.7080078125,
    749            -15.484375,       -6.546875,         -0.036590576171875,
    750            0.340087890625,   0.046539306640625, -1.107421875,
    751            0.1915283203125,  0.5390625,         0.18408203125,
    752            0.05902099609375, 0.91552734375,     -0.20654296875,
    753            4.1953125,        -0.7568359375,     -0.95947265625
    754          ],
    755          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    756        }
    757      }
    758    }
    759  },
    760  {
    761    'name': 'div float16 5D tensors',
    762    'graph': {
    763      'inputs': {
    764        'inputA': {
    765          'data': [
    766            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    767            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    768            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    769            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    770            -13.0859375, 44.5625,      -34.90625, -74.125
    771          ],
    772          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    773        },
    774        'inputB': {
    775          'data': [
    776            -95,      62.8125,  -85.3125, -68.1875,     79.4375,     -68.6875,
    777            -94.4375, -10,      18.3125,  -3.623046875, -5.95703125, 89.5,
    778            94.9375,  -79,      -79.875,  75,           25.859375,   91.5625,
    779            81.625,   48.21875, 63.375,   10.625,       46.125,      77.25
    780          ],
    781          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    782        }
    783      },
    784      'operators': [{
    785        'name': 'div',
    786        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    787        'outputs': 'output'
    788      }],
    789      'expectedOutputs': {
    790        'output': {
    791          'data': [
    792            -0.63623046875,   -1.3837890625,     0.228515625,
    793            0.22216796875,    0.1693115234375,   -0.66162109375,
    794            -0.64697265625,   -7.07421875,       -1.7080078125,
    795            -15.484375,       -6.546875,         -0.036590576171875,
    796            0.340087890625,   0.046539306640625, -1.107421875,
    797            0.1915283203125,  0.5390625,         0.18408203125,
    798            0.05902099609375, 0.91552734375,     -0.20654296875,
    799            4.1953125,        -0.7568359375,     -0.95947265625
    800          ],
    801          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    802        }
    803      }
    804    }
    805  },
    806  {
    807    'name': 'div float16 broadcast 1D to 4D',
    808    'graph': {
    809      'inputs': {
    810        'inputA': {
    811          'data': [-41.8125],
    812          'descriptor': {shape: [1], dataType: 'float16'}
    813        },
    814        'inputB': {
    815          'data': [
    816            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    817            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    818            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    819            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    820            -13.0859375, 44.5625,      -34.90625, -74.125
    821          ],
    822          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    823        }
    824      },
    825      'operators': [{
    826        'name': 'div',
    827        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    828        'outputs': 'output'
    829      }],
    830      'expectedOutputs': {
    831        'output': {
    832          'data': [
    833            -0.69189453125, 0.48095703125,  2.14453125,      2.759765625,
    834            -3.107421875,   -0.92041015625, -0.6845703125,   -0.5908203125,
    835            1.3369140625,   -0.74560546875, -1.072265625,    12.765625,
    836            -1.294921875,   11.375,         -0.472900390625, -2.91015625,
    837            -2.998046875,   -2.48046875,    -8.6796875,      -0.94677734375,
    838            3.1953125,      -0.9384765625,  1.1982421875,    0.56396484375
    839          ],
    840          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    841        }
    842      }
    843    }
    844  },
    845  {
    846    'name': 'div float16 broadcast 2D to 4D',
    847    'graph': {
    848      'inputs': {
    849        'inputA': {
    850          'data': [
    851            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    852            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    853            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    854            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    855            -13.0859375, 44.5625,      -34.90625, -74.125
    856          ],
    857          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    858        },
    859        'inputB': {
    860          'data': [97.3125, 36.3125, 26.03125, 99.5, 10.3984375, -30.78125],
    861          'descriptor': {shape: [2, 3], dataType: 'float16'}
    862        }
    863      },
    864      'operators': [{
    865        'name': 'div',
    866        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    867        'outputs': 'output'
    868      }],
    869      'expectedOutputs': {
    870        'output': {
    871          'data': [
    872            0.62109375,       -2.39453125,      -0.7490234375,
    873            -0.1522216796875, 1.2939453125,     -1.4765625,
    874            0.6279296875,     1.9482421875,     -1.2021484375,
    875            0.56396484375,    3.75,             0.10638427734375,
    876            0.331787109375,   -0.1011962890625, 3.396484375,
    877            0.1444091796875,  1.3408203125,     -0.5478515625,
    878            0.04949951171875, 1.2158203125,     -0.5029296875,
    879            0.44775390625,    -3.357421875,     2.408203125
    880          ],
    881          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    882        }
    883      }
    884    }
    885  },
    886  {
    887    'name': 'div float16 broadcast 3D to 4D',
    888    'graph': {
    889      'inputs': {
    890        'inputA': {
    891          'data': [
    892            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    893            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    894            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    895            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    896            -13.0859375, 44.5625,      -34.90625, -74.125
    897          ],
    898          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    899        },
    900        'inputB': {
    901          'data': [75.0625, -46.21875, 15.765625, 8.921875],
    902          'descriptor': {shape: [2, 2, 1], dataType: 'float16'}
    903        }
    904      },
    905      'operators': [{
    906        'name': 'div',
    907        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    908        'outputs': 'output'
    909      }],
    910      'expectedOutputs': {
    911        'output': {
    912          'data': [
    913            0.80517578125, -1.158203125,       -0.259765625,   0.32763671875,
    914            -0.291015625,  -0.98291015625,     3.875,          4.48828125,
    915            -1.984375,     6.2890625,          4.37109375,     -0.3671875,
    916            0.43017578125, -0.048980712890625, 1.177734375,    -0.310791015625,
    917            -0.3017578125, -0.36474609375,     0.305419921875, 2.80078125,
    918            -0.830078125,  4.99609375,         -3.912109375,   -8.3046875
    919          ],
    920          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    921        }
    922      }
    923    }
    924  },
    925  {
    926    'name': 'div float16 broadcast 4D to 4D',
    927    'graph': {
    928      'inputs': {
    929        'inputA': {
    930          'data': [-41.8125],
    931          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'}
    932        },
    933        'inputB': {
    934          'data': [
    935            60.4375,     -86.9375,     -19.5,     -15.1484375, 13.453125,
    936            45.4375,     61.09375,     70.75,     -31.28125,   56.09375,
    937            39,          -3.275390625, 32.28125,  -3.67578125, 88.4375,
    938            14.3671875,  13.9453125,   16.859375, 4.81640625,  44.15625,
    939            -13.0859375, 44.5625,      -34.90625, -74.125
    940          ],
    941          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    942        }
    943      },
    944      'operators': [{
    945        'name': 'div',
    946        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    947        'outputs': 'output'
    948      }],
    949      'expectedOutputs': {
    950        'output': {
    951          'data': [
    952            -0.69189453125, 0.48095703125,  2.14453125,      2.759765625,
    953            -3.107421875,   -0.92041015625, -0.6845703125,   -0.5908203125,
    954            1.3369140625,   -0.74560546875, -1.072265625,    12.765625,
    955            -1.294921875,   11.375,         -0.472900390625, -2.91015625,
    956            -2.998046875,   -2.48046875,    -8.6796875,      -0.94677734375,
    957            3.1953125,      -0.9384765625,  1.1982421875,    0.56396484375
    958          ],
    959          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    960        }
    961      }
    962    }
    963  }
    964 ];
    965 
    966 webnn_conformance_test(
    967    divTests, buildAndExecuteGraph, getDivPrecisionTolerance);