tor-browser

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

abs.https.any.js (22923B)


      1 // META: title=test WebNN API element-wise abs 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-unary
     12 // Compute the absolute value of the input tensor, element-wise.
     13 //
     14 // MLOperand abs(MLOperand input);
     15 
     16 
     17 const getAbsPrecisionTolerance = () => {
     18  return {metricType: 'ULP', value: 0};
     19 };
     20 
     21 const absTests = [
     22  // abs tests
     23  {
     24    'name': 'abs float32 positive 0D scalar',
     25    'graph': {
     26      'inputs': {
     27        'absInput': {
     28          'data': [49.837242126464844],
     29          'descriptor': {shape: [], dataType: 'float32'}
     30        }
     31      },
     32      'operators': [{
     33        'name': 'abs',
     34        'arguments': [{'input': 'absInput'}],
     35        'outputs': 'absOutput'
     36      }],
     37      'expectedOutputs': {
     38        'absOutput': {
     39          'data': [49.837242126464844],
     40          'descriptor': {shape: [], dataType: 'float32'}
     41        }
     42      }
     43    }
     44  },
     45  {
     46    'name': 'abs float32 negative 0D scalar',
     47    'graph': {
     48      'inputs': {
     49        'absInput': {
     50          'data': [-91.03521728515625],
     51          'descriptor': {shape: [], dataType: 'float32'}
     52        }
     53      },
     54      'operators': [{
     55        'name': 'abs',
     56        'arguments': [{'input': 'absInput'}],
     57        'outputs': 'absOutput'
     58      }],
     59      'expectedOutputs': {
     60        'absOutput': {
     61          'data': [91.03521728515625],
     62          'descriptor': {shape: [], dataType: 'float32'}
     63        }
     64      }
     65    }
     66  },
     67  {
     68    'name': 'abs float32 1D constant tensor',
     69    'graph': {
     70      'inputs': {
     71        'absInput': {
     72          'data': [
     73            49.837242126464844,  82.09291076660156,  3.1989054679870605,
     74            85.20904541015625,   88.94609069824219,  -91.03521728515625,
     75            31.4484920501709,    -29.31110954284668, -92.4477310180664,
     76            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
     77            53.064762115478516,  99.6537094116211,   -21.285049438476562,
     78            90.01982879638672,   18.32451820373535,  -33.06915283203125,
     79            30.097660064697266,  -74.21503448486328, 95.60974884033203,
     80            6.614287376403809,   31.2832088470459,   -53.206058502197266
     81          ],
     82          'descriptor': {shape: [24], dataType: 'float32'},
     83          'constant': true
     84        }
     85      },
     86      'operators': [{
     87        'name': 'abs',
     88        'arguments': [{'input': 'absInput'}],
     89        'outputs': 'absOutput'
     90      }],
     91      'expectedOutputs': {
     92        'absOutput': {
     93          'data': [
     94            49.837242126464844, 82.09291076660156, 3.1989054679870605,
     95            85.20904541015625,  88.94609069824219, 91.03521728515625,
     96            31.4484920501709,   29.31110954284668, 92.4477310180664,
     97            15.520709991455078, 80.91279602050781, 38.2097053527832,
     98            53.064762115478516, 99.6537094116211,  21.285049438476562,
     99            90.01982879638672,  18.32451820373535, 33.06915283203125,
    100            30.097660064697266, 74.21503448486328, 95.60974884033203,
    101            6.614287376403809,  31.2832088470459,  53.206058502197266
    102          ],
    103          'descriptor': {shape: [24], dataType: 'float32'}
    104        }
    105      }
    106    }
    107  },
    108  {
    109    'name': 'abs float32 1D tensor',
    110    'graph': {
    111      'inputs': {
    112        'absInput': {
    113          'data': [
    114            49.837242126464844,  82.09291076660156,  3.1989054679870605,
    115            85.20904541015625,   88.94609069824219,  -91.03521728515625,
    116            31.4484920501709,    -29.31110954284668, -92.4477310180664,
    117            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
    118            53.064762115478516,  99.6537094116211,   -21.285049438476562,
    119            90.01982879638672,   18.32451820373535,  -33.06915283203125,
    120            30.097660064697266,  -74.21503448486328, 95.60974884033203,
    121            6.614287376403809,   31.2832088470459,   -53.206058502197266
    122          ],
    123          'descriptor': {shape: [24], dataType: 'float32'}
    124        }
    125      },
    126      'operators': [{
    127        'name': 'abs',
    128        'arguments': [{'input': 'absInput'}],
    129        'outputs': 'absOutput'
    130      }],
    131      'expectedOutputs': {
    132        'absOutput': {
    133          'data': [
    134            49.837242126464844, 82.09291076660156, 3.1989054679870605,
    135            85.20904541015625,  88.94609069824219, 91.03521728515625,
    136            31.4484920501709,   29.31110954284668, 92.4477310180664,
    137            15.520709991455078, 80.91279602050781, 38.2097053527832,
    138            53.064762115478516, 99.6537094116211,  21.285049438476562,
    139            90.01982879638672,  18.32451820373535, 33.06915283203125,
    140            30.097660064697266, 74.21503448486328, 95.60974884033203,
    141            6.614287376403809,  31.2832088470459,  53.206058502197266
    142          ],
    143          'descriptor': {shape: [24], dataType: 'float32'}
    144        }
    145      }
    146    }
    147  },
    148  {
    149    'name': 'abs float32 2D tensor',
    150    'graph': {
    151      'inputs': {
    152        'absInput': {
    153          'data': [
    154            49.837242126464844,  82.09291076660156,  3.1989054679870605,
    155            85.20904541015625,   88.94609069824219,  -91.03521728515625,
    156            31.4484920501709,    -29.31110954284668, -92.4477310180664,
    157            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
    158            53.064762115478516,  99.6537094116211,   -21.285049438476562,
    159            90.01982879638672,   18.32451820373535,  -33.06915283203125,
    160            30.097660064697266,  -74.21503448486328, 95.60974884033203,
    161            6.614287376403809,   31.2832088470459,   -53.206058502197266
    162          ],
    163          'descriptor': {shape: [4, 6], dataType: 'float32'}
    164        }
    165      },
    166      'operators': [{
    167        'name': 'abs',
    168        'arguments': [{'input': 'absInput'}],
    169        'outputs': 'absOutput'
    170      }],
    171      'expectedOutputs': {
    172        'absOutput': {
    173          'data': [
    174            49.837242126464844, 82.09291076660156, 3.1989054679870605,
    175            85.20904541015625,  88.94609069824219, 91.03521728515625,
    176            31.4484920501709,   29.31110954284668, 92.4477310180664,
    177            15.520709991455078, 80.91279602050781, 38.2097053527832,
    178            53.064762115478516, 99.6537094116211,  21.285049438476562,
    179            90.01982879638672,  18.32451820373535, 33.06915283203125,
    180            30.097660064697266, 74.21503448486328, 95.60974884033203,
    181            6.614287376403809,  31.2832088470459,  53.206058502197266
    182          ],
    183          'descriptor': {shape: [4, 6], dataType: 'float32'}
    184        }
    185      }
    186    }
    187  },
    188  {
    189    'name': 'abs float32 3D tensor',
    190    'graph': {
    191      'inputs': {
    192        'absInput': {
    193          'data': [
    194            49.837242126464844,  82.09291076660156,  3.1989054679870605,
    195            85.20904541015625,   88.94609069824219,  -91.03521728515625,
    196            31.4484920501709,    -29.31110954284668, -92.4477310180664,
    197            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
    198            53.064762115478516,  99.6537094116211,   -21.285049438476562,
    199            90.01982879638672,   18.32451820373535,  -33.06915283203125,
    200            30.097660064697266,  -74.21503448486328, 95.60974884033203,
    201            6.614287376403809,   31.2832088470459,   -53.206058502197266
    202          ],
    203          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    204        }
    205      },
    206      'operators': [{
    207        'name': 'abs',
    208        'arguments': [{'input': 'absInput'}],
    209        'outputs': 'absOutput'
    210      }],
    211      'expectedOutputs': {
    212        'absOutput': {
    213          'data': [
    214            49.837242126464844, 82.09291076660156, 3.1989054679870605,
    215            85.20904541015625,  88.94609069824219, 91.03521728515625,
    216            31.4484920501709,   29.31110954284668, 92.4477310180664,
    217            15.520709991455078, 80.91279602050781, 38.2097053527832,
    218            53.064762115478516, 99.6537094116211,  21.285049438476562,
    219            90.01982879638672,  18.32451820373535, 33.06915283203125,
    220            30.097660064697266, 74.21503448486328, 95.60974884033203,
    221            6.614287376403809,  31.2832088470459,  53.206058502197266
    222          ],
    223          'descriptor': {shape: [2, 3, 4], dataType: 'float32'}
    224        }
    225      }
    226    }
    227  },
    228  {
    229    'name': 'abs float32 4D tensor',
    230    'graph': {
    231      'inputs': {
    232        'absInput': {
    233          'data': [
    234            49.837242126464844,  82.09291076660156,  3.1989054679870605,
    235            85.20904541015625,   88.94609069824219,  -91.03521728515625,
    236            31.4484920501709,    -29.31110954284668, -92.4477310180664,
    237            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
    238            53.064762115478516,  99.6537094116211,   -21.285049438476562,
    239            90.01982879638672,   18.32451820373535,  -33.06915283203125,
    240            30.097660064697266,  -74.21503448486328, 95.60974884033203,
    241            6.614287376403809,   31.2832088470459,   -53.206058502197266
    242          ],
    243          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    244        }
    245      },
    246      'operators': [{
    247        'name': 'abs',
    248        'arguments': [{'input': 'absInput'}],
    249        'outputs': 'absOutput'
    250      }],
    251      'expectedOutputs': {
    252        'absOutput': {
    253          'data': [
    254            49.837242126464844, 82.09291076660156, 3.1989054679870605,
    255            85.20904541015625,  88.94609069824219, 91.03521728515625,
    256            31.4484920501709,   29.31110954284668, 92.4477310180664,
    257            15.520709991455078, 80.91279602050781, 38.2097053527832,
    258            53.064762115478516, 99.6537094116211,  21.285049438476562,
    259            90.01982879638672,  18.32451820373535, 33.06915283203125,
    260            30.097660064697266, 74.21503448486328, 95.60974884033203,
    261            6.614287376403809,  31.2832088470459,  53.206058502197266
    262          ],
    263          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}
    264        }
    265      }
    266    }
    267  },
    268  {
    269    'name': 'abs float32 5D tensor',
    270    'graph': {
    271      'inputs': {
    272        'absInput': {
    273          'data': [
    274            49.837242126464844,  82.09291076660156,  3.1989054679870605,
    275            85.20904541015625,   88.94609069824219,  -91.03521728515625,
    276            31.4484920501709,    -29.31110954284668, -92.4477310180664,
    277            -15.520709991455078, 80.91279602050781,  -38.2097053527832,
    278            53.064762115478516,  99.6537094116211,   -21.285049438476562,
    279            90.01982879638672,   18.32451820373535,  -33.06915283203125,
    280            30.097660064697266,  -74.21503448486328, 95.60974884033203,
    281            6.614287376403809,   31.2832088470459,   -53.206058502197266
    282          ],
    283          'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float32'}
    284        }
    285      },
    286      'operators': [{
    287        'name': 'abs',
    288        'arguments': [{'input': 'absInput'}],
    289        'outputs': 'absOutput'
    290      }],
    291      'expectedOutputs': {
    292        'absOutput': {
    293          'data': [
    294            49.837242126464844, 82.09291076660156, 3.1989054679870605,
    295            85.20904541015625,  88.94609069824219, 91.03521728515625,
    296            31.4484920501709,   29.31110954284668, 92.4477310180664,
    297            15.520709991455078, 80.91279602050781, 38.2097053527832,
    298            53.064762115478516, 99.6537094116211,  21.285049438476562,
    299            90.01982879638672,  18.32451820373535, 33.06915283203125,
    300            30.097660064697266, 74.21503448486328, 95.60974884033203,
    301            6.614287376403809,  31.2832088470459,  53.206058502197266
    302          ],
    303          'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float32'}
    304        }
    305      }
    306    }
    307  },
    308 
    309  // float16 tests
    310  {
    311    'name': 'abs float16 positive 0D scalar',
    312    'graph': {
    313      'inputs': {
    314        'absInput':
    315            {'data': [49.84375], 'descriptor': {shape: [], dataType: 'float16'}}
    316      },
    317      'operators': [{
    318        'name': 'abs',
    319        'arguments': [{'input': 'absInput'}],
    320        'outputs': 'absOutput'
    321      }],
    322      'expectedOutputs': {
    323        'absOutput':
    324            {'data': [49.84375], 'descriptor': {shape: [], dataType: 'float16'}}
    325      }
    326    }
    327  },
    328  {
    329    'name': 'abs float16 negative 0D scalar',
    330    'graph': {
    331      'inputs': {
    332        'absInput':
    333            {'data': [-91.0625], 'descriptor': {shape: [], dataType: 'float16'}}
    334      },
    335      'operators': [{
    336        'name': 'abs',
    337        'arguments': [{'input': 'absInput'}],
    338        'outputs': 'absOutput'
    339      }],
    340      'expectedOutputs': {
    341        'absOutput':
    342            {'data': [91.0625], 'descriptor': {shape: [], dataType: 'float16'}}
    343      }
    344    }
    345  },
    346  {
    347    'name': 'abs float16 1D constant tensor',
    348    'graph': {
    349      'inputs': {
    350        'absInput': {
    351          'data': [
    352            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    353            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    354            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    355            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    356          ],
    357          'descriptor': {shape: [24], dataType: 'float16'},
    358          'constant': true
    359        }
    360      },
    361      'operators': [{
    362        'name': 'abs',
    363        'arguments': [{'input': 'absInput'}],
    364        'outputs': 'absOutput'
    365      }],
    366      'expectedOutputs': {
    367        'absOutput': {
    368          'data': [
    369            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    370            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    371            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    372            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    373          ],
    374          'descriptor': {shape: [24], dataType: 'float16'}
    375        }
    376      }
    377    }
    378  },
    379  {
    380    'name': 'abs float16 1D tensor',
    381    'graph': {
    382      'inputs': {
    383        'absInput': {
    384          'data': [
    385            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    386            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    387            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    388            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    389          ],
    390          'descriptor': {shape: [24], dataType: 'float16'}
    391        }
    392      },
    393      'operators': [{
    394        'name': 'abs',
    395        'arguments': [{'input': 'absInput'}],
    396        'outputs': 'absOutput'
    397      }],
    398      'expectedOutputs': {
    399        'absOutput': {
    400          'data': [
    401            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    402            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    403            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    404            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    405          ],
    406          'descriptor': {shape: [24], dataType: 'float16'}
    407        }
    408      }
    409    }
    410  },
    411  {
    412    'name': 'abs float16 2D tensor',
    413    'graph': {
    414      'inputs': {
    415        'absInput': {
    416          'data': [
    417            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    418            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    419            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    420            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    421          ],
    422          'descriptor': {shape: [4, 6], dataType: 'float16'}
    423        }
    424      },
    425      'operators': [{
    426        'name': 'abs',
    427        'arguments': [{'input': 'absInput'}],
    428        'outputs': 'absOutput'
    429      }],
    430      'expectedOutputs': {
    431        'absOutput': {
    432          'data': [
    433            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    434            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    435            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    436            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    437          ],
    438          'descriptor': {shape: [4, 6], dataType: 'float16'}
    439        }
    440      }
    441    }
    442  },
    443  {
    444    'name': 'abs float16 3D tensor',
    445    'graph': {
    446      'inputs': {
    447        'absInput': {
    448          'data': [
    449            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    450            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    451            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    452            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    453          ],
    454          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    455        }
    456      },
    457      'operators': [{
    458        'name': 'abs',
    459        'arguments': [{'input': 'absInput'}],
    460        'outputs': 'absOutput'
    461      }],
    462      'expectedOutputs': {
    463        'absOutput': {
    464          'data': [
    465            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    466            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    467            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    468            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    469          ],
    470          'descriptor': {shape: [2, 3, 4], dataType: 'float16'}
    471        }
    472      }
    473    }
    474  },
    475  {
    476    'name': 'abs float16 4D tensor',
    477    'graph': {
    478      'inputs': {
    479        'absInput': {
    480          'data': [
    481            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    482            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    483            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    484            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    485          ],
    486          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    487        }
    488      },
    489      'operators': [{
    490        'name': 'abs',
    491        'arguments': [{'input': 'absInput'}],
    492        'outputs': 'absOutput'
    493      }],
    494      'expectedOutputs': {
    495        'absOutput': {
    496          'data': [
    497            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    498            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    499            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    500            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    501          ],
    502          'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}
    503        }
    504      }
    505    }
    506  },
    507  {
    508    'name': 'abs float16 5D tensor',
    509    'graph': {
    510      'inputs': {
    511        'absInput': {
    512          'data': [
    513            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    514            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    515            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    516            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    517          ],
    518          'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'}
    519        }
    520      },
    521      'operators': [{
    522        'name': 'abs',
    523        'arguments': [{'input': 'absInput'}],
    524        'outputs': 'absOutput'
    525      }],
    526      'expectedOutputs': {
    527        'absOutput': {
    528          'data': [
    529            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    530            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    531            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    532            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    533          ],
    534          'descriptor': {shape: [2, 1, 4, 1, 3], dataType: 'float16'}
    535        }
    536      }
    537    }
    538  },
    539  {
    540    'name': 'abs float16 6D tensor',
    541    'graph': {
    542      'inputs': {
    543        'absInput': {
    544          'data': [
    545            49.84375,  82.0625,  3.19921875, 85.1875,     88.9375,   -91.0625,
    546            31.453125, -29.3125, -92.4375,   -15.5234375, 80.9375,   -38.21875,
    547            53.0625,   99.625,   -21.28125,  90,          18.328125, -33.0625,
    548            30.09375,  -74.1875, 95.625,     6.61328125,  31.28125,  -53.21875
    549          ],
    550          'descriptor': {shape: [2, 1, 4, 1, 3, 1], dataType: 'float16'}
    551        }
    552      },
    553      'operators': [{
    554        'name': 'abs',
    555        'arguments': [{'input': 'absInput'}],
    556        'outputs': 'absOutput'
    557      }],
    558      'expectedOutputs': {
    559        'absOutput': {
    560          'data': [
    561            49.84375,  82.0625, 3.19921875, 85.1875,    88.9375,   91.0625,
    562            31.453125, 29.3125, 92.4375,    15.5234375, 80.9375,   38.21875,
    563            53.0625,   99.625,  21.28125,   90,         18.328125, 33.0625,
    564            30.09375,  74.1875, 95.625,     6.61328125, 31.28125,  53.21875
    565          ],
    566          'descriptor': {shape: [2, 1, 4, 1, 3, 1], dataType: 'float16'}
    567        }
    568      }
    569    }
    570  },
    571 
    572  // int8 tests
    573  {
    574    'name': 'abs int8 4D tensor',
    575    'graph': {
    576      'inputs': {
    577        'absInput': {
    578          'data': [
    579            // int8 range: [/* -(2**7) */ -128, /* 2**7 - 1 */ 127]
    580            // abs(-128) would overflow when data type is int8
    581            -127, 0, 126, 127
    582          ],
    583          'descriptor': {shape: [1, 2, 2, 1], dataType: 'int8'}
    584        }
    585      },
    586      'operators': [{
    587        'name': 'abs',
    588        'arguments': [{'input': 'absInput'}],
    589        'outputs': 'absOutput'
    590      }],
    591      'expectedOutputs': {
    592        'absOutput': {
    593          'data': [127, 0, 126, 127],
    594          'descriptor': {shape: [1, 2, 2, 1], dataType: 'int8'}
    595        }
    596      }
    597    }
    598  },
    599 
    600  // int32 tests
    601  {
    602    'name': 'abs int32 4D tensor',
    603    'graph': {
    604      'inputs': {
    605        'absInput': {
    606          'data': [
    607            // int32 range: [/* -(2**31) */ -2147483648, /* 2**31 - 1 */ 2147483647]
    608            // abs(-2147483648) would overflow when data type is int32
    609            -2147483647, 0, 2147483646, 2147483647
    610          ],
    611          'descriptor': {shape: [1, 2, 2, 1], dataType: 'int32'}
    612        }
    613      },
    614      'operators': [{
    615        'name': 'abs',
    616        'arguments': [{'input': 'absInput'}],
    617        'outputs': 'absOutput'
    618      }],
    619      'expectedOutputs': {
    620        'absOutput': {
    621          'data': [2147483647, 0, 2147483646, 2147483647],
    622          'descriptor': {shape: [1, 2, 2, 1], dataType: 'int32'}
    623        }
    624      }
    625    }
    626  },
    627 
    628  // int64 tests
    629  {
    630    'name': 'abs int64 4D tensor',
    631    'graph': {
    632      'inputs': {
    633        'absInput': {
    634          'data': [
    635            // int64 range: [/* -(2**63) */ –9223372036854775808,
    636            //               /* 2**63 - 1 */ 92233720368547758087]
    637            BigInt(-(2 ** 63)) + 1n, -100n, 0n, 100n, BigInt(2 ** 63) - 1n
    638          ],
    639          'descriptor': {shape: [1, 1, 1, 5], dataType: 'int64'}
    640        }
    641      },
    642      'operators': [{
    643        'name': 'abs',
    644        'arguments': [{'input': 'absInput'}],
    645        'outputs': 'absOutput'
    646      }],
    647      'expectedOutputs': {
    648        'absOutput': {
    649          'data': [BigInt(2 ** 63) - 1n, 100n, 0n, 100n, BigInt(2 ** 63) - 1n],
    650          'descriptor': {shape: [1, 1, 1, 5], dataType: 'int64'}
    651        }
    652      }
    653    }
    654  }
    655 ];
    656 
    657 webnn_conformance_test(
    658    absTests, buildAndExecuteGraph, getAbsPrecisionTolerance);