tor-browser

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

split.https.any.js (34926B)


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