prelu.https.any.js (51138B)
1 // META: title=test WebNN API prelu 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-prelu 12 // Calculate the parametric version of rectified linear function (Parametric 13 // ReLU) on the input tensor element-wise. The calculation follows the 14 // expression max(0, x) + slope * min(0, x). 15 // 16 // MLOperand prelu(MLOperand input, MLOperand slope); 17 18 const preluTests = [ 19 { 20 'name': 'prelu float32 0D scalar', 21 'graph': { 22 'inputs': { 23 'preluInput': { 24 'data': [-4.794857501983643], 25 'descriptor': {shape: [], dataType: 'float32'} 26 }, 27 'preluSlope': { 28 'data': [1.1202747821807861], 29 'descriptor': {shape: [], dataType: 'float32'}, 30 'constant': true 31 } 32 }, 33 'operators': [{ 34 'name': 'prelu', 35 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 36 'outputs': 'preluOutput' 37 }], 38 'expectedOutputs': { 39 'preluOutput': { 40 'data': [-5.371557712554932], 41 'descriptor': {shape: [], dataType: 'float32'} 42 } 43 } 44 } 45 }, 46 { 47 'name': 'prelu float32 1D constant tensors', 48 'graph': { 49 'inputs': { 50 'preluInput': { 51 'data': [ 52 -2.549168109893799, -4.794857501983643, 8.413617134094238, 53 6.108623504638672, -8.492292404174805, 3.3143365383148193, 54 1.1687211990356445, -0.141762837767601, -6.714652061462402, 55 5.787421703338623, -3.755627393722534, -4.89828634262085, 56 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 57 9.439736366271973, -2.558180093765259, -8.658834457397461, 58 8.47507381439209, 4.551425457000732, -9.267870903015137, 59 -0.262177437543869, 1.3258955478668213, -7.41831111907959 60 ], 61 'descriptor': {shape: [24], dataType: 'float32'}, 62 'constant': true 63 }, 64 'preluSlope': { 65 'data': [ 66 9.343092918395996, 0.2800687253475189, -4.617084980010986, 67 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 68 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 69 3.5725347995758057, 6.861966609954834, -1.961531400680542, 70 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 71 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 72 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 73 4.155889987945557, -1.799522042274475, 9.295849800109863 74 ], 75 'descriptor': {shape: [24], dataType: 'float32'}, 76 'constant': true 77 } 78 }, 79 'operators': [{ 80 'name': 'prelu', 81 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 82 'outputs': 'preluOutput' 83 }], 84 'expectedOutputs': { 85 'preluOutput': { 86 'data': [ 87 -23.817113876342773, -1.342889666557312, 8.413617134094238, 88 6.108623504638672, 12.173455238342285, 3.3143365383148193, 89 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 90 5.787421703338623, -25.7709903717041, 9.608142852783203, 91 7.3295159339904785, -10.535453796386719, 7.067296981811523, 92 9.439736366271973, 14.083043098449707, 20.718313217163086, 93 8.47507381439209, 4.551425457000732, 18.365745544433594, 94 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 95 ], 96 'descriptor': {shape: [24], dataType: 'float32'} 97 } 98 } 99 } 100 }, 101 { 102 'name': 'prelu float32 1D tensors', 103 'graph': { 104 'inputs': { 105 'preluInput': { 106 'data': [ 107 -2.549168109893799, -4.794857501983643, 8.413617134094238, 108 6.108623504638672, -8.492292404174805, 3.3143365383148193, 109 1.1687211990356445, -0.141762837767601, -6.714652061462402, 110 5.787421703338623, -3.755627393722534, -4.89828634262085, 111 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 112 9.439736366271973, -2.558180093765259, -8.658834457397461, 113 8.47507381439209, 4.551425457000732, -9.267870903015137, 114 -0.262177437543869, 1.3258955478668213, -7.41831111907959 115 ], 116 'descriptor': {shape: [24], dataType: 'float32'} 117 }, 118 'preluSlope': { 119 'data': [ 120 9.343092918395996, 0.2800687253475189, -4.617084980010986, 121 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 122 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 123 3.5725347995758057, 6.861966609954834, -1.961531400680542, 124 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 125 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 126 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 127 4.155889987945557, -1.799522042274475, 9.295849800109863 128 ], 129 'descriptor': {shape: [24], dataType: 'float32'}, 130 'constant': true 131 } 132 }, 133 'operators': [{ 134 'name': 'prelu', 135 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 136 'outputs': 'preluOutput' 137 }], 138 'expectedOutputs': { 139 'preluOutput': { 140 'data': [ 141 -23.817113876342773, -1.342889666557312, 8.413617134094238, 142 6.108623504638672, 12.173455238342285, 3.3143365383148193, 143 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 144 5.787421703338623, -25.7709903717041, 9.608142852783203, 145 7.3295159339904785, -10.535453796386719, 7.067296981811523, 146 9.439736366271973, 14.083043098449707, 20.718313217163086, 147 8.47507381439209, 4.551425457000732, 18.365745544433594, 148 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 149 ], 150 'descriptor': {shape: [24], dataType: 'float32'} 151 } 152 } 153 } 154 }, 155 { 156 'name': 'prelu float32 1D non-constant slope', 157 'graph': { 158 'inputs': { 159 'preluInput': { 160 'data': [ 161 -2.549168109893799, -4.794857501983643, 8.413617134094238, 162 6.108623504638672, -8.492292404174805, 3.3143365383148193, 163 1.1687211990356445, -0.141762837767601, -6.714652061462402, 164 5.787421703338623, -3.755627393722534, -4.89828634262085, 165 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 166 9.439736366271973, -2.558180093765259, -8.658834457397461, 167 8.47507381439209, 4.551425457000732, -9.267870903015137, 168 -0.262177437543869, 1.3258955478668213, -7.41831111907959 169 ], 170 'descriptor': {shape: [24], dataType: 'float32'} 171 }, 172 'preluSlope': { 173 'data': [ 174 9.343092918395996, 0.2800687253475189, -4.617084980010986, 175 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 176 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 177 3.5725347995758057, 6.861966609954834, -1.961531400680542, 178 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 179 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 180 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 181 4.155889987945557, -1.799522042274475, 9.295849800109863 182 ], 183 'descriptor': {shape: [24], dataType: 'float32'} 184 } 185 }, 186 'operators': [{ 187 'name': 'prelu', 188 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 189 'outputs': 'preluOutput' 190 }], 191 'expectedOutputs': { 192 'preluOutput': { 193 'data': [ 194 -23.817113876342773, -1.342889666557312, 8.413617134094238, 195 6.108623504638672, 12.173455238342285, 3.3143365383148193, 196 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 197 5.787421703338623, -25.7709903717041, 9.608142852783203, 198 7.3295159339904785, -10.535453796386719, 7.067296981811523, 199 9.439736366271973, 14.083043098449707, 20.718313217163086, 200 8.47507381439209, 4.551425457000732, 18.365745544433594, 201 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 202 ], 203 'descriptor': {shape: [24], dataType: 'float32'} 204 } 205 } 206 } 207 }, 208 { 209 'name': 'prelu float32 2D tensors', 210 'graph': { 211 'inputs': { 212 'preluInput': { 213 'data': [ 214 -2.549168109893799, -4.794857501983643, 8.413617134094238, 215 6.108623504638672, -8.492292404174805, 3.3143365383148193, 216 1.1687211990356445, -0.141762837767601, -6.714652061462402, 217 5.787421703338623, -3.755627393722534, -4.89828634262085, 218 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 219 9.439736366271973, -2.558180093765259, -8.658834457397461, 220 8.47507381439209, 4.551425457000732, -9.267870903015137, 221 -0.262177437543869, 1.3258955478668213, -7.41831111907959 222 ], 223 'descriptor': {shape: [4, 6], dataType: 'float32'} 224 }, 225 'preluSlope': { 226 'data': [ 227 9.343092918395996, 0.2800687253475189, -4.617084980010986, 228 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 229 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 230 3.5725347995758057, 6.861966609954834, -1.961531400680542, 231 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 232 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 233 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 234 4.155889987945557, -1.799522042274475, 9.295849800109863 235 ], 236 'descriptor': {shape: [4, 6], dataType: 'float32'}, 237 'constant': true 238 } 239 }, 240 'operators': [{ 241 'name': 'prelu', 242 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 243 'outputs': 'preluOutput' 244 }], 245 'expectedOutputs': { 246 'preluOutput': { 247 'data': [ 248 -23.817113876342773, -1.342889666557312, 8.413617134094238, 249 6.108623504638672, 12.173455238342285, 3.3143365383148193, 250 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 251 5.787421703338623, -25.7709903717041, 9.608142852783203, 252 7.3295159339904785, -10.535453796386719, 7.067296981811523, 253 9.439736366271973, 14.083043098449707, 20.718313217163086, 254 8.47507381439209, 4.551425457000732, 18.365745544433594, 255 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 256 ], 257 'descriptor': {shape: [4, 6], dataType: 'float32'} 258 } 259 } 260 } 261 }, 262 { 263 'name': 'prelu float32 3D tensors', 264 'graph': { 265 'inputs': { 266 'preluInput': { 267 'data': [ 268 -2.549168109893799, -4.794857501983643, 8.413617134094238, 269 6.108623504638672, -8.492292404174805, 3.3143365383148193, 270 1.1687211990356445, -0.141762837767601, -6.714652061462402, 271 5.787421703338623, -3.755627393722534, -4.89828634262085, 272 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 273 9.439736366271973, -2.558180093765259, -8.658834457397461, 274 8.47507381439209, 4.551425457000732, -9.267870903015137, 275 -0.262177437543869, 1.3258955478668213, -7.41831111907959 276 ], 277 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 278 }, 279 'preluSlope': { 280 'data': [ 281 9.343092918395996, 0.2800687253475189, -4.617084980010986, 282 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 283 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 284 3.5725347995758057, 6.861966609954834, -1.961531400680542, 285 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 286 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 287 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 288 4.155889987945557, -1.799522042274475, 9.295849800109863 289 ], 290 'descriptor': {shape: [2, 3, 4], dataType: 'float32'}, 291 'constant': true 292 } 293 }, 294 'operators': [{ 295 'name': 'prelu', 296 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 297 'outputs': 'preluOutput' 298 }], 299 'expectedOutputs': { 300 'preluOutput': { 301 'data': [ 302 -23.817113876342773, -1.342889666557312, 8.413617134094238, 303 6.108623504638672, 12.173455238342285, 3.3143365383148193, 304 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 305 5.787421703338623, -25.7709903717041, 9.608142852783203, 306 7.3295159339904785, -10.535453796386719, 7.067296981811523, 307 9.439736366271973, 14.083043098449707, 20.718313217163086, 308 8.47507381439209, 4.551425457000732, 18.365745544433594, 309 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 310 ], 311 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 312 } 313 } 314 } 315 }, 316 { 317 'name': 'prelu float32 4D tensors', 318 'graph': { 319 'inputs': { 320 'preluInput': { 321 'data': [ 322 -2.549168109893799, -4.794857501983643, 8.413617134094238, 323 6.108623504638672, -8.492292404174805, 3.3143365383148193, 324 1.1687211990356445, -0.141762837767601, -6.714652061462402, 325 5.787421703338623, -3.755627393722534, -4.89828634262085, 326 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 327 9.439736366271973, -2.558180093765259, -8.658834457397461, 328 8.47507381439209, 4.551425457000732, -9.267870903015137, 329 -0.262177437543869, 1.3258955478668213, -7.41831111907959 330 ], 331 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 332 }, 333 'preluSlope': { 334 'data': [ 335 9.343092918395996, 0.2800687253475189, -4.617084980010986, 336 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 337 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 338 3.5725347995758057, 6.861966609954834, -1.961531400680542, 339 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 340 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 341 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 342 4.155889987945557, -1.799522042274475, 9.295849800109863 343 ], 344 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'}, 345 'constant': true 346 } 347 }, 348 'operators': [{ 349 'name': 'prelu', 350 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 351 'outputs': 'preluOutput' 352 }], 353 'expectedOutputs': { 354 'preluOutput': { 355 'data': [ 356 -23.817113876342773, -1.342889666557312, 8.413617134094238, 357 6.108623504638672, 12.173455238342285, 3.3143365383148193, 358 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 359 5.787421703338623, -25.7709903717041, 9.608142852783203, 360 7.3295159339904785, -10.535453796386719, 7.067296981811523, 361 9.439736366271973, 14.083043098449707, 20.718313217163086, 362 8.47507381439209, 4.551425457000732, 18.365745544433594, 363 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 364 ], 365 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 366 } 367 } 368 } 369 }, 370 { 371 'name': 'prelu float32 5D tensors', 372 'graph': { 373 'inputs': { 374 'preluInput': { 375 'data': [ 376 -2.549168109893799, -4.794857501983643, 8.413617134094238, 377 6.108623504638672, -8.492292404174805, 3.3143365383148193, 378 1.1687211990356445, -0.141762837767601, -6.714652061462402, 379 5.787421703338623, -3.755627393722534, -4.89828634262085, 380 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 381 9.439736366271973, -2.558180093765259, -8.658834457397461, 382 8.47507381439209, 4.551425457000732, -9.267870903015137, 383 -0.262177437543869, 1.3258955478668213, -7.41831111907959 384 ], 385 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 386 }, 387 'preluSlope': { 388 'data': [ 389 9.343092918395996, 0.2800687253475189, -4.617084980010986, 390 1.1202747821807861, -1.4334710836410522, -3.157594919204712, 391 -6.28995418548584, -5.0107879638671875, -6.899077415466309, 392 3.5725347995758057, 6.861966609954834, -1.961531400680542, 393 4.5832037925720215, 2.6643502712249756, 9.192955017089844, 394 -9.554699897766113, -5.505102157592773, -2.3927369117736816, 395 3.58212947845459, -2.3224003314971924, -1.9816573858261108, 396 4.155889987945557, -1.799522042274475, 9.295849800109863 397 ], 398 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'}, 399 'constant': true 400 } 401 }, 402 'operators': [{ 403 'name': 'prelu', 404 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 405 'outputs': 'preluOutput' 406 }], 407 'expectedOutputs': { 408 'preluOutput': { 409 'data': [ 410 -23.817113876342773, -1.342889666557312, 8.413617134094238, 411 6.108623504638672, 12.173455238342285, 3.3143365383148193, 412 1.1687211990356445, 0.7103435397148132, 46.32490539550781, 413 5.787421703338623, -25.7709903717041, 9.608142852783203, 414 7.3295159339904785, -10.535453796386719, 7.067296981811523, 415 9.439736366271973, 14.083043098449707, 20.718313217163086, 416 8.47507381439209, 4.551425457000732, 18.365745544433594, 417 -1.0895805358886719, 1.3258955478668213, -68.95950317382812 418 ], 419 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float32'} 420 } 421 } 422 } 423 }, 424 { 425 'name': 'prelu float32 broadcast 4D x 1D slope', 426 'graph': { 427 'inputs': { 428 'preluInput': { 429 'data': [ 430 -2.549168109893799, -4.794857501983643, 8.413617134094238, 431 6.108623504638672, -8.492292404174805, 3.3143365383148193, 432 1.1687211990356445, -0.141762837767601, -6.714652061462402, 433 5.787421703338623, -3.755627393722534, -4.89828634262085, 434 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 435 9.439736366271973, -2.558180093765259, -8.658834457397461, 436 8.47507381439209, 4.551425457000732, -9.267870903015137, 437 -0.262177437543869, 1.3258955478668213, -7.41831111907959 438 ], 439 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 440 }, 441 'preluSlope': { 442 'data': [5.073923110961914, 0.480774462223053, -7.091750144958496], 443 'descriptor': {shape: [3], dataType: 'float32'}, 444 'constant': true 445 } 446 }, 447 'operators': [{ 448 'name': 'prelu', 449 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 450 'outputs': 'preluOutput' 451 }], 452 'expectedOutputs': { 453 'preluOutput': { 454 'data': [ 455 -12.934283256530762, -2.3052449226379395, 8.413617134094238, 456 6.108623504638672, -4.082877159118652, 3.3143365383148193, 457 1.1687211990356445, -0.06815595179796219, 47.61863327026367, 458 5.787421703338623, -1.8056097030639648, 34.737422943115234, 459 7.3295159339904785, -1.901092767715454, 7.067296981811523, 460 9.439736366271973, -1.2299076318740845, 61.40629196166992, 461 8.47507381439209, 4.551425457000732, 65.72542572021484, 462 -1.330268144607544, 1.3258955478668213, 52.60881042480469 463 ], 464 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 465 } 466 } 467 } 468 }, 469 { 470 'name': 'prelu float32 broadcast 4D x 1D slope of shape [1]', 471 'graph': { 472 'inputs': { 473 'preluInput': { 474 'data': [ 475 -2.549168109893799, -4.794857501983643, 8.413617134094238, 476 6.108623504638672, -8.492292404174805, 3.3143365383148193, 477 1.1687211990356445, -0.141762837767601, -6.714652061462402, 478 5.787421703338623, -3.755627393722534, -4.89828634262085, 479 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 480 9.439736366271973, -2.558180093765259, -8.658834457397461, 481 8.47507381439209, 4.551425457000732, -9.267870903015137, 482 -0.262177437543869, 1.3258955478668213, -7.41831111907959 483 ], 484 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 485 }, 486 'preluSlope': { 487 'data': [5.0114545822143555], 488 'descriptor': {shape: [1], dataType: 'float32'}, 489 'constant': true 490 } 491 }, 492 'operators': [{ 493 'name': 'prelu', 494 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 495 'outputs': 'preluOutput' 496 }], 497 'expectedOutputs': { 498 'preluOutput': { 499 'data': [ 500 -12.775040626525879, -24.029211044311523, 8.413617134094238, 501 6.108623504638672, -42.558738708496094, 3.3143365383148193, 502 1.1687211990356445, -0.7104380130767822, -33.65017318725586, 503 5.787421703338623, -18.821155548095703, -24.54753875732422, 504 7.3295159339904785, -19.816442489624023, 7.067296981811523, 505 9.439736366271973, -12.82020378112793, -43.39335632324219, 506 8.47507381439209, 4.551425457000732, -46.44551467895508, 507 -1.3138903379440308, 1.3258955478668213, -37.17652893066406 508 ], 509 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 510 } 511 } 512 } 513 }, 514 { 515 'name': 'prelu float32 broadcast 4D x 2D slope', 516 'graph': { 517 'inputs': { 518 'preluInput': { 519 'data': [ 520 -2.549168109893799, -4.794857501983643, 8.413617134094238, 521 6.108623504638672, -8.492292404174805, 3.3143365383148193, 522 1.1687211990356445, -0.141762837767601, -6.714652061462402, 523 5.787421703338623, -3.755627393722534, -4.89828634262085, 524 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 525 9.439736366271973, -2.558180093765259, -8.658834457397461, 526 8.47507381439209, 4.551425457000732, -9.267870903015137, 527 -0.262177437543869, 1.3258955478668213, -7.41831111907959 528 ], 529 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 530 }, 531 'preluSlope': { 532 'data': [ 533 4.874276161193848, -8.501633644104004, 1.1819270849227905, 534 -9.985190391540527, -4.424202919006348, -6.654683589935303 535 ], 536 'descriptor': {shape: [2, 3], dataType: 'float32'}, 537 'constant': true 538 } 539 }, 540 'operators': [{ 541 'name': 'prelu', 542 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 543 'outputs': 'preluOutput' 544 }], 545 'expectedOutputs': { 546 'preluOutput': { 547 'data': [ 548 -12.425349235534668, 40.764122009277344, 8.413617134094238, 549 6.108623504638672, 37.571624755859375, 3.3143365383148193, 550 1.1687211990356445, 1.2052156925201416, -7.936229228973389, 551 5.787421703338623, 16.615657806396484, 32.5965461730957, 552 7.3295159339904785, 33.61741256713867, 7.067296981811523, 553 9.439736366271973, 11.31790828704834, 57.621803283691406, 554 8.47507381439209, 4.551425457000732, -10.953948020935059, 555 2.617891550064087, 1.3258955478668213, 49.366512298583984 556 ], 557 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 558 } 559 } 560 } 561 }, 562 { 563 'name': 'prelu float32 broadcast 4D x 3D slope', 564 'graph': { 565 'inputs': { 566 'preluInput': { 567 'data': [ 568 -2.549168109893799, -4.794857501983643, 8.413617134094238, 569 6.108623504638672, -8.492292404174805, 3.3143365383148193, 570 1.1687211990356445, -0.141762837767601, -6.714652061462402, 571 5.787421703338623, -3.755627393722534, -4.89828634262085, 572 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 573 9.439736366271973, -2.558180093765259, -8.658834457397461, 574 8.47507381439209, 4.551425457000732, -9.267870903015137, 575 -0.262177437543869, 1.3258955478668213, -7.41831111907959 576 ], 577 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 578 }, 579 'preluSlope': { 580 'data': [5.073923110961914, 0.480774462223053, -7.091750144958496], 581 'descriptor': {shape: [1, 1, 3], dataType: 'float32'}, 582 'constant': true 583 } 584 }, 585 'operators': [{ 586 'name': 'prelu', 587 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 588 'outputs': 'preluOutput' 589 }], 590 'expectedOutputs': { 591 'preluOutput': { 592 'data': [ 593 -12.934283256530762, -2.3052449226379395, 8.413617134094238, 594 6.108623504638672, -4.082877159118652, 3.3143365383148193, 595 1.1687211990356445, -0.06815595179796219, 47.61863327026367, 596 5.787421703338623, -1.8056097030639648, 34.737422943115234, 597 7.3295159339904785, -1.901092767715454, 7.067296981811523, 598 9.439736366271973, -1.2299076318740845, 61.40629196166992, 599 8.47507381439209, 4.551425457000732, 65.72542572021484, 600 -1.330268144607544, 1.3258955478668213, 52.60881042480469 601 ], 602 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 603 } 604 } 605 } 606 }, 607 { 608 'name': 'prelu float32 broadcast 4D x 4D slope', 609 'graph': { 610 'inputs': { 611 'preluInput': { 612 'data': [ 613 -2.549168109893799, -4.794857501983643, 8.413617134094238, 614 6.108623504638672, -8.492292404174805, 3.3143365383148193, 615 1.1687211990356445, -0.141762837767601, -6.714652061462402, 616 5.787421703338623, -3.755627393722534, -4.89828634262085, 617 7.3295159339904785, -3.9542298316955566, 7.067296981811523, 618 9.439736366271973, -2.558180093765259, -8.658834457397461, 619 8.47507381439209, 4.551425457000732, -9.267870903015137, 620 -0.262177437543869, 1.3258955478668213, -7.41831111907959 621 ], 622 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 623 }, 624 'preluSlope': { 625 'data': [5.0114545822143555, 5.0114545822143555], 626 'descriptor': {shape: [1, 2, 1, 1], dataType: 'float32'}, 627 'constant': true 628 } 629 }, 630 'operators': [{ 631 'name': 'prelu', 632 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 633 'outputs': 'preluOutput' 634 }], 635 'expectedOutputs': { 636 'preluOutput': { 637 'data': [ 638 -12.775040626525879, -24.029211044311523, 8.413617134094238, 639 6.108623504638672, -42.558738708496094, 3.3143365383148193, 640 1.1687211990356445, -0.7104380130767822, -33.65017318725586, 641 5.787421703338623, -18.821155548095703, -24.54753875732422, 642 7.3295159339904785, -19.816442489624023, 7.067296981811523, 643 9.439736366271973, -12.82020378112793, -43.39335632324219, 644 8.47507381439209, 4.551425457000732, -46.44551467895508, 645 -1.3138903379440308, 1.3258955478668213, -37.17652893066406 646 ], 647 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float32'} 648 } 649 } 650 } 651 }, 652 653 // float16 tests 654 { 655 'name': 'prelu float16 0D scalar', 656 'graph': { 657 'inputs': { 658 'preluInput': { 659 'data': [-4.79296875], 660 'descriptor': {shape: [], dataType: 'float16'} 661 }, 662 'preluSlope': { 663 'data': [1.1201171875], 664 'descriptor': {shape: [], dataType: 'float16'}, 665 'constant': true 666 } 667 }, 668 'operators': [{ 669 'name': 'prelu', 670 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 671 'outputs': 'preluOutput' 672 }], 673 'expectedOutputs': { 674 'preluOutput': { 675 'data': [-5.3671875], 676 'descriptor': {shape: [], dataType: 'float16'} 677 } 678 } 679 } 680 }, 681 { 682 'name': 'prelu float16 1D constant tensors', 683 'graph': { 684 'inputs': { 685 'preluInput': { 686 'data': [ 687 -2.548828125, -4.79296875, 8.4140625, 6.109375, 688 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 689 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 690 7.328125, -3.955078125, 7.06640625, 9.4375, 691 -2.55859375, -8.65625, 8.4765625, 4.55078125, 692 -9.265625, -0.26220703125, 1.326171875, -7.41796875 693 ], 694 'descriptor': {shape: [24], dataType: 'float16'} 695 }, 696 'preluSlope': { 697 'data': [ 698 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 699 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 700 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 701 4.58203125, 2.6640625, 9.1953125, -9.5546875, 702 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 703 -1.9814453125, 4.15625, -1.7998046875, 9.296875 704 ], 705 'descriptor': {shape: [24], dataType: 'float16'}, 706 'constant': true 707 } 708 }, 709 'operators': [{ 710 'name': 'prelu', 711 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 712 'outputs': 'preluOutput' 713 }], 714 'expectedOutputs': { 715 'preluOutput': { 716 'data': [ 717 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 718 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 719 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 720 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 721 18.359375, -1.08984375, 1.326171875, -68.9375 722 ], 723 'descriptor': {shape: [24], dataType: 'float16'} 724 } 725 } 726 } 727 }, 728 { 729 'name': 'prelu float16 1D tensors', 730 'graph': { 731 'inputs': { 732 'preluInput': { 733 'data': [ 734 -2.548828125, -4.79296875, 8.4140625, 6.109375, 735 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 736 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 737 7.328125, -3.955078125, 7.06640625, 9.4375, 738 -2.55859375, -8.65625, 8.4765625, 4.55078125, 739 -9.265625, -0.26220703125, 1.326171875, -7.41796875 740 ], 741 'descriptor': {shape: [24], dataType: 'float16'} 742 }, 743 'preluSlope': { 744 'data': [ 745 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 746 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 747 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 748 4.58203125, 2.6640625, 9.1953125, -9.5546875, 749 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 750 -1.9814453125, 4.15625, -1.7998046875, 9.296875 751 ], 752 'descriptor': {shape: [24], dataType: 'float16'}, 753 'constant': true 754 } 755 }, 756 'operators': [{ 757 'name': 'prelu', 758 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 759 'outputs': 'preluOutput' 760 }], 761 'expectedOutputs': { 762 'preluOutput': { 763 'data': [ 764 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 765 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 766 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 767 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 768 18.359375, -1.08984375, 1.326171875, -68.9375 769 ], 770 'descriptor': {shape: [24], dataType: 'float16'} 771 } 772 } 773 } 774 }, 775 { 776 'name': 'prelu float16 1D non-constant slope', 777 'graph': { 778 'inputs': { 779 'preluInput': { 780 'data': [ 781 -2.548828125, -4.79296875, 8.4140625, 6.109375, 782 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 783 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 784 7.328125, -3.955078125, 7.06640625, 9.4375, 785 -2.55859375, -8.65625, 8.4765625, 4.55078125, 786 -9.265625, -0.26220703125, 1.326171875, -7.41796875 787 ], 788 'descriptor': {shape: [24], dataType: 'float16'} 789 }, 790 'preluSlope': { 791 'data': [ 792 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 793 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 794 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 795 4.58203125, 2.6640625, 9.1953125, -9.5546875, 796 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 797 -1.9814453125, 4.15625, -1.7998046875, 9.296875 798 ], 799 'descriptor': {shape: [24], dataType: 'float16'} 800 } 801 }, 802 'operators': [{ 803 'name': 'prelu', 804 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 805 'outputs': 'preluOutput' 806 }], 807 'expectedOutputs': { 808 'preluOutput': { 809 'data': [ 810 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 811 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 812 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 813 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 814 18.359375, -1.08984375, 1.326171875, -68.9375 815 ], 816 'descriptor': {shape: [24], dataType: 'float16'} 817 } 818 } 819 } 820 }, 821 { 822 'name': 'prelu float16 2D tensors', 823 'graph': { 824 'inputs': { 825 'preluInput': { 826 'data': [ 827 -2.548828125, -4.79296875, 8.4140625, 6.109375, 828 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 829 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 830 7.328125, -3.955078125, 7.06640625, 9.4375, 831 -2.55859375, -8.65625, 8.4765625, 4.55078125, 832 -9.265625, -0.26220703125, 1.326171875, -7.41796875 833 ], 834 'descriptor': {shape: [4, 6], dataType: 'float16'} 835 }, 836 'preluSlope': { 837 'data': [ 838 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 839 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 840 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 841 4.58203125, 2.6640625, 9.1953125, -9.5546875, 842 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 843 -1.9814453125, 4.15625, -1.7998046875, 9.296875 844 ], 845 'descriptor': {shape: [4, 6], dataType: 'float16'}, 846 'constant': true 847 } 848 }, 849 'operators': [{ 850 'name': 'prelu', 851 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 852 'outputs': 'preluOutput' 853 }], 854 'expectedOutputs': { 855 'preluOutput': { 856 'data': [ 857 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 858 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 859 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 860 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 861 18.359375, -1.08984375, 1.326171875, -68.9375 862 ], 863 'descriptor': {shape: [4, 6], dataType: 'float16'} 864 } 865 } 866 } 867 }, 868 { 869 'name': 'prelu float16 3D tensors', 870 'graph': { 871 'inputs': { 872 'preluInput': { 873 'data': [ 874 -2.548828125, -4.79296875, 8.4140625, 6.109375, 875 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 876 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 877 7.328125, -3.955078125, 7.06640625, 9.4375, 878 -2.55859375, -8.65625, 8.4765625, 4.55078125, 879 -9.265625, -0.26220703125, 1.326171875, -7.41796875 880 ], 881 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 882 }, 883 'preluSlope': { 884 'data': [ 885 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 886 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 887 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 888 4.58203125, 2.6640625, 9.1953125, -9.5546875, 889 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 890 -1.9814453125, 4.15625, -1.7998046875, 9.296875 891 ], 892 'descriptor': {shape: [2, 3, 4], dataType: 'float16'}, 893 'constant': true 894 } 895 }, 896 'operators': [{ 897 'name': 'prelu', 898 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 899 'outputs': 'preluOutput' 900 }], 901 'expectedOutputs': { 902 'preluOutput': { 903 'data': [ 904 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 905 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 906 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 907 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 908 18.359375, -1.08984375, 1.326171875, -68.9375 909 ], 910 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 911 } 912 } 913 } 914 }, 915 { 916 'name': 'prelu float16 4D tensors', 917 'graph': { 918 'inputs': { 919 'preluInput': { 920 'data': [ 921 -2.548828125, -4.79296875, 8.4140625, 6.109375, 922 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 923 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 924 7.328125, -3.955078125, 7.06640625, 9.4375, 925 -2.55859375, -8.65625, 8.4765625, 4.55078125, 926 -9.265625, -0.26220703125, 1.326171875, -7.41796875 927 ], 928 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 929 }, 930 'preluSlope': { 931 'data': [ 932 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 933 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 934 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 935 4.58203125, 2.6640625, 9.1953125, -9.5546875, 936 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 937 -1.9814453125, 4.15625, -1.7998046875, 9.296875 938 ], 939 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'}, 940 'constant': true 941 } 942 }, 943 'operators': [{ 944 'name': 'prelu', 945 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 946 'outputs': 'preluOutput' 947 }], 948 'expectedOutputs': { 949 'preluOutput': { 950 'data': [ 951 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 952 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 953 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 954 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 955 18.359375, -1.08984375, 1.326171875, -68.9375 956 ], 957 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 958 } 959 } 960 } 961 }, 962 { 963 'name': 'prelu float16 5D tensors', 964 'graph': { 965 'inputs': { 966 'preluInput': { 967 'data': [ 968 -2.548828125, -4.79296875, 8.4140625, 6.109375, 969 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 970 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 971 7.328125, -3.955078125, 7.06640625, 9.4375, 972 -2.55859375, -8.65625, 8.4765625, 4.55078125, 973 -9.265625, -0.26220703125, 1.326171875, -7.41796875 974 ], 975 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 976 }, 977 'preluSlope': { 978 'data': [ 979 9.34375, 0.280029296875, -4.6171875, 1.1201171875, 980 -1.43359375, -3.158203125, -6.2890625, -5.01171875, 981 -6.8984375, 3.572265625, 6.86328125, -1.9619140625, 982 4.58203125, 2.6640625, 9.1953125, -9.5546875, 983 -5.50390625, -2.392578125, 3.58203125, -2.322265625, 984 -1.9814453125, 4.15625, -1.7998046875, 9.296875 985 ], 986 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'}, 987 'constant': true 988 } 989 }, 990 'operators': [{ 991 'name': 'prelu', 992 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 993 'outputs': 'preluOutput' 994 }], 995 'expectedOutputs': { 996 'preluOutput': { 997 'data': [ 998 -23.8125, -1.341796875, 8.4140625, 6.109375, 12.171875, 999 3.314453125, 1.1689453125, 0.71044921875, 46.3125, 5.7890625, 1000 -25.78125, 9.609375, 7.328125, -10.5390625, 7.06640625, 1001 9.4375, 14.0859375, 20.703125, 8.4765625, 4.55078125, 1002 18.359375, -1.08984375, 1.326171875, -68.9375 1003 ], 1004 'descriptor': {shape: [2, 2, 1, 2, 3], dataType: 'float16'} 1005 } 1006 } 1007 } 1008 }, 1009 { 1010 'name': 'prelu float16 broadcast 4D x 1D slope', 1011 'graph': { 1012 'inputs': { 1013 'preluInput': { 1014 'data': [ 1015 -2.548828125, -4.79296875, 8.4140625, 6.109375, 1016 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 1017 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 1018 7.328125, -3.955078125, 7.06640625, 9.4375, 1019 -2.55859375, -8.65625, 8.4765625, 4.55078125, 1020 -9.265625, -0.26220703125, 1.326171875, -7.41796875 1021 ], 1022 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1023 }, 1024 'preluSlope': { 1025 'data': [5.07421875, 0.480712890625, -7.08984375], 1026 'descriptor': {shape: [3], dataType: 'float16'}, 1027 'constant': true 1028 } 1029 }, 1030 'operators': [{ 1031 'name': 'prelu', 1032 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1033 'outputs': 'preluOutput' 1034 }], 1035 'expectedOutputs': { 1036 'preluOutput': { 1037 'data': [ 1038 -12.9296875, -2.3046875, 8.4140625, 6.109375, 1039 -4.08203125, 3.314453125, 1.1689453125, -0.068115234375, 1040 47.59375, 5.7890625, -1.8056640625, 34.71875, 1041 7.328125, -1.9013671875, 7.06640625, 9.4375, 1042 -1.2294921875, 61.375, 8.4765625, 4.55078125, 1043 65.6875, -1.330078125, 1.326171875, 52.59375 1044 ], 1045 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1046 } 1047 } 1048 } 1049 }, 1050 { 1051 'name': 'prelu float16 broadcast 4D x 1D slope of shape [1]', 1052 'graph': { 1053 'inputs': { 1054 'preluInput': { 1055 'data': [ 1056 -2.548828125, -4.79296875, 8.4140625, 6.109375, 1057 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 1058 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 1059 7.328125, -3.955078125, 7.06640625, 9.4375, 1060 -2.55859375, -8.65625, 8.4765625, 4.55078125, 1061 -9.265625, -0.26220703125, 1.326171875, -7.41796875 1062 ], 1063 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1064 }, 1065 'preluSlope': { 1066 'data': [5.01171875], 1067 'descriptor': {shape: [1], dataType: 'float16'}, 1068 'constant': true 1069 } 1070 }, 1071 'operators': [{ 1072 'name': 'prelu', 1073 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1074 'outputs': 'preluOutput' 1075 }], 1076 'expectedOutputs': { 1077 'preluOutput': { 1078 'data': [ 1079 -12.7734375, -24.015625, 8.4140625, 6.109375, -42.5625, 1080 3.314453125, 1.1689453125, -0.71044921875, -33.65625, 5.7890625, 1081 -18.828125, -24.546875, 7.328125, -19.828125, 7.06640625, 1082 9.4375, -12.8203125, -43.375, 8.4765625, 4.55078125, 1083 -46.4375, -1.314453125, 1.326171875, -37.1875 1084 ], 1085 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1086 } 1087 } 1088 } 1089 }, 1090 { 1091 'name': 'prelu float16 broadcast 4D x 2D slope', 1092 'graph': { 1093 'inputs': { 1094 'preluInput': { 1095 'data': [ 1096 -2.548828125, -4.79296875, 8.4140625, 6.109375, 1097 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 1098 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 1099 7.328125, -3.955078125, 7.06640625, 9.4375, 1100 -2.55859375, -8.65625, 8.4765625, 4.55078125, 1101 -9.265625, -0.26220703125, 1.326171875, -7.41796875 1102 ], 1103 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1104 }, 1105 'preluSlope': { 1106 'data': [4.875, -8.5, 1.181640625, -9.984375, -4.42578125, -6.65625], 1107 'descriptor': {shape: [2, 3], dataType: 'float16'}, 1108 'constant': true 1109 } 1110 }, 1111 'operators': [{ 1112 'name': 'prelu', 1113 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1114 'outputs': 'preluOutput' 1115 }], 1116 'expectedOutputs': { 1117 'preluOutput': { 1118 'data': [ 1119 -12.421875, 40.75, 8.4140625, 6.109375, 37.59375, 1120 3.314453125, 1.1689453125, 1.205078125, -7.93359375, 5.7890625, 1121 16.625, 32.59375, 7.328125, 33.625, 7.06640625, 1122 9.4375, 11.3203125, 57.625, 8.4765625, 4.55078125, 1123 -10.9453125, 2.6171875, 1.326171875, 49.375 1124 ], 1125 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1126 } 1127 } 1128 } 1129 }, 1130 { 1131 'name': 'prelu float16 broadcast 4D x 3D slope', 1132 'graph': { 1133 'inputs': { 1134 'preluInput': { 1135 'data': [ 1136 -2.548828125, -4.79296875, 8.4140625, 6.109375, 1137 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 1138 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 1139 7.328125, -3.955078125, 7.06640625, 9.4375, 1140 -2.55859375, -8.65625, 8.4765625, 4.55078125, 1141 -9.265625, -0.26220703125, 1.326171875, -7.41796875 1142 ], 1143 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1144 }, 1145 'preluSlope': { 1146 'data': [5.07421875, 0.480712890625, -7.08984375], 1147 'descriptor': {shape: [1, 1, 3], dataType: 'float16'}, 1148 'constant': true 1149 } 1150 }, 1151 'operators': [{ 1152 'name': 'prelu', 1153 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1154 'outputs': 'preluOutput' 1155 }], 1156 'expectedOutputs': { 1157 'preluOutput': { 1158 'data': [ 1159 -12.9296875, -2.3046875, 8.4140625, 6.109375, 1160 -4.08203125, 3.314453125, 1.1689453125, -0.068115234375, 1161 47.59375, 5.7890625, -1.8056640625, 34.71875, 1162 7.328125, -1.9013671875, 7.06640625, 9.4375, 1163 -1.2294921875, 61.375, 8.4765625, 4.55078125, 1164 65.6875, -1.330078125, 1.326171875, 52.59375 1165 ], 1166 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1167 } 1168 } 1169 } 1170 }, 1171 { 1172 'name': 'prelu float16 broadcast 4D x 4D slope', 1173 'graph': { 1174 'inputs': { 1175 'preluInput': { 1176 'data': [ 1177 -2.548828125, -4.79296875, 8.4140625, 6.109375, 1178 -8.4921875, 3.314453125, 1.1689453125, -0.1417236328125, 1179 -6.71484375, 5.7890625, -3.755859375, -4.8984375, 1180 7.328125, -3.955078125, 7.06640625, 9.4375, 1181 -2.55859375, -8.65625, 8.4765625, 4.55078125, 1182 -9.265625, -0.26220703125, 1.326171875, -7.41796875 1183 ], 1184 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1185 }, 1186 'preluSlope': { 1187 'data': [5.01171875], 1188 'descriptor': {shape: [1, 1, 1, 1], dataType: 'float16'}, 1189 'constant': true 1190 } 1191 }, 1192 'operators': [{ 1193 'name': 'prelu', 1194 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1195 'outputs': 'preluOutput' 1196 }], 1197 'expectedOutputs': { 1198 'preluOutput': { 1199 'data': [ 1200 -12.7734375, -24.015625, 8.4140625, 6.109375, -42.5625, 1201 3.314453125, 1.1689453125, -0.71044921875, -33.65625, 5.7890625, 1202 -18.828125, -24.546875, 7.328125, -19.828125, 7.06640625, 1203 9.4375, -12.8203125, -43.375, 8.4765625, 4.55078125, 1204 -46.4375, -1.314453125, 1.326171875, -37.1875 1205 ], 1206 'descriptor': {shape: [2, 2, 2, 3], dataType: 'float16'} 1207 } 1208 } 1209 } 1210 }, 1211 1212 // int64 tests 1213 { 1214 'name': 'prelu int64 2D constant tensors', 1215 'graph': { 1216 'inputs': { 1217 'preluInput': { 1218 'data': [-4, -2, -1, 0, 0, 0, 1, 2, 4], 1219 'descriptor': {shape: [3, 3], dataType: 'int64'}, 1220 'constant': true 1221 }, 1222 'preluSlope': { 1223 'data': [-5, 0, 5, -5, 0, 5, -5, 0, 5], 1224 'descriptor': {shape: [3, 3], dataType: 'int64'}, 1225 'constant': true 1226 } 1227 }, 1228 'operators': [{ 1229 'name': 'prelu', 1230 'arguments': [{'input': 'preluInput'}, {'slope': 'preluSlope'}], 1231 'outputs': 'preluOutput' 1232 }], 1233 'expectedOutputs': { 1234 'preluOutput': { 1235 'data': [20, 0, -5, 0, 0, 0, 1, 2, 4], 1236 'descriptor': {shape: [3, 3], dataType: 'int64'} 1237 } 1238 } 1239 } 1240 } 1241 ]; 1242 1243 webnn_conformance_test(preluTests, buildAndExecuteGraph, getPrecisionTolerance);