leaky_relu.https.any.js (30549B)
1 // META: title=test WebNN API leakyRelu 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-leakyrelu 12 // Calculate the leaky version of rectified linear function on the input tensor 13 // element-wise. The calculation follows the expression 14 // max(0, x) + alpha * min(0, x). 15 // 16 // dictionary MLLeakyReluOptions { 17 // double alpha = 0.01; 18 // }; 19 // 20 // MLOperand leakyRelu( 21 // MLOperand input, optional MLLeakyReluOptions options = {}); 22 23 const leakyReluTests = [ 24 { 25 'name': 'leakyRelu float32 1D constant tensor default options', 26 'graph': { 27 'inputs': { 28 'leakyReluInput': { 29 'data': [ 30 -19.053640365600586, 50.77590560913086, -69.54966735839844, 31 -80.57432556152344, -90.4011001586914, 76.02884674072266, 32 66.33873748779297, -84.10186767578125, -17.19101333618164, 33 -87.47624206542969, -3.416466474533081, -22.77235984802246, 34 -2.509489059448242, 18.933284759521484, 98.61402893066406, 35 55.3392333984375, -33.17860412597656, -46.03901290893555, 36 -61.47925567626953, 64.26514434814453, 21.469341278076172, 37 -31.514690399169922, -41.27694320678711, -65.59529113769531 38 ], 39 'descriptor': {shape: [24], dataType: 'float32'}, 40 'constant': true 41 } 42 }, 43 'operators': [{ 44 'name': 'leakyRelu', 45 'arguments': [{'input': 'leakyReluInput'}], 46 'outputs': 'leakyReluOutput' 47 }], 48 'expectedOutputs': { 49 'leakyReluOutput': { 50 'data': [ 51 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 52 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 53 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 54 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 55 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 56 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 57 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 58 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 59 ], 60 'descriptor': {shape: [24], dataType: 'float32'} 61 } 62 } 63 } 64 }, 65 { 66 'name': 'leakyRelu float32 0D tensor default options', 67 'graph': { 68 'inputs': { 69 'leakyReluInput': { 70 'data': [-19.053640365600586], 71 'descriptor': {shape: [], dataType: 'float32'} 72 } 73 }, 74 'operators': [{ 75 'name': 'leakyRelu', 76 'arguments': [{'input': 'leakyReluInput'}], 77 'outputs': 'leakyReluOutput' 78 }], 79 'expectedOutputs': { 80 'leakyReluOutput': { 81 'data': [-0.19053640961647034], 82 'descriptor': {shape: [], dataType: 'float32'} 83 } 84 } 85 } 86 }, 87 { 88 'name': 'leakyRelu float32 1D tensor default options', 89 'graph': { 90 'inputs': { 91 'leakyReluInput': { 92 'data': [ 93 -19.053640365600586, 50.77590560913086, -69.54966735839844, 94 -80.57432556152344, -90.4011001586914, 76.02884674072266, 95 66.33873748779297, -84.10186767578125, -17.19101333618164, 96 -87.47624206542969, -3.416466474533081, -22.77235984802246, 97 -2.509489059448242, 18.933284759521484, 98.61402893066406, 98 55.3392333984375, -33.17860412597656, -46.03901290893555, 99 -61.47925567626953, 64.26514434814453, 21.469341278076172, 100 -31.514690399169922, -41.27694320678711, -65.59529113769531 101 ], 102 'descriptor': {shape: [24], dataType: 'float32'} 103 } 104 }, 105 'operators': [{ 106 'name': 'leakyRelu', 107 'arguments': [{'input': 'leakyReluInput'}], 108 'outputs': 'leakyReluOutput' 109 }], 110 'expectedOutputs': { 111 'leakyReluOutput': { 112 'data': [ 113 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 114 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 115 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 116 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 117 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 118 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 119 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 120 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 121 ], 122 'descriptor': {shape: [24], dataType: 'float32'} 123 } 124 } 125 } 126 }, 127 { 128 'name': 'leakyRelu float32 2D tensor default options', 129 'graph': { 130 'inputs': { 131 'leakyReluInput': { 132 'data': [ 133 -19.053640365600586, 50.77590560913086, -69.54966735839844, 134 -80.57432556152344, -90.4011001586914, 76.02884674072266, 135 66.33873748779297, -84.10186767578125, -17.19101333618164, 136 -87.47624206542969, -3.416466474533081, -22.77235984802246, 137 -2.509489059448242, 18.933284759521484, 98.61402893066406, 138 55.3392333984375, -33.17860412597656, -46.03901290893555, 139 -61.47925567626953, 64.26514434814453, 21.469341278076172, 140 -31.514690399169922, -41.27694320678711, -65.59529113769531 141 ], 142 'descriptor': {shape: [4, 6], dataType: 'float32'} 143 } 144 }, 145 'operators': [{ 146 'name': 'leakyRelu', 147 'arguments': [{'input': 'leakyReluInput'}], 148 'outputs': 'leakyReluOutput' 149 }], 150 'expectedOutputs': { 151 'leakyReluOutput': { 152 'data': [ 153 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 154 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 155 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 156 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 157 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 158 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 159 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 160 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 161 ], 162 'descriptor': {shape: [4, 6], dataType: 'float32'} 163 } 164 } 165 } 166 }, 167 { 168 'name': 'leakyRelu float32 3D tensor default options', 169 'graph': { 170 'inputs': { 171 'leakyReluInput': { 172 'data': [ 173 -19.053640365600586, 50.77590560913086, -69.54966735839844, 174 -80.57432556152344, -90.4011001586914, 76.02884674072266, 175 66.33873748779297, -84.10186767578125, -17.19101333618164, 176 -87.47624206542969, -3.416466474533081, -22.77235984802246, 177 -2.509489059448242, 18.933284759521484, 98.61402893066406, 178 55.3392333984375, -33.17860412597656, -46.03901290893555, 179 -61.47925567626953, 64.26514434814453, 21.469341278076172, 180 -31.514690399169922, -41.27694320678711, -65.59529113769531 181 ], 182 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 183 } 184 }, 185 'operators': [{ 186 'name': 'leakyRelu', 187 'arguments': [{'input': 'leakyReluInput'}], 188 'outputs': 'leakyReluOutput' 189 }], 190 'expectedOutputs': { 191 'leakyReluOutput': { 192 'data': [ 193 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 194 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 195 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 196 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 197 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 198 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 199 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 200 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 201 ], 202 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 203 } 204 } 205 } 206 }, 207 { 208 'name': 'leakyRelu float32 4D tensor default options', 209 'graph': { 210 'inputs': { 211 'leakyReluInput': { 212 'data': [ 213 -19.053640365600586, 50.77590560913086, -69.54966735839844, 214 -80.57432556152344, -90.4011001586914, 76.02884674072266, 215 66.33873748779297, -84.10186767578125, -17.19101333618164, 216 -87.47624206542969, -3.416466474533081, -22.77235984802246, 217 -2.509489059448242, 18.933284759521484, 98.61402893066406, 218 55.3392333984375, -33.17860412597656, -46.03901290893555, 219 -61.47925567626953, 64.26514434814453, 21.469341278076172, 220 -31.514690399169922, -41.27694320678711, -65.59529113769531 221 ], 222 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 223 } 224 }, 225 'operators': [{ 226 'name': 'leakyRelu', 227 'arguments': [{'input': 'leakyReluInput'}], 228 'outputs': 'leakyReluOutput' 229 }], 230 'expectedOutputs': { 231 'leakyReluOutput': { 232 'data': [ 233 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 234 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 235 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 236 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 237 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 238 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 239 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 240 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 241 ], 242 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 243 } 244 } 245 } 246 }, 247 { 248 'name': 'leakyRelu float32 5D tensor default options', 249 'graph': { 250 'inputs': { 251 'leakyReluInput': { 252 'data': [ 253 -19.053640365600586, 50.77590560913086, -69.54966735839844, 254 -80.57432556152344, -90.4011001586914, 76.02884674072266, 255 66.33873748779297, -84.10186767578125, -17.19101333618164, 256 -87.47624206542969, -3.416466474533081, -22.77235984802246, 257 -2.509489059448242, 18.933284759521484, 98.61402893066406, 258 55.3392333984375, -33.17860412597656, -46.03901290893555, 259 -61.47925567626953, 64.26514434814453, 21.469341278076172, 260 -31.514690399169922, -41.27694320678711, -65.59529113769531 261 ], 262 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 263 } 264 }, 265 'operators': [{ 266 'name': 'leakyRelu', 267 'arguments': [{'input': 'leakyReluInput'}], 268 'outputs': 'leakyReluOutput' 269 }], 270 'expectedOutputs': { 271 'leakyReluOutput': { 272 'data': [ 273 -0.19053640961647034, 50.77590560913086, -0.695496678352356, 274 -0.8057432770729065, -0.9040110111236572, 76.02884674072266, 275 66.33873748779297, -0.8410186767578125, -0.1719101369380951, 276 -0.8747624158859253, -0.0341646634042263, -0.2277235984802246, 277 -0.02509489096701145, 18.933284759521484, 98.61402893066406, 278 55.3392333984375, -0.33178603649139404, -0.4603901207447052, 279 -0.6147925853729248, 64.26514434814453, 21.469341278076172, 280 -0.31514689326286316, -0.4127694368362427, -0.6559529304504395 281 ], 282 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 283 } 284 } 285 } 286 }, 287 { 288 'name': 'leakyRelu float32 1D tensor negative options.alpha', 289 'graph': { 290 'inputs': { 291 'leakyReluInput': { 292 'data': [ 293 -19.053640365600586, 50.77590560913086, -69.54966735839844, 294 -80.57432556152344, -90.4011001586914, 76.02884674072266, 295 66.33873748779297, -84.10186767578125, -17.19101333618164, 296 -87.47624206542969, -3.416466474533081, -22.77235984802246, 297 -2.509489059448242, 18.933284759521484, 98.61402893066406, 298 55.3392333984375, -33.17860412597656, -46.03901290893555, 299 -61.47925567626953, 64.26514434814453, 21.469341278076172, 300 -31.514690399169922, -41.27694320678711, -65.59529113769531 301 ], 302 'descriptor': {shape: [24], dataType: 'float32'} 303 } 304 }, 305 'operators': [{ 306 'name': 'leakyRelu', 307 'arguments': [ 308 {'input': 'leakyReluInput'}, 309 {'options': {'alpha': -97.70109193608776}} 310 ], 311 'outputs': 'leakyReluOutput' 312 }], 313 'expectedOutputs': { 314 'leakyReluOutput': { 315 'data': [ 316 1861.5615234375, 50.77590560913086, 6795.07861328125, 317 7872.19970703125, 8832.2861328125, 76.02884674072266, 318 66.33873748779297, 8216.8447265625, 1679.580810546875, 319 8546.5244140625, 333.7925109863281, 2224.884521484375, 320 245.17982482910156, 18.933284759521484, 98.61402893066406, 321 55.3392333984375, 3241.5859375, 4498.06201171875, 322 6006.5908203125, 64.26514434814453, 21.469341278076172, 323 3079.019775390625, 4032.802490234375, 6408.73193359375 324 ], 325 'descriptor': {shape: [24], dataType: 'float32'} 326 } 327 } 328 } 329 }, 330 { 331 'name': 'leakyRelu float32 2D tensor positive options.alpha', 332 'graph': { 333 'inputs': { 334 'leakyReluInput': { 335 'data': [ 336 -19.053640365600586, 50.77590560913086, -69.54966735839844, 337 -80.57432556152344, -90.4011001586914, 76.02884674072266, 338 66.33873748779297, -84.10186767578125, -17.19101333618164, 339 -87.47624206542969, -3.416466474533081, -22.77235984802246, 340 -2.509489059448242, 18.933284759521484, 98.61402893066406, 341 55.3392333984375, -33.17860412597656, -46.03901290893555, 342 -61.47925567626953, 64.26514434814453, 21.469341278076172, 343 -31.514690399169922, -41.27694320678711, -65.59529113769531 344 ], 345 'descriptor': {shape: [4, 6], dataType: 'float32'} 346 } 347 }, 348 'operators': [{ 349 'name': 'leakyRelu', 350 'arguments': [ 351 {'input': 'leakyReluInput'}, 352 {'options': {'alpha': 35.799162942273234}} 353 ], 354 'outputs': 'leakyReluOutput' 355 }], 356 'expectedOutputs': { 357 'leakyReluOutput': { 358 'data': [ 359 -682.1043701171875, 50.77590560913086, -2489.81982421875, 360 -2884.493408203125, -3236.28369140625, 76.02884674072266, 361 66.33873748779297, -3010.776611328125, -615.4238891601562, 362 -3131.576416015625, -122.306640625, -815.2314453125, 363 -89.83760833740234, 18.933284759521484, 98.61402893066406, 364 55.3392333984375, -1187.7662353515625, -1648.158203125, 365 -2200.906005859375, 64.26514434814453, 21.469341278076172, 366 -1128.1995849609375, -1477.6800537109375, -2348.256591796875 367 ], 368 'descriptor': {shape: [4, 6], dataType: 'float32'} 369 } 370 } 371 } 372 }, 373 { 374 'name': 'leakyRelu float32 5D tensor options.alpha=0.0', 375 'graph': { 376 'inputs': { 377 'leakyReluInput': { 378 'data': [ 379 -19.053640365600586, 50.77590560913086, -69.54966735839844, 380 -80.57432556152344, -90.4011001586914, 76.02884674072266, 381 66.33873748779297, -84.10186767578125, -17.19101333618164, 382 -87.47624206542969, -3.416466474533081, -22.77235984802246, 383 -2.509489059448242, 18.933284759521484, 98.61402893066406, 384 55.3392333984375, -33.17860412597656, -46.03901290893555, 385 -61.47925567626953, 64.26514434814453, 21.469341278076172, 386 -31.514690399169922, -41.27694320678711, -65.59529113769531 387 ], 388 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 389 } 390 }, 391 'operators': [{ 392 'name': 'leakyRelu', 393 'arguments': [{'input': 'leakyReluInput'}, {'options': {'alpha': 0}}], 394 'outputs': 'leakyReluOutput' 395 }], 396 'expectedOutputs': { 397 'leakyReluOutput': { 398 'data': [ 399 0, 400 50.77590560913086, 401 0, 402 0, 403 0, 404 76.02884674072266, 405 66.33873748779297, 406 0, 407 0, 408 0, 409 0, 410 0, 411 0, 412 18.933284759521484, 413 98.61402893066406, 414 55.3392333984375, 415 0, 416 0, 417 0, 418 64.26514434814453, 419 21.469341278076172, 420 0, 421 0, 422 0 423 ], 424 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 425 } 426 } 427 } 428 }, 429 430 // float16 tests 431 { 432 'name': 'leakyRelu float16 1D constant tensor default options', 433 'graph': { 434 'inputs': { 435 'leakyReluInput': { 436 'data': [ 437 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 438 76, 66.3125, -84.125, -17.1875, -87.5, 439 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 440 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 441 21.46875, -31.515625, -41.28125, -65.625 442 ], 443 'descriptor': {shape: [24], dataType: 'float16'}, 444 'constant': true 445 } 446 }, 447 'operators': [{ 448 'name': 'leakyRelu', 449 'arguments': [{'input': 'leakyReluInput'}], 450 'outputs': 'leakyReluOutput' 451 }], 452 'expectedOutputs': { 453 'leakyReluOutput': { 454 'data': [ 455 -0.1904296875, 456 50.78125, 457 -0.69580078125, 458 -0.8056640625, 459 -0.90380859375, 460 76, 461 66.3125, 462 -0.84130859375, 463 -0.171875, 464 -0.875, 465 -0.034149169921875, 466 -0.2276611328125, 467 -0.0251007080078125, 468 18.9375, 469 98.625, 470 55.34375, 471 -0.331787109375, 472 -0.460205078125, 473 -0.61474609375, 474 64.25, 475 21.46875, 476 -0.315185546875, 477 -0.412841796875, 478 -0.65625 479 ], 480 'descriptor': {shape: [24], dataType: 'float16'} 481 } 482 } 483 } 484 }, 485 { 486 'name': 'leakyRelu float16 0D tensor default options', 487 'graph': { 488 'inputs': { 489 'leakyReluInput': { 490 'data': [-19.046875], 491 'descriptor': {shape: [], dataType: 'float16'} 492 } 493 }, 494 'operators': [{ 495 'name': 'leakyRelu', 496 'arguments': [{'input': 'leakyReluInput'}], 497 'outputs': 'leakyReluOutput' 498 }], 499 'expectedOutputs': { 500 'leakyReluOutput': { 501 'data': [-0.1904296875], 502 'descriptor': {shape: [], dataType: 'float16'} 503 } 504 } 505 } 506 }, 507 { 508 'name': 'leakyRelu float16 1D tensor default options', 509 'graph': { 510 'inputs': { 511 'leakyReluInput': { 512 'data': [ 513 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 514 76, 66.3125, -84.125, -17.1875, -87.5, 515 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 516 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 517 21.46875, -31.515625, -41.28125, -65.625 518 ], 519 'descriptor': {shape: [24], dataType: 'float16'} 520 } 521 }, 522 'operators': [{ 523 'name': 'leakyRelu', 524 'arguments': [{'input': 'leakyReluInput'}], 525 'outputs': 'leakyReluOutput' 526 }], 527 'expectedOutputs': { 528 'leakyReluOutput': { 529 'data': [ 530 -0.1904296875, 531 50.78125, 532 -0.69580078125, 533 -0.8056640625, 534 -0.90380859375, 535 76, 536 66.3125, 537 -0.84130859375, 538 -0.171875, 539 -0.875, 540 -0.034149169921875, 541 -0.2276611328125, 542 -0.0251007080078125, 543 18.9375, 544 98.625, 545 55.34375, 546 -0.331787109375, 547 -0.460205078125, 548 -0.61474609375, 549 64.25, 550 21.46875, 551 -0.315185546875, 552 -0.412841796875, 553 -0.65625 554 ], 555 'descriptor': {shape: [24], dataType: 'float16'} 556 } 557 } 558 } 559 }, 560 { 561 'name': 'leakyRelu float16 2D tensor default options', 562 'graph': { 563 'inputs': { 564 'leakyReluInput': { 565 'data': [ 566 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 567 76, 66.3125, -84.125, -17.1875, -87.5, 568 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 569 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 570 21.46875, -31.515625, -41.28125, -65.625 571 ], 572 'descriptor': {shape: [4, 6], dataType: 'float16'} 573 } 574 }, 575 'operators': [{ 576 'name': 'leakyRelu', 577 'arguments': [{'input': 'leakyReluInput'}], 578 'outputs': 'leakyReluOutput' 579 }], 580 'expectedOutputs': { 581 'leakyReluOutput': { 582 'data': [ 583 -0.1904296875, 584 50.78125, 585 -0.69580078125, 586 -0.8056640625, 587 -0.90380859375, 588 76, 589 66.3125, 590 -0.84130859375, 591 -0.171875, 592 -0.875, 593 -0.034149169921875, 594 -0.2276611328125, 595 -0.0251007080078125, 596 18.9375, 597 98.625, 598 55.34375, 599 -0.331787109375, 600 -0.460205078125, 601 -0.61474609375, 602 64.25, 603 21.46875, 604 -0.315185546875, 605 -0.412841796875, 606 -0.65625 607 ], 608 'descriptor': {shape: [4, 6], dataType: 'float16'} 609 } 610 } 611 } 612 }, 613 { 614 'name': 'leakyRelu float16 3D tensor default options', 615 'graph': { 616 'inputs': { 617 'leakyReluInput': { 618 'data': [ 619 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 620 76, 66.3125, -84.125, -17.1875, -87.5, 621 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 622 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 623 21.46875, -31.515625, -41.28125, -65.625 624 ], 625 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 626 } 627 }, 628 'operators': [{ 629 'name': 'leakyRelu', 630 'arguments': [{'input': 'leakyReluInput'}], 631 'outputs': 'leakyReluOutput' 632 }], 633 'expectedOutputs': { 634 'leakyReluOutput': { 635 'data': [ 636 -0.1904296875, 637 50.78125, 638 -0.69580078125, 639 -0.8056640625, 640 -0.90380859375, 641 76, 642 66.3125, 643 -0.84130859375, 644 -0.171875, 645 -0.875, 646 -0.034149169921875, 647 -0.2276611328125, 648 -0.0251007080078125, 649 18.9375, 650 98.625, 651 55.34375, 652 -0.331787109375, 653 -0.460205078125, 654 -0.61474609375, 655 64.25, 656 21.46875, 657 -0.315185546875, 658 -0.412841796875, 659 -0.65625 660 ], 661 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 662 } 663 } 664 } 665 }, 666 { 667 'name': 'leakyRelu float16 4D tensor default options', 668 'graph': { 669 'inputs': { 670 'leakyReluInput': { 671 'data': [ 672 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 673 76, 66.3125, -84.125, -17.1875, -87.5, 674 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 675 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 676 21.46875, -31.515625, -41.28125, -65.625 677 ], 678 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 679 } 680 }, 681 'operators': [{ 682 'name': 'leakyRelu', 683 'arguments': [{'input': 'leakyReluInput'}], 684 'outputs': 'leakyReluOutput' 685 }], 686 'expectedOutputs': { 687 'leakyReluOutput': { 688 'data': [ 689 -0.1904296875, 690 50.78125, 691 -0.69580078125, 692 -0.8056640625, 693 -0.90380859375, 694 76, 695 66.3125, 696 -0.84130859375, 697 -0.171875, 698 -0.875, 699 -0.034149169921875, 700 -0.2276611328125, 701 -0.0251007080078125, 702 18.9375, 703 98.625, 704 55.34375, 705 -0.331787109375, 706 -0.460205078125, 707 -0.61474609375, 708 64.25, 709 21.46875, 710 -0.315185546875, 711 -0.412841796875, 712 -0.65625 713 ], 714 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 715 } 716 } 717 } 718 }, 719 { 720 'name': 'leakyRelu float16 5D tensor default options', 721 'graph': { 722 'inputs': { 723 'leakyReluInput': { 724 'data': [ 725 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 726 76, 66.3125, -84.125, -17.1875, -87.5, 727 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 728 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 729 21.46875, -31.515625, -41.28125, -65.625 730 ], 731 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 732 } 733 }, 734 'operators': [{ 735 'name': 'leakyRelu', 736 'arguments': [{'input': 'leakyReluInput'}], 737 'outputs': 'leakyReluOutput' 738 }], 739 'expectedOutputs': { 740 'leakyReluOutput': { 741 'data': [ 742 -0.1904296875, 743 50.78125, 744 -0.69580078125, 745 -0.8056640625, 746 -0.90380859375, 747 76, 748 66.3125, 749 -0.84130859375, 750 -0.171875, 751 -0.875, 752 -0.034149169921875, 753 -0.2276611328125, 754 -0.0251007080078125, 755 18.9375, 756 98.625, 757 55.34375, 758 -0.331787109375, 759 -0.460205078125, 760 -0.61474609375, 761 64.25, 762 21.46875, 763 -0.315185546875, 764 -0.412841796875, 765 -0.65625 766 ], 767 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 768 } 769 } 770 } 771 }, 772 { 773 'name': 'leakyRelu float16 1D tensor negative options.alpha', 774 'graph': { 775 'inputs': { 776 'leakyReluInput': { 777 'data': [ 778 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 779 76, 66.3125, -84.125, -17.1875, -87.5, 780 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 781 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 782 21.46875, -31.515625, -41.28125, -65.625 783 ], 784 'descriptor': {shape: [24], dataType: 'float16'} 785 } 786 }, 787 'operators': [{ 788 'name': 'leakyRelu', 789 'arguments': [ 790 {'input': 'leakyReluInput'}, 791 {'options': {'alpha': -97.70109193608776}} 792 ], 793 'outputs': 'leakyReluOutput' 794 }], 795 'expectedOutputs': { 796 'leakyReluOutput': { 797 'data': [ 798 1861, 50.78125, 6796, 7872, 8832, 76, 66.3125, 8216, 799 1679, 8552, 333.75, 2224, 245.25, 18.9375, 98.625, 55.34375, 800 3242, 4496, 6004, 64.25, 21.46875, 3080, 4034, 6412 801 ], 802 'descriptor': {shape: [24], dataType: 'float16'} 803 } 804 } 805 } 806 }, 807 { 808 'name': 'leakyRelu float16 2D tensor positive options.alpha', 809 'graph': { 810 'inputs': { 811 'leakyReluInput': { 812 'data': [ 813 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 814 76, 66.3125, -84.125, -17.1875, -87.5, 815 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 816 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 817 21.46875, -31.515625, -41.28125, -65.625 818 ], 819 'descriptor': {shape: [4, 6], dataType: 'float16'} 820 } 821 }, 822 'operators': [{ 823 'name': 'leakyRelu', 824 'arguments': [ 825 {'input': 'leakyReluInput'}, 826 {'options': {'alpha': 35.799162942273234}} 827 ], 828 'outputs': 'leakyReluOutput' 829 }], 830 'expectedOutputs': { 831 'leakyReluOutput': { 832 'data': [ 833 -682, 50.78125, -2490, -2884, -3236, 76, 834 66.3125, -3012, -615.5, -3132, -122.3125, -815, 835 -89.875, 18.9375, 98.625, 55.34375, -1188, -1648, 836 -2200, 64.25, 21.46875, -1128, -1478, -2350 837 ], 838 'descriptor': {shape: [4, 6], dataType: 'float16'} 839 } 840 } 841 } 842 }, 843 { 844 'name': 'leakyRelu float16 5D tensor options.alpha=0.0', 845 'graph': { 846 'inputs': { 847 'leakyReluInput': { 848 'data': [ 849 -19.046875, 50.78125, -69.5625, -80.5625, -90.375, 850 76, 66.3125, -84.125, -17.1875, -87.5, 851 -3.416015625, -22.765625, -2.509765625, 18.9375, 98.625, 852 55.34375, -33.1875, -46.03125, -61.46875, 64.25, 853 21.46875, -31.515625, -41.28125, -65.625 854 ], 855 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 856 } 857 }, 858 'operators': [{ 859 'name': 'leakyRelu', 860 'arguments': [{'input': 'leakyReluInput'}, {'options': {'alpha': 0}}], 861 'outputs': 'leakyReluOutput' 862 }], 863 'expectedOutputs': { 864 'leakyReluOutput': { 865 'data': [ 866 0, 50.78125, 0, 0, 0, 76, 66.3125, 0, 867 0, 0, 0, 0, 0, 18.9375, 98.625, 55.34375, 868 0, 0, 0, 64.25, 21.46875, 0, 0, 0 869 ], 870 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 871 } 872 } 873 } 874 } 875 ]; 876 877 webnn_conformance_test( 878 leakyReluTests, buildAndExecuteGraph, getPrecisionTolerance);