tor-browser

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

slice.https.any.js (22448B)


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