tor-browser

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

equal.https.any.js (35283B)


      1 // META: title=test WebNN API element-wise equal 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-logical
     12 // Compare if the values of the two input tensors are equal, element-wise.
     13 //
     14 // MLOperand equal(MLOperand a, MLOperand b);
     15 
     16 const equalTests = [
     17  {
     18    'name': 'equal float32 0D scalar',
     19    'graph': {
     20      'inputs': {
     21        'inputA': {
     22          'data': [-0.6285496950149536],
     23          'descriptor': {shape: [], dataType: 'float32'}
     24        },
     25        'inputB': {
     26          'data': [-4.4166412353515625],
     27          'descriptor': {shape: [], dataType: 'float32'}
     28        }
     29      },
     30      'operators': [{
     31        'name': 'equal',
     32        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
     33        'outputs': 'output'
     34      }],
     35      'expectedOutputs': {
     36        'output': {'data': [0], 'descriptor': {shape: [], dataType: 'uint8'}}
     37      }
     38    }
     39  },
     40  {
     41    'name': 'equal float32 1D constant tensors',
     42    'graph': {
     43      'inputs': {
     44        'inputA': {
     45          'data': [
     46            2.80570650100708,    5.588105201721191,   2.855226516723633,
     47            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
     48            2.80570650100708,    5.588105201721191,   -5.107602119445801,
     49            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
     50            2.80570650100708,    5.588105201721191,   4.980423927307129,
     51            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
     52            2.80570650100708,    5.588105201721191,   -6.245251178741455,
     53            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
     54          ],
     55          'descriptor': {shape: [24], dataType: 'float32'},
     56          'constant': true
     57        },
     58        'inputB': {
     59          'data': [
     60            2.80570650100708,    5.588105201721191,  -4.839719772338867,
     61            4.996258735656738,   0.9727277755737305, -6.173707485198975,
     62            2.80570650100708,    5.588105201721191,  7.767369747161865,
     63            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
     64            2.80570650100708,    5.588105201721191,  0.17833954095840454,
     65            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
     66            2.80570650100708,    5.588105201721191,  -9.041799545288086,
     67            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
     68          ],
     69          'descriptor': {shape: [24], dataType: 'float32'},
     70          'constant': true
     71        }
     72      },
     73      'operators': [{
     74        'name': 'equal',
     75        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
     76        'outputs': 'output'
     77      }],
     78      'expectedOutputs': {
     79        'output': {
     80          'data': [
     81            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
     82            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
     83          ],
     84          'descriptor': {shape: [24], dataType: 'uint8'}
     85        }
     86      }
     87    }
     88  },
     89  {
     90    'name': 'equal float32 1D tensors',
     91    'graph': {
     92      'inputs': {
     93        'inputA': {
     94          'data': [
     95            2.80570650100708,    5.588105201721191,   2.855226516723633,
     96            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
     97            2.80570650100708,    5.588105201721191,   -5.107602119445801,
     98            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
     99            2.80570650100708,    5.588105201721191,   4.980423927307129,
    100            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    101            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    102            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    103          ],
    104          'descriptor': {shape: [24], dataType: 'float32'}
    105        },
    106        'inputB': {
    107          'data': [
    108            2.80570650100708,    5.588105201721191,  -4.839719772338867,
    109            4.996258735656738,   0.9727277755737305, -6.173707485198975,
    110            2.80570650100708,    5.588105201721191,  7.767369747161865,
    111            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
    112            2.80570650100708,    5.588105201721191,  0.17833954095840454,
    113            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
    114            2.80570650100708,    5.588105201721191,  -9.041799545288086,
    115            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
    116          ],
    117          'descriptor': {shape: [24], dataType: 'float32'}
    118        }
    119      },
    120      'operators': [{
    121        'name': 'equal',
    122        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    123        'outputs': 'output'
    124      }],
    125      'expectedOutputs': {
    126        'output': {
    127          'data': [
    128            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    129            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    130          ],
    131          'descriptor': {shape: [24], dataType: 'uint8'}
    132        }
    133      }
    134    }
    135  },
    136  {
    137    'name': 'equal float32 2D tensors',
    138    'graph': {
    139      'inputs': {
    140        'inputA': {
    141          'data': [
    142            2.80570650100708,    5.588105201721191,   2.855226516723633,
    143            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    144            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    145            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    146            2.80570650100708,    5.588105201721191,   4.980423927307129,
    147            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    148            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    149            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    150          ],
    151          'descriptor': {shape: [4, 6], dataType: 'float32'}
    152        },
    153        'inputB': {
    154          'data': [
    155            2.80570650100708,    5.588105201721191,  -4.839719772338867,
    156            4.996258735656738,   0.9727277755737305, -6.173707485198975,
    157            2.80570650100708,    5.588105201721191,  7.767369747161865,
    158            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
    159            2.80570650100708,    5.588105201721191,  0.17833954095840454,
    160            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
    161            2.80570650100708,    5.588105201721191,  -9.041799545288086,
    162            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
    163          ],
    164          'descriptor': {shape: [4, 6], dataType: 'float32'}
    165        }
    166      },
    167      'operators': [{
    168        'name': 'equal',
    169        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    170        'outputs': 'output'
    171      }],
    172      'expectedOutputs': {
    173        'output': {
    174          'data': [
    175            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    176            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    177          ],
    178          'descriptor': {shape: [4, 6], dataType: 'uint8'}
    179        }
    180      }
    181    }
    182  },
    183  {
    184    'name': 'equal float32 3D tensors',
    185    'graph': {
    186      'inputs': {
    187        'inputA': {
    188          'data': [
    189            2.80570650100708,    5.588105201721191,   2.855226516723633,
    190            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    191            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    192            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    193            2.80570650100708,    5.588105201721191,   4.980423927307129,
    194            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    195            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    196            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    197          ],
    198          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    199        },
    200        'inputB': {
    201          'data': [
    202            2.80570650100708,    5.588105201721191,  -4.839719772338867,
    203            4.996258735656738,   0.9727277755737305, -6.173707485198975,
    204            2.80570650100708,    5.588105201721191,  7.767369747161865,
    205            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
    206            2.80570650100708,    5.588105201721191,  0.17833954095840454,
    207            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
    208            2.80570650100708,    5.588105201721191,  -9.041799545288086,
    209            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
    210          ],
    211          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    212        }
    213      },
    214      'operators': [{
    215        'name': 'equal',
    216        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    217        'outputs': 'output'
    218      }],
    219      'expectedOutputs': {
    220        'output': {
    221          'data': [
    222            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    223            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    224          ],
    225          'descriptor': {shape: [2, 3, 4], dataType: 'uint8'}
    226        }
    227      }
    228    }
    229  },
    230  {
    231    'name': 'equal float32 4D tensors',
    232    'graph': {
    233      'inputs': {
    234        'inputA': {
    235          'data': [
    236            2.80570650100708,    5.588105201721191,   2.855226516723633,
    237            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    238            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    239            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    240            2.80570650100708,    5.588105201721191,   4.980423927307129,
    241            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    242            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    243            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    244          ],
    245          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    246        },
    247        'inputB': {
    248          'data': [
    249            2.80570650100708,    5.588105201721191,  -4.839719772338867,
    250            4.996258735656738,   0.9727277755737305, -6.173707485198975,
    251            2.80570650100708,    5.588105201721191,  7.767369747161865,
    252            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
    253            2.80570650100708,    5.588105201721191,  0.17833954095840454,
    254            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
    255            2.80570650100708,    5.588105201721191,  -9.041799545288086,
    256            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
    257          ],
    258          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    259        }
    260      },
    261      'operators': [{
    262        'name': 'equal',
    263        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    264        'outputs': 'output'
    265      }],
    266      'expectedOutputs': {
    267        'output': {
    268          'data': [
    269            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    270            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    271          ],
    272          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    273        }
    274      }
    275    }
    276  },
    277  {
    278    'name': 'equal float32 5D tensors',
    279    'graph': {
    280      'inputs': {
    281        'inputA': {
    282          'data': [
    283            2.80570650100708,    5.588105201721191,   2.855226516723633,
    284            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    285            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    286            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    287            2.80570650100708,    5.588105201721191,   4.980423927307129,
    288            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    289            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    290            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    291          ],
    292          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    293        },
    294        'inputB': {
    295          'data': [
    296            2.80570650100708,    5.588105201721191,  -4.839719772338867,
    297            4.996258735656738,   0.9727277755737305, -6.173707485198975,
    298            2.80570650100708,    5.588105201721191,  7.767369747161865,
    299            -4.308907985687256,  -5.895479679107666, -8.53209114074707,
    300            2.80570650100708,    5.588105201721191,  0.17833954095840454,
    301            -4.479541778564453,  0.6819732189178467, -6.6875128746032715,
    302            2.80570650100708,    5.588105201721191,  -9.041799545288086,
    303            -1.9728281497955322, -3.011512279510498, 3.6268343925476074
    304          ],
    305          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}
    306        }
    307      },
    308      'operators': [{
    309        'name': 'equal',
    310        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    311        'outputs': 'output'
    312      }],
    313      'expectedOutputs': {
    314        'output': {
    315          'data': [
    316            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    317            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    318          ],
    319          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'}
    320        }
    321      }
    322    }
    323  },
    324  {
    325    'name': 'equal float32 broadcast 0D to 4D',
    326    'graph': {
    327      'inputs': {
    328        'inputA': {
    329          'data': [2.80570650100708],
    330          'descriptor': {shape: [], dataType: 'float32'}
    331        },
    332        'inputB': {
    333          'data': [
    334            2.80570650100708,    5.588105201721191,   2.855226516723633,
    335            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    336            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    337            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    338            2.80570650100708,    5.588105201721191,   4.980423927307129,
    339            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    340            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    341            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    342          ],
    343          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    344        }
    345      },
    346      'operators': [{
    347        'name': 'equal',
    348        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    349        'outputs': 'output'
    350      }],
    351      'expectedOutputs': {
    352        'output': {
    353          'data': [
    354            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    355            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    356          ],
    357          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    358        }
    359      }
    360    }
    361  },
    362  {
    363    'name': 'equal float32 broadcast 1D to 4D',
    364    'graph': {
    365      'inputs': {
    366        'inputA': {
    367          'data': [2.80570650100708],
    368          'descriptor': {shape: [1], dataType: 'float32'}
    369        },
    370        'inputB': {
    371          'data': [
    372            2.80570650100708,    5.588105201721191,   2.855226516723633,
    373            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    374            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    375            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    376            2.80570650100708,    5.588105201721191,   4.980423927307129,
    377            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    378            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    379            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    380          ],
    381          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    382        }
    383      },
    384      'operators': [{
    385        'name': 'equal',
    386        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    387        'outputs': 'output'
    388      }],
    389      'expectedOutputs': {
    390        'output': {
    391          'data': [
    392            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    393            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    394          ],
    395          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    396        }
    397      }
    398    }
    399  },
    400  {
    401    'name': 'equal float32 broadcast 2D to 4D',
    402    'graph': {
    403      'inputs': {
    404        'inputA': {
    405          'data': [
    406            2.80570650100708,    5.588105201721191,   2.855226516723633,
    407            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    408            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    409            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    410            2.80570650100708,    5.588105201721191,   4.980423927307129,
    411            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    412            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    413            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    414          ],
    415          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    416        },
    417        'inputB': {
    418          'data': [
    419            2.80570650100708, 5.588105201721191, -4.9622955322265625,
    420            -2.863192081451416, -3.011512279510498, 3.6268343925476074
    421          ],
    422          'descriptor': {shape: [2, 3], dataType: 'float32'}
    423        }
    424      },
    425      'operators': [{
    426        'name': 'equal',
    427        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    428        'outputs': 'output'
    429      }],
    430      'expectedOutputs': {
    431        'output': {
    432          'data': [
    433            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
    434            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    435          ],
    436          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    437        }
    438      }
    439    }
    440  },
    441  {
    442    'name': 'equal float32 broadcast 3D to 4D',
    443    'graph': {
    444      'inputs': {
    445        'inputA': {
    446          'data': [
    447            2.80570650100708,    5.588105201721191,   2.855226516723633,
    448            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    449            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    450            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    451            2.80570650100708,    5.588105201721191,   4.980423927307129,
    452            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    453            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    454            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    455          ],
    456          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    457        },
    458        'inputB': {
    459          'data': [
    460            2.80570650100708, 5.588105201721191, -9.041799545288086,
    461            3.6268343925476074
    462          ],
    463          'descriptor': {shape: [2, 2, 1], dataType: 'float32'}
    464        }
    465      },
    466      'operators': [{
    467        'name': 'equal',
    468        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    469        'outputs': 'output'
    470      }],
    471      'expectedOutputs': {
    472        'output': {
    473          'data': [
    474            1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    475            1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    476          ],
    477          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    478        }
    479      }
    480    }
    481  },
    482  {
    483    'name': 'equal float32 broadcast 4D to 4D',
    484    'graph': {
    485      'inputs': {
    486        'inputA': {
    487          'data': [2.80570650100708],
    488          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float32'}
    489        },
    490        'inputB': {
    491          'data': [
    492            2.80570650100708,    5.588105201721191,   2.855226516723633,
    493            4.996258735656738,   0.9727277755737305,  -4.742599964141846,
    494            2.80570650100708,    5.588105201721191,   -5.107602119445801,
    495            6.624142169952393,   -2.3207247257232666, -7.053895950317383,
    496            2.80570650100708,    5.588105201721191,   4.980423927307129,
    497            -5.440841197967529,  1.1459590196609497,  7.774532794952393,
    498            2.80570650100708,    5.588105201721191,   -6.245251178741455,
    499            -2.8490731716156006, -2.6951117515563965, 5.817563056945801
    500          ],
    501          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    502        }
    503      },
    504      'operators': [{
    505        'name': 'equal',
    506        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    507        'outputs': 'output'
    508      }],
    509      'expectedOutputs': {
    510        'output': {
    511          'data': [
    512            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    513            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    514          ],
    515          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    516        }
    517      }
    518    }
    519  },
    520 
    521  // float16 tests
    522  {
    523    'name': 'equal float16 0D scalar',
    524    'graph': {
    525      'inputs': {
    526        'inputA': {
    527          'data': [-0.62841796875],
    528          'descriptor': {shape: [], dataType: 'float16'}
    529        },
    530        'inputB': {
    531          'data': [-4.41796875],
    532          'descriptor': {shape: [], dataType: 'float16'}
    533        }
    534      },
    535      'operators': [{
    536        'name': 'equal',
    537        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    538        'outputs': 'output'
    539      }],
    540      'expectedOutputs': {
    541        'output': {'data': [0], 'descriptor': {shape: [], dataType: 'uint8'}}
    542      }
    543    }
    544  },
    545  {
    546    'name': 'equal float16 1D constant tensors',
    547    'graph': {
    548      'inputs': {
    549        'inputA': {
    550          'data': [
    551            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    552            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    553            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    554            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    555            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    556          ],
    557          'descriptor': {shape: [24], dataType: 'float16'},
    558          'constant': true
    559        },
    560        'inputB': {
    561          'data': [
    562            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    563            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    564            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    565            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    566            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    567            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    568          ],
    569          'descriptor': {shape: [24], dataType: 'float16'},
    570          'constant': true
    571        }
    572      },
    573      'operators': [{
    574        'name': 'equal',
    575        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    576        'outputs': 'output'
    577      }],
    578      'expectedOutputs': {
    579        'output': {
    580          'data': [
    581            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    582            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    583          ],
    584          'descriptor': {shape: [24], dataType: 'uint8'}
    585        }
    586      }
    587    }
    588  },
    589  {
    590    'name': 'equal float16 1D tensors',
    591    'graph': {
    592      'inputs': {
    593        'inputA': {
    594          'data': [
    595            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    596            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    597            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    598            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    599            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    600          ],
    601          'descriptor': {shape: [24], dataType: 'float16'}
    602        },
    603        'inputB': {
    604          'data': [
    605            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    606            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    607            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    608            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    609            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    610            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    611          ],
    612          'descriptor': {shape: [24], dataType: 'float16'}
    613        }
    614      },
    615      'operators': [{
    616        'name': 'equal',
    617        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    618        'outputs': 'output'
    619      }],
    620      'expectedOutputs': {
    621        'output': {
    622          'data': [
    623            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    624            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    625          ],
    626          'descriptor': {shape: [24], dataType: 'uint8'}
    627        }
    628      }
    629    }
    630  },
    631  {
    632    'name': 'equal float16 2D tensors',
    633    'graph': {
    634      'inputs': {
    635        'inputA': {
    636          'data': [
    637            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    638            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    639            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    640            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    641            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    642          ],
    643          'descriptor': {shape: [4, 6], dataType: 'float16'}
    644        },
    645        'inputB': {
    646          'data': [
    647            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    648            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    649            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    650            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    651            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    652            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    653          ],
    654          'descriptor': {shape: [4, 6], dataType: 'float16'}
    655        }
    656      },
    657      'operators': [{
    658        'name': 'equal',
    659        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    660        'outputs': 'output'
    661      }],
    662      'expectedOutputs': {
    663        'output': {
    664          'data': [
    665            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    666            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    667          ],
    668          'descriptor': {shape: [4, 6], dataType: 'uint8'}
    669        }
    670      }
    671    }
    672  },
    673  {
    674    'name': 'equal float16 3D tensors',
    675    'graph': {
    676      'inputs': {
    677        'inputA': {
    678          'data': [
    679            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    680            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    681            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    682            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    683            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    684          ],
    685          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    686        },
    687        'inputB': {
    688          'data': [
    689            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    690            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    691            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    692            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    693            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    694            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    695          ],
    696          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    697        }
    698      },
    699      'operators': [{
    700        'name': 'equal',
    701        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    702        'outputs': 'output'
    703      }],
    704      'expectedOutputs': {
    705        'output': {
    706          'data': [
    707            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    708            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    709          ],
    710          'descriptor': {shape: [2, 3, 4], dataType: 'uint8'}
    711        }
    712      }
    713    }
    714  },
    715  {
    716    'name': 'equal float16 4D tensors',
    717    'graph': {
    718      'inputs': {
    719        'inputA': {
    720          'data': [
    721            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    722            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    723            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    724            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    725            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    726          ],
    727          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    728        },
    729        'inputB': {
    730          'data': [
    731            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    732            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    733            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    734            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    735            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    736            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    737          ],
    738          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    739        }
    740      },
    741      'operators': [{
    742        'name': 'equal',
    743        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    744        'outputs': 'output'
    745      }],
    746      'expectedOutputs': {
    747        'output': {
    748          'data': [
    749            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    750            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    751          ],
    752          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    753        }
    754      }
    755    }
    756  },
    757  {
    758    'name': 'equal float16 5D tensors',
    759    'graph': {
    760      'inputs': {
    761        'inputA': {
    762          'data': [
    763            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    764            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    765            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    766            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    767            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    768          ],
    769          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    770        },
    771        'inputB': {
    772          'data': [
    773            2.806640625,   5.58984375,  -4.83984375,     4.99609375,
    774            0.97265625,    -6.171875,   2.806640625,     5.58984375,
    775            7.765625,      -4.30859375, -5.89453125,     -8.53125,
    776            2.806640625,   5.58984375,  0.1783447265625, -4.48046875,
    777            0.68212890625, -6.6875,     2.806640625,     5.58984375,
    778            -9.0390625,    -1.97265625, -3.01171875,     3.626953125
    779          ],
    780          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}
    781        }
    782      },
    783      'operators': [{
    784        'name': 'equal',
    785        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    786        'outputs': 'output'
    787      }],
    788      'expectedOutputs': {
    789        'output': {
    790          'data': [
    791            1, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0,
    792            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    793          ],
    794          'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'uint8'}
    795        }
    796      }
    797    }
    798  },
    799  {
    800    'name': 'equal float16 broadcast 0D to 4D',
    801    'graph': {
    802      'inputs': {
    803        'inputA': {
    804          'data': [2.806640625],
    805          'descriptor': {shape: [], dataType: 'float16'}
    806        },
    807        'inputB': {
    808          'data': [
    809            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    810            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    811            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    812            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    813            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    814          ],
    815          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    816        }
    817      },
    818      'operators': [{
    819        'name': 'equal',
    820        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    821        'outputs': 'output'
    822      }],
    823      'expectedOutputs': {
    824        'output': {
    825          'data': [
    826            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    827            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    828          ],
    829          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    830        }
    831      }
    832    }
    833  },
    834  {
    835    'name': 'equal float16 broadcast 1D to 4D',
    836    'graph': {
    837      'inputs': {
    838        'inputA': {
    839          'data': [2.806640625],
    840          'descriptor': {shape: [1], dataType: 'float16'}
    841        },
    842        'inputB': {
    843          'data': [
    844            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    845            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    846            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    847            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    848            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    849          ],
    850          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    851        }
    852      },
    853      'operators': [{
    854        'name': 'equal',
    855        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    856        'outputs': 'output'
    857      }],
    858      'expectedOutputs': {
    859        'output': {
    860          'data': [
    861            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    862            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    863          ],
    864          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    865        }
    866      }
    867    }
    868  },
    869  {
    870    'name': 'equal float16 broadcast 2D to 4D',
    871    'graph': {
    872      'inputs': {
    873        'inputA': {
    874          'data': [
    875            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    876            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    877            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    878            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    879            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    880          ],
    881          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    882        },
    883        'inputB': {
    884          'data': [
    885            2.806640625, 5.58984375, -4.9609375, -2.86328125, -3.01171875,
    886            3.626953125
    887          ],
    888          'descriptor': {shape: [2, 3], dataType: 'float16'}
    889        }
    890      },
    891      'operators': [{
    892        'name': 'equal',
    893        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    894        'outputs': 'output'
    895      }],
    896      'expectedOutputs': {
    897        'output': {
    898          'data': [
    899            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,
    900            1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0
    901          ],
    902          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    903        }
    904      }
    905    }
    906  },
    907  {
    908    'name': 'equal float16 broadcast 3D to 4D',
    909    'graph': {
    910      'inputs': {
    911        'inputA': {
    912          'data': [
    913            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    914            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    915            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    916            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    917            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    918          ],
    919          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    920        },
    921        'inputB': {
    922          'data': [2.806640625, 5.58984375, -9.0390625, 3.626953125],
    923          'descriptor': {shape: [2, 2, 1], dataType: 'float16'}
    924        }
    925      },
    926      'operators': [{
    927        'name': 'equal',
    928        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    929        'outputs': 'output'
    930      }],
    931      'expectedOutputs': {
    932        'output': {
    933          'data': [
    934            1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    935            1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    936          ],
    937          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    938        }
    939      }
    940    }
    941  },
    942  {
    943    'name': 'equal float16 broadcast 4D to 4D',
    944    'graph': {
    945      'inputs': {
    946        'inputA': {
    947          'data': [2.806640625],
    948          'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'}
    949        },
    950        'inputB': {
    951          'data': [
    952            2.806640625, 5.58984375,   2.85546875,  4.99609375,  0.97265625,
    953            -4.7421875,  2.806640625,  5.58984375,  -5.109375,   6.625,
    954            -2.3203125,  -7.0546875,   2.806640625, 5.58984375,  4.98046875,
    955            -5.44140625, 1.1455078125, 7.7734375,   2.806640625, 5.58984375,
    956            -6.24609375, -2.849609375, -2.6953125,  5.81640625
    957          ],
    958          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    959        }
    960      },
    961      'operators': [{
    962        'name': 'equal',
    963        'arguments': [{'a': 'inputA'}, {'b': 'inputB'}],
    964        'outputs': 'output'
    965      }],
    966      'expectedOutputs': {
    967        'output': {
    968          'data': [
    969            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,
    970            1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0
    971          ],
    972          'descriptor': {shape: [2, 2, 2, 3], dataType: 'uint8'}
    973        }
    974      }
    975    }
    976  }
    977 ];
    978 
    979 webnn_conformance_test(equalTests, buildAndExecuteGraph, getZeroULPTolerance);