transpose.https.any.js (27857B)
1 // META: title=test WebNN API transpose 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-transpose 12 // Permute the dimensions of the input tensor according to the permutation 13 // argument. 14 // 15 // dictionary MLTransposeOptions { 16 // sequence<[EnforceRange] unsigned long> permutation; 17 // }; 18 // 19 // MLOperand transpose( 20 // MLOperand input, optional MLTransposeOptions options = {}); 21 22 const transposeTests = [ 23 { 24 'name': 'transpose float32 0D constant tensor default options', 25 'graph': { 26 'inputs': { 27 'transposeInput': { 28 'data': [-45.67443084716797], 29 'descriptor': {shape: [], dataType: 'float32'}, 30 'constant': true 31 } 32 }, 33 'operators': [{ 34 'name': 'transpose', 35 'arguments': [{'input': 'transposeInput'}], 36 'outputs': 'transposeOutput' 37 }], 38 'expectedOutputs': { 39 'transposeOutput': { 40 'data': [-45.67443084716797], 41 'descriptor': {shape: [], dataType: 'float32'} 42 } 43 } 44 } 45 }, 46 { 47 'name': 'transpose float32 1D constant tensor default options', 48 'graph': { 49 'inputs': { 50 'transposeInput': { 51 'data': [ 52 -45.67443084716797, 53.45924758911133, -60.118492126464844, 53 38.081748962402344, 78.64247131347656, -69.25324249267578, 54 1.8434585332870483, 92.8102798461914, 56.100074768066406, 55 77.05838012695312, 57.46807861328125, -84.74308776855469, 56 46.38539123535156, -84.89764404296875, 56.70438766479492, 57 -25.695144653320312, 5.62217378616333, -25.66281509399414, 58 99.46284484863281, -87.58920288085938, -65.3779067993164, 59 -66.00990295410156, 38.466827392578125, 2.1999382972717285 60 ], 61 'descriptor': {shape: [24], dataType: 'float32'}, 62 'constant': true 63 } 64 }, 65 'operators': [{ 66 'name': 'transpose', 67 'arguments': [{'input': 'transposeInput'}], 68 'outputs': 'transposeOutput' 69 }], 70 'expectedOutputs': { 71 'transposeOutput': { 72 'data': [ 73 -45.67443084716797, 53.45924758911133, -60.118492126464844, 74 38.081748962402344, 78.64247131347656, -69.25324249267578, 75 1.8434585332870483, 92.8102798461914, 56.100074768066406, 76 77.05838012695312, 57.46807861328125, -84.74308776855469, 77 46.38539123535156, -84.89764404296875, 56.70438766479492, 78 -25.695144653320312, 5.62217378616333, -25.66281509399414, 79 99.46284484863281, -87.58920288085938, -65.3779067993164, 80 -66.00990295410156, 38.466827392578125, 2.1999382972717285 81 ], 82 'descriptor': {shape: [24], dataType: 'float32'} 83 } 84 } 85 } 86 }, 87 { 88 'name': 'transpose float32 1D tensor default options', 89 'graph': { 90 'inputs': { 91 'transposeInput': { 92 'data': [ 93 -45.67443084716797, 53.45924758911133, -60.118492126464844, 94 38.081748962402344, 78.64247131347656, -69.25324249267578, 95 1.8434585332870483, 92.8102798461914, 56.100074768066406, 96 77.05838012695312, 57.46807861328125, -84.74308776855469, 97 46.38539123535156, -84.89764404296875, 56.70438766479492, 98 -25.695144653320312, 5.62217378616333, -25.66281509399414, 99 99.46284484863281, -87.58920288085938, -65.3779067993164, 100 -66.00990295410156, 38.466827392578125, 2.1999382972717285 101 ], 102 'descriptor': {shape: [24], dataType: 'float32'} 103 } 104 }, 105 'operators': [{ 106 'name': 'transpose', 107 'arguments': [{'input': 'transposeInput'}], 108 'outputs': 'transposeOutput' 109 }], 110 'expectedOutputs': { 111 'transposeOutput': { 112 'data': [ 113 -45.67443084716797, 53.45924758911133, -60.118492126464844, 114 38.081748962402344, 78.64247131347656, -69.25324249267578, 115 1.8434585332870483, 92.8102798461914, 56.100074768066406, 116 77.05838012695312, 57.46807861328125, -84.74308776855469, 117 46.38539123535156, -84.89764404296875, 56.70438766479492, 118 -25.695144653320312, 5.62217378616333, -25.66281509399414, 119 99.46284484863281, -87.58920288085938, -65.3779067993164, 120 -66.00990295410156, 38.466827392578125, 2.1999382972717285 121 ], 122 'descriptor': {shape: [24], dataType: 'float32'} 123 } 124 } 125 } 126 }, 127 { 128 'name': 'transpose float32 2D tensor default options', 129 'graph': { 130 'inputs': { 131 'transposeInput': { 132 'data': [ 133 -45.67443084716797, 53.45924758911133, -60.118492126464844, 134 38.081748962402344, 78.64247131347656, -69.25324249267578, 135 1.8434585332870483, 92.8102798461914, 56.100074768066406, 136 77.05838012695312, 57.46807861328125, -84.74308776855469, 137 46.38539123535156, -84.89764404296875, 56.70438766479492, 138 -25.695144653320312, 5.62217378616333, -25.66281509399414, 139 99.46284484863281, -87.58920288085938, -65.3779067993164, 140 -66.00990295410156, 38.466827392578125, 2.1999382972717285 141 ], 142 'descriptor': {shape: [4, 6], dataType: 'float32'} 143 } 144 }, 145 'operators': [{ 146 'name': 'transpose', 147 'arguments': [{'input': 'transposeInput'}], 148 'outputs': 'transposeOutput' 149 }], 150 'expectedOutputs': { 151 'transposeOutput': { 152 'data': [ 153 -45.67443084716797, 1.8434585332870483, 46.38539123535156, 154 99.46284484863281, 53.45924758911133, 92.8102798461914, 155 -84.89764404296875, -87.58920288085938, -60.118492126464844, 156 56.100074768066406, 56.70438766479492, -65.3779067993164, 157 38.081748962402344, 77.05838012695312, -25.695144653320312, 158 -66.00990295410156, 78.64247131347656, 57.46807861328125, 159 5.62217378616333, 38.466827392578125, -69.25324249267578, 160 -84.74308776855469, -25.66281509399414, 2.1999382972717285 161 ], 162 'descriptor': {shape: [6, 4], dataType: 'float32'} 163 } 164 } 165 } 166 }, 167 { 168 'name': 'transpose float32 3D tensor default options', 169 'graph': { 170 'inputs': { 171 'transposeInput': { 172 'data': [ 173 -45.67443084716797, 53.45924758911133, -60.118492126464844, 174 38.081748962402344, 78.64247131347656, -69.25324249267578, 175 1.8434585332870483, 92.8102798461914, 56.100074768066406, 176 77.05838012695312, 57.46807861328125, -84.74308776855469, 177 46.38539123535156, -84.89764404296875, 56.70438766479492, 178 -25.695144653320312, 5.62217378616333, -25.66281509399414, 179 99.46284484863281, -87.58920288085938, -65.3779067993164, 180 -66.00990295410156, 38.466827392578125, 2.1999382972717285 181 ], 182 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 183 } 184 }, 185 'operators': [{ 186 'name': 'transpose', 187 'arguments': [{'input': 'transposeInput'}], 188 'outputs': 'transposeOutput' 189 }], 190 'expectedOutputs': { 191 'transposeOutput': { 192 'data': [ 193 -45.67443084716797, 46.38539123535156, 78.64247131347656, 194 5.62217378616333, 56.100074768066406, -65.3779067993164, 195 53.45924758911133, -84.89764404296875, -69.25324249267578, 196 -25.66281509399414, 77.05838012695312, -66.00990295410156, 197 -60.118492126464844, 56.70438766479492, 1.8434585332870483, 198 99.46284484863281, 57.46807861328125, 38.466827392578125, 199 38.081748962402344, -25.695144653320312, 92.8102798461914, 200 -87.58920288085938, -84.74308776855469, 2.1999382972717285 201 ], 202 'descriptor': {shape: [4, 3, 2], dataType: 'float32'} 203 } 204 } 205 } 206 }, 207 { 208 'name': 'transpose float32 4D tensor default options', 209 'graph': { 210 'inputs': { 211 'transposeInput': { 212 'data': [ 213 -45.67443084716797, 53.45924758911133, -60.118492126464844, 214 38.081748962402344, 78.64247131347656, -69.25324249267578, 215 1.8434585332870483, 92.8102798461914, 56.100074768066406, 216 77.05838012695312, 57.46807861328125, -84.74308776855469, 217 46.38539123535156, -84.89764404296875, 56.70438766479492, 218 -25.695144653320312, 5.62217378616333, -25.66281509399414, 219 99.46284484863281, -87.58920288085938, -65.3779067993164, 220 -66.00990295410156, 38.466827392578125, 2.1999382972717285 221 ], 222 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 223 } 224 }, 225 'operators': [{ 226 'name': 'transpose', 227 'arguments': [{'input': 'transposeInput'}], 228 'outputs': 'transposeOutput' 229 }], 230 'expectedOutputs': { 231 'transposeOutput': { 232 'data': [ 233 -45.67443084716797, 46.38539123535156, 78.64247131347656, 234 5.62217378616333, 56.100074768066406, -65.3779067993164, 235 53.45924758911133, -84.89764404296875, -69.25324249267578, 236 -25.66281509399414, 77.05838012695312, -66.00990295410156, 237 -60.118492126464844, 56.70438766479492, 1.8434585332870483, 238 99.46284484863281, 57.46807861328125, 38.466827392578125, 239 38.081748962402344, -25.695144653320312, 92.8102798461914, 240 -87.58920288085938, -84.74308776855469, 2.1999382972717285 241 ], 242 'descriptor': {shape: [4, 3, 2, 1], dataType: 'float32'} 243 } 244 } 245 } 246 }, 247 { 248 'name': 'transpose float32 5D tensor default options', 249 'graph': { 250 'inputs': { 251 'transposeInput': { 252 'data': [ 253 -45.67443084716797, 53.45924758911133, -60.118492126464844, 254 38.081748962402344, 78.64247131347656, -69.25324249267578, 255 1.8434585332870483, 92.8102798461914, 56.100074768066406, 256 77.05838012695312, 57.46807861328125, -84.74308776855469, 257 46.38539123535156, -84.89764404296875, 56.70438766479492, 258 -25.695144653320312, 5.62217378616333, -25.66281509399414, 259 99.46284484863281, -87.58920288085938, -65.3779067993164, 260 -66.00990295410156, 38.466827392578125, 2.1999382972717285 261 ], 262 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 263 } 264 }, 265 'operators': [{ 266 'name': 'transpose', 267 'arguments': [{'input': 'transposeInput'}], 268 'outputs': 'transposeOutput' 269 }], 270 'expectedOutputs': { 271 'transposeOutput': { 272 'data': [ 273 -45.67443084716797, 46.38539123535156, 78.64247131347656, 274 5.62217378616333, 56.100074768066406, -65.3779067993164, 275 53.45924758911133, -84.89764404296875, -69.25324249267578, 276 -25.66281509399414, 77.05838012695312, -66.00990295410156, 277 -60.118492126464844, 56.70438766479492, 1.8434585332870483, 278 99.46284484863281, 57.46807861328125, 38.466827392578125, 279 38.081748962402344, -25.695144653320312, 92.8102798461914, 280 -87.58920288085938, -84.74308776855469, 2.1999382972717285 281 ], 282 'descriptor': {shape: [4, 3, 1, 2, 1], dataType: 'float32'} 283 } 284 } 285 } 286 }, 287 { 288 'name': 'transpose float32 1D tensor options.permutation', 289 'graph': { 290 'inputs': { 291 'transposeInput': { 292 'data': [ 293 -45.67443084716797, 53.45924758911133, -60.118492126464844, 294 38.081748962402344, 78.64247131347656, -69.25324249267578, 295 1.8434585332870483, 92.8102798461914, 56.100074768066406, 296 77.05838012695312, 57.46807861328125, -84.74308776855469, 297 46.38539123535156, -84.89764404296875, 56.70438766479492, 298 -25.695144653320312, 5.62217378616333, -25.66281509399414, 299 99.46284484863281, -87.58920288085938, -65.3779067993164, 300 -66.00990295410156, 38.466827392578125, 2.1999382972717285 301 ], 302 'descriptor': {shape: [24], dataType: 'float32'} 303 } 304 }, 305 'operators': [{ 306 'name': 'transpose', 307 'arguments': 308 [{'input': 'transposeInput'}, {'options': {'permutation': [0]}}], 309 'outputs': 'transposeOutput' 310 }], 311 'expectedOutputs': { 312 'transposeOutput': { 313 'data': [ 314 -45.67443084716797, 53.45924758911133, -60.118492126464844, 315 38.081748962402344, 78.64247131347656, -69.25324249267578, 316 1.8434585332870483, 92.8102798461914, 56.100074768066406, 317 77.05838012695312, 57.46807861328125, -84.74308776855469, 318 46.38539123535156, -84.89764404296875, 56.70438766479492, 319 -25.695144653320312, 5.62217378616333, -25.66281509399414, 320 99.46284484863281, -87.58920288085938, -65.3779067993164, 321 -66.00990295410156, 38.466827392578125, 2.1999382972717285 322 ], 323 'descriptor': {shape: [24], dataType: 'float32'} 324 } 325 } 326 } 327 }, 328 { 329 'name': 'transpose float32 2D tensor options.permutation', 330 'graph': { 331 'inputs': { 332 'transposeInput': { 333 'data': [ 334 -45.67443084716797, 53.45924758911133, -60.118492126464844, 335 38.081748962402344, 78.64247131347656, -69.25324249267578, 336 1.8434585332870483, 92.8102798461914, 56.100074768066406, 337 77.05838012695312, 57.46807861328125, -84.74308776855469, 338 46.38539123535156, -84.89764404296875, 56.70438766479492, 339 -25.695144653320312, 5.62217378616333, -25.66281509399414, 340 99.46284484863281, -87.58920288085938, -65.3779067993164, 341 -66.00990295410156, 38.466827392578125, 2.1999382972717285 342 ], 343 'descriptor': {shape: [4, 6], dataType: 'float32'} 344 } 345 }, 346 'operators': [{ 347 'name': 'transpose', 348 'arguments': 349 [{'input': 'transposeInput'}, {'options': {'permutation': [1, 0]}}], 350 'outputs': 'transposeOutput' 351 }], 352 'expectedOutputs': { 353 'transposeOutput': { 354 'data': [ 355 -45.67443084716797, 1.8434585332870483, 46.38539123535156, 356 99.46284484863281, 53.45924758911133, 92.8102798461914, 357 -84.89764404296875, -87.58920288085938, -60.118492126464844, 358 56.100074768066406, 56.70438766479492, -65.3779067993164, 359 38.081748962402344, 77.05838012695312, -25.695144653320312, 360 -66.00990295410156, 78.64247131347656, 57.46807861328125, 361 5.62217378616333, 38.466827392578125, -69.25324249267578, 362 -84.74308776855469, -25.66281509399414, 2.1999382972717285 363 ], 364 'descriptor': {shape: [6, 4], dataType: 'float32'} 365 } 366 } 367 } 368 }, 369 { 370 'name': 'transpose float32 3D tensor options.permutation', 371 'graph': { 372 'inputs': { 373 'transposeInput': { 374 'data': [ 375 -45.67443084716797, 53.45924758911133, -60.118492126464844, 376 38.081748962402344, 78.64247131347656, -69.25324249267578, 377 1.8434585332870483, 92.8102798461914, 56.100074768066406, 378 77.05838012695312, 57.46807861328125, -84.74308776855469, 379 46.38539123535156, -84.89764404296875, 56.70438766479492, 380 -25.695144653320312, 5.62217378616333, -25.66281509399414, 381 99.46284484863281, -87.58920288085938, -65.3779067993164, 382 -66.00990295410156, 38.466827392578125, 2.1999382972717285 383 ], 384 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 385 } 386 }, 387 'operators': [{ 388 'name': 'transpose', 389 'arguments': [ 390 {'input': 'transposeInput'}, {'options': {'permutation': [2, 0, 1]}} 391 ], 392 'outputs': 'transposeOutput' 393 }], 394 'expectedOutputs': { 395 'transposeOutput': { 396 'data': [ 397 -45.67443084716797, 78.64247131347656, 56.100074768066406, 398 46.38539123535156, 5.62217378616333, -65.3779067993164, 399 53.45924758911133, -69.25324249267578, 77.05838012695312, 400 -84.89764404296875, -25.66281509399414, -66.00990295410156, 401 -60.118492126464844, 1.8434585332870483, 57.46807861328125, 402 56.70438766479492, 99.46284484863281, 38.466827392578125, 403 38.081748962402344, 92.8102798461914, -84.74308776855469, 404 -25.695144653320312, -87.58920288085938, 2.1999382972717285 405 ], 406 'descriptor': {shape: [4, 2, 3], dataType: 'float32'} 407 } 408 } 409 } 410 }, 411 { 412 'name': 'transpose float32 4D tensor options.permutation', 413 'graph': { 414 'inputs': { 415 'transposeInput': { 416 'data': [ 417 -45.67443084716797, 53.45924758911133, -60.118492126464844, 418 38.081748962402344, 78.64247131347656, -69.25324249267578, 419 1.8434585332870483, 92.8102798461914, 56.100074768066406, 420 77.05838012695312, 57.46807861328125, -84.74308776855469, 421 46.38539123535156, -84.89764404296875, 56.70438766479492, 422 -25.695144653320312, 5.62217378616333, -25.66281509399414, 423 99.46284484863281, -87.58920288085938, -65.3779067993164, 424 -66.00990295410156, 38.466827392578125, 2.1999382972717285 425 ], 426 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 427 } 428 }, 429 'operators': [{ 430 'name': 'transpose', 431 'arguments': [ 432 {'input': 'transposeInput'}, 433 {'options': {'permutation': [2, 3, 0, 1]}} 434 ], 435 'outputs': 'transposeOutput' 436 }], 437 'expectedOutputs': { 438 'transposeOutput': { 439 'data': [ 440 -45.67443084716797, 46.38539123535156, 53.45924758911133, 441 -84.89764404296875, -60.118492126464844, 56.70438766479492, 442 38.081748962402344, -25.695144653320312, 78.64247131347656, 443 5.62217378616333, -69.25324249267578, -25.66281509399414, 444 1.8434585332870483, 99.46284484863281, 92.8102798461914, 445 -87.58920288085938, 56.100074768066406, -65.3779067993164, 446 77.05838012695312, -66.00990295410156, 57.46807861328125, 447 38.466827392578125, -84.74308776855469, 2.1999382972717285 448 ], 449 'descriptor': {shape: [3, 4, 1, 2], dataType: 'float32'} 450 } 451 } 452 } 453 }, 454 { 455 'name': 'transpose float32 5D tensor options.permutation', 456 'graph': { 457 'inputs': { 458 'transposeInput': { 459 'data': [ 460 -45.67443084716797, 53.45924758911133, -60.118492126464844, 461 38.081748962402344, 78.64247131347656, -69.25324249267578, 462 1.8434585332870483, 92.8102798461914, 56.100074768066406, 463 77.05838012695312, 57.46807861328125, -84.74308776855469, 464 46.38539123535156, -84.89764404296875, 56.70438766479492, 465 -25.695144653320312, 5.62217378616333, -25.66281509399414, 466 99.46284484863281, -87.58920288085938, -65.3779067993164, 467 -66.00990295410156, 38.466827392578125, 2.1999382972717285 468 ], 469 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 470 } 471 }, 472 'operators': [{ 473 'name': 'transpose', 474 'arguments': [ 475 {'input': 'transposeInput'}, 476 {'options': {'permutation': [1, 3, 0, 4, 2]}} 477 ], 478 'outputs': 'transposeOutput' 479 }], 480 'expectedOutputs': { 481 'transposeOutput': { 482 'data': [ 483 -45.67443084716797, 53.45924758911133, -60.118492126464844, 484 38.081748962402344, 78.64247131347656, -69.25324249267578, 485 1.8434585332870483, 92.8102798461914, 56.100074768066406, 486 77.05838012695312, 57.46807861328125, -84.74308776855469, 487 46.38539123535156, -84.89764404296875, 56.70438766479492, 488 -25.695144653320312, 5.62217378616333, -25.66281509399414, 489 99.46284484863281, -87.58920288085938, -65.3779067993164, 490 -66.00990295410156, 38.466827392578125, 2.1999382972717285 491 ], 492 'descriptor': {shape: [2, 3, 1, 4, 1], dataType: 'float32'} 493 } 494 } 495 } 496 }, 497 498 // float16 tests 499 { 500 'name': 'transpose float16 1D constant tensor default options', 501 'graph': { 502 'inputs': { 503 'transposeInput': { 504 'data': [ 505 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 506 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 507 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 508 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 509 ], 510 'descriptor': {shape: [24], dataType: 'float16'}, 511 'constant': true 512 } 513 }, 514 'operators': [{ 515 'name': 'transpose', 516 'arguments': [{'input': 'transposeInput'}], 517 'outputs': 'transposeOutput' 518 }], 519 'expectedOutputs': { 520 'transposeOutput': { 521 'data': [ 522 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 523 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 524 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 525 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 526 ], 527 'descriptor': {shape: [24], dataType: 'float16'} 528 } 529 } 530 } 531 }, 532 { 533 'name': 'transpose float16 1D tensor default options', 534 'graph': { 535 'inputs': { 536 'transposeInput': { 537 'data': [ 538 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 539 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 540 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 541 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 542 ], 543 'descriptor': {shape: [24], dataType: 'float16'} 544 } 545 }, 546 'operators': [{ 547 'name': 'transpose', 548 'arguments': [{'input': 'transposeInput'}], 549 'outputs': 'transposeOutput' 550 }], 551 'expectedOutputs': { 552 'transposeOutput': { 553 'data': [ 554 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 555 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 556 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 557 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 558 ], 559 'descriptor': {shape: [24], dataType: 'float16'} 560 } 561 } 562 } 563 }, 564 { 565 'name': 'transpose float16 3D tensor default options', 566 'graph': { 567 'inputs': { 568 'transposeInput': { 569 'data': [ 570 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 571 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 572 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 573 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 574 ], 575 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 576 } 577 }, 578 'operators': [{ 579 'name': 'transpose', 580 'arguments': [{'input': 'transposeInput'}], 581 'outputs': 'transposeOutput' 582 }], 583 'expectedOutputs': { 584 'transposeOutput': { 585 'data': [ 586 -45.6875, 46.375, 78.625, 5.62109375, 56.09375, -65.375, 587 53.46875, -84.875, -69.25, -25.65625, 77.0625, -66, 588 -60.125, 56.71875, 1.84375, 99.4375, 57.46875, 38.46875, 589 38.09375, -25.6875, 92.8125, -87.5625, -84.75, 2.19921875 590 ], 591 'descriptor': {shape: [4, 3, 2], dataType: 'float16'} 592 } 593 } 594 } 595 }, 596 { 597 'name': 'transpose float16 5D tensor default options', 598 'graph': { 599 'inputs': { 600 'transposeInput': { 601 'data': [ 602 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 603 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 604 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 605 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 606 ], 607 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 608 } 609 }, 610 'operators': [{ 611 'name': 'transpose', 612 'arguments': [{'input': 'transposeInput'}], 613 'outputs': 'transposeOutput' 614 }], 615 'expectedOutputs': { 616 'transposeOutput': { 617 'data': [ 618 -45.6875, 46.375, 78.625, 5.62109375, 56.09375, -65.375, 619 53.46875, -84.875, -69.25, -25.65625, 77.0625, -66, 620 -60.125, 56.71875, 1.84375, 99.4375, 57.46875, 38.46875, 621 38.09375, -25.6875, 92.8125, -87.5625, -84.75, 2.19921875 622 ], 623 'descriptor': {shape: [4, 3, 1, 2, 1], dataType: 'float16'} 624 } 625 } 626 } 627 }, 628 { 629 'name': 'transpose float16 1D tensor options.permutation', 630 'graph': { 631 'inputs': { 632 'transposeInput': { 633 'data': [ 634 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 635 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 636 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 637 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 638 ], 639 'descriptor': {shape: [24], dataType: 'float16'} 640 } 641 }, 642 'operators': [{ 643 'name': 'transpose', 644 'arguments': 645 [{'input': 'transposeInput'}, {'options': {'permutation': [0]}}], 646 'outputs': 'transposeOutput' 647 }], 648 'expectedOutputs': { 649 'transposeOutput': { 650 'data': [ 651 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 652 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 653 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 654 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 655 ], 656 'descriptor': {shape: [24], dataType: 'float16'} 657 } 658 } 659 } 660 }, 661 { 662 'name': 'transpose float16 5D tensor options.permutation', 663 'graph': { 664 'inputs': { 665 'transposeInput': { 666 'data': [ 667 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 668 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 669 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 670 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 671 ], 672 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 673 } 674 }, 675 'operators': [{ 676 'name': 'transpose', 677 'arguments': [ 678 {'input': 'transposeInput'}, 679 {'options': {'permutation': [1, 3, 0, 4, 2]}} 680 ], 681 'outputs': 'transposeOutput' 682 }], 683 'expectedOutputs': { 684 'transposeOutput': { 685 'data': [ 686 -45.6875, 53.46875, -60.125, 38.09375, 78.625, -69.25, 687 1.84375, 92.8125, 56.09375, 77.0625, 57.46875, -84.75, 688 46.375, -84.875, 56.71875, -25.6875, 5.62109375, -25.65625, 689 99.4375, -87.5625, -65.375, -66, 38.46875, 2.19921875 690 ], 691 'descriptor': {shape: [2, 3, 1, 4, 1], dataType: 'float16'} 692 } 693 } 694 } 695 } 696 ]; 697 698 webnn_conformance_test( 699 transposeTests, buildAndExecuteGraph, getZeroULPTolerance);