tor-browser

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

lesser.https.any.js (35751B)


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