gather.https.any.js (64363B)
1 // META: title=test WebNN API gather 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-gather 12 // Gather values of the input tensor along an axis according to the indices. 13 // 14 // dictionary MLGatherOptions { 15 // [EnforceRange] unsigned long axis = 0; 16 // }; 17 // 18 // MLOperand gather( 19 // MLOperand input, MLOperand indices, 20 // optional MLGatherOptions options = {}); 21 22 const gatherTests = [ 23 { 24 'name': 25 'gather float32 1D tensor and uint32 0D scalar indices default options', 26 'graph': { 27 'inputs': { 28 'gatherInput': { 29 'data': [ 30 -66.05901336669922, -68.9197006225586, -77.02045440673828, 31 -26.158037185668945, 89.0337142944336, -45.89653396606445, 32 43.84803771972656, 48.81806945800781, 51.79948425292969, 33 41.94132614135742, -1.1303654909133911, -50.42131042480469, 34 90.2870101928711, 55.620765686035156, 44.92119598388672, 35 56.828636169433594, 10.829925537109375, -19.693084716796875, 36 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 37 -7.699817180633545, 25.76774024963379, 73.60064697265625 38 ], 39 'descriptor': {shape: [24], dataType: 'float32'} 40 }, 41 'gatherIndices': { 42 'data': [4], 43 'descriptor': {shape: [], dataType: 'uint32'}, 44 'constant': true 45 } 46 }, 47 'operators': [{ 48 'name': 'gather', 49 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 50 'outputs': 'gatherOutput' 51 }], 52 'expectedOutputs': { 53 'gatherOutput': { 54 'data': [89.0337142944336], 55 'descriptor': {shape: [], dataType: 'float32'} 56 } 57 } 58 } 59 }, 60 { 61 'name': 62 'gather float32 1D tensor and int64 0D scalar indices default options', 63 'graph': { 64 'inputs': { 65 'gatherInput': { 66 'data': [ 67 -66.05901336669922, -68.9197006225586, -77.02045440673828, 68 -26.158037185668945, 89.0337142944336, -45.89653396606445, 69 43.84803771972656, 48.81806945800781, 51.79948425292969, 70 41.94132614135742, -1.1303654909133911, -50.42131042480469, 71 90.2870101928711, 55.620765686035156, 44.92119598388672, 72 56.828636169433594, 10.829925537109375, -19.693084716796875, 73 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 74 -7.699817180633545, 25.76774024963379, 73.60064697265625 75 ], 76 'descriptor': {shape: [24], dataType: 'float32'} 77 }, 78 'gatherIndices': { 79 'data': [4], 80 'descriptor': {shape: [], dataType: 'int64'}, 81 'constant': true 82 } 83 }, 84 'operators': [{ 85 'name': 'gather', 86 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 87 'outputs': 'gatherOutput' 88 }], 89 'expectedOutputs': { 90 'gatherOutput': { 91 'data': [89.0337142944336], 92 'descriptor': {shape: [], dataType: 'float32'} 93 } 94 } 95 } 96 }, 97 { 98 'name': 99 'gather float32 1D tensor and int32 0D scalar indices default options', 100 'graph': { 101 'inputs': { 102 'gatherInput': { 103 'data': [ 104 -66.05901336669922, -68.9197006225586, -77.02045440673828, 105 -26.158037185668945, 89.0337142944336, -45.89653396606445, 106 43.84803771972656, 48.81806945800781, 51.79948425292969, 107 41.94132614135742, -1.1303654909133911, -50.42131042480469, 108 90.2870101928711, 55.620765686035156, 44.92119598388672, 109 56.828636169433594, 10.829925537109375, -19.693084716796875, 110 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 111 -7.699817180633545, 25.76774024963379, 73.60064697265625 112 ], 113 'descriptor': {shape: [24], dataType: 'float32'} 114 }, 115 'gatherIndices': { 116 'data': [4], 117 'descriptor': {shape: [], dataType: 'int32'}, 118 'constant': true 119 } 120 }, 121 'operators': [{ 122 'name': 'gather', 123 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 124 'outputs': 'gatherOutput' 125 }], 126 'expectedOutputs': { 127 'gatherOutput': { 128 'data': [89.0337142944336], 129 'descriptor': {shape: [], dataType: 'float32'} 130 } 131 } 132 } 133 }, 134 { 135 'name': 'gather float32 1D tensor and int32 1D indices default options', 136 'graph': { 137 'inputs': { 138 'gatherInput': { 139 'data': [ 140 -66.05901336669922, -68.9197006225586, -77.02045440673828, 141 -26.158037185668945, 89.0337142944336, -45.89653396606445, 142 43.84803771972656, 48.81806945800781, 51.79948425292969, 143 41.94132614135742, -1.1303654909133911, -50.42131042480469, 144 90.2870101928711, 55.620765686035156, 44.92119598388672, 145 56.828636169433594, 10.829925537109375, -19.693084716796875, 146 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 147 -7.699817180633545, 25.76774024963379, 73.60064697265625 148 ], 149 'descriptor': {shape: [24], dataType: 'float32'} 150 }, 151 'gatherIndices': { 152 'data': [16, 20, 6, 11, 17, 19, 13, 17], 153 'descriptor': {shape: [8], dataType: 'int32'}, 154 'constant': true 155 } 156 }, 157 'operators': [{ 158 'name': 'gather', 159 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 160 'outputs': 'gatherOutput' 161 }], 162 'expectedOutputs': { 163 'gatherOutput': { 164 'data': [ 165 10.829925537109375, 0.9129875898361206, 43.84803771972656, 166 -50.42131042480469, -19.693084716796875, 43.11057662963867, 167 55.620765686035156, -19.693084716796875 168 ], 169 'descriptor': {shape: [8], dataType: 'float32'} 170 } 171 } 172 } 173 }, 174 { 175 'name': 'gather float32 1D tensor and int32 2D indices default options', 176 'graph': { 177 'inputs': { 178 'gatherInput': { 179 'data': [ 180 -66.05901336669922, -68.9197006225586, -77.02045440673828, 181 -26.158037185668945, 89.0337142944336, -45.89653396606445, 182 43.84803771972656, 48.81806945800781, 51.79948425292969, 183 41.94132614135742, -1.1303654909133911, -50.42131042480469, 184 90.2870101928711, 55.620765686035156, 44.92119598388672, 185 56.828636169433594, 10.829925537109375, -19.693084716796875, 186 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 187 -7.699817180633545, 25.76774024963379, 73.60064697265625 188 ], 189 'descriptor': {shape: [24], dataType: 'float32'} 190 }, 191 'gatherIndices': { 192 'data': [14, 9, 21, 17], 193 'descriptor': {shape: [2, 2], dataType: 'int32'}, 194 'constant': true 195 } 196 }, 197 'operators': [{ 198 'name': 'gather', 199 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 200 'outputs': 'gatherOutput' 201 }], 202 'expectedOutputs': { 203 'gatherOutput': { 204 'data': [ 205 44.92119598388672, 41.94132614135742, -7.699817180633545, 206 -19.693084716796875 207 ], 208 'descriptor': {shape: [2, 2], dataType: 'float32'} 209 } 210 } 211 } 212 }, 213 { 214 'name': 'gather float32 1D tensor and int32 3D indices default options', 215 'graph': { 216 'inputs': { 217 'gatherInput': { 218 'data': [ 219 -66.05901336669922, -68.9197006225586, -77.02045440673828, 220 -26.158037185668945, 89.0337142944336, -45.89653396606445, 221 43.84803771972656, 48.81806945800781, 51.79948425292969, 222 41.94132614135742, -1.1303654909133911, -50.42131042480469, 223 90.2870101928711, 55.620765686035156, 44.92119598388672, 224 56.828636169433594, 10.829925537109375, -19.693084716796875, 225 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 226 -7.699817180633545, 25.76774024963379, 73.60064697265625 227 ], 228 'descriptor': {shape: [24], dataType: 'float32'} 229 }, 230 'gatherIndices': { 231 'data': 232 [17, 19, 14, 16, 13, 0, 5, 15, 18, 18, 6, 20, 7, 22, 5, 1, 4, 19], 233 'descriptor': {shape: [2, 3, 3], dataType: 'int32'}, 234 'constant': true 235 } 236 }, 237 'operators': [{ 238 'name': 'gather', 239 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 240 'outputs': 'gatherOutput' 241 }], 242 'expectedOutputs': { 243 'gatherOutput': { 244 'data': [ 245 -19.693084716796875, 43.11057662963867, 44.92119598388672, 246 10.829925537109375, 55.620765686035156, -66.05901336669922, 247 -45.89653396606445, 56.828636169433594, -37.696800231933594, 248 -37.696800231933594, 43.84803771972656, 0.9129875898361206, 249 48.81806945800781, 25.76774024963379, -45.89653396606445, 250 -68.9197006225586, 89.0337142944336, 43.11057662963867 251 ], 252 'descriptor': {shape: [2, 3, 3], dataType: 'float32'} 253 } 254 } 255 } 256 }, 257 { 258 'name': 'gather float32 1D tensor and int32 4D indices default options', 259 'graph': { 260 'inputs': { 261 'gatherInput': { 262 'data': [ 263 -66.05901336669922, -68.9197006225586, -77.02045440673828, 264 -26.158037185668945, 89.0337142944336, -45.89653396606445, 265 43.84803771972656, 48.81806945800781, 51.79948425292969, 266 41.94132614135742, -1.1303654909133911, -50.42131042480469, 267 90.2870101928711, 55.620765686035156, 44.92119598388672, 268 56.828636169433594, 10.829925537109375, -19.693084716796875, 269 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 270 -7.699817180633545, 25.76774024963379, 73.60064697265625 271 ], 272 'descriptor': {shape: [24], dataType: 'float32'} 273 }, 274 'gatherIndices': { 275 'data': [18, 18, 22, 11, 8, 15, 12, 11, 7, 13, 7, 7], 276 'descriptor': {shape: [1, 2, 2, 3], dataType: 'int32'}, 277 'constant': true 278 } 279 }, 280 'operators': [{ 281 'name': 'gather', 282 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 283 'outputs': 'gatherOutput' 284 }], 285 'expectedOutputs': { 286 'gatherOutput': { 287 'data': [ 288 -37.696800231933594, -37.696800231933594, 25.76774024963379, 289 -50.42131042480469, 51.79948425292969, 56.828636169433594, 290 90.2870101928711, -50.42131042480469, 48.81806945800781, 291 55.620765686035156, 48.81806945800781, 48.81806945800781 292 ], 293 'descriptor': {shape: [1, 2, 2, 3], dataType: 'float32'} 294 } 295 } 296 } 297 }, 298 { 299 'name': 'gather float32 2D tensor and 0D scalar indices default options', 300 'graph': { 301 'inputs': { 302 'gatherInput': { 303 'data': [ 304 -66.05901336669922, -68.9197006225586, -77.02045440673828, 305 -26.158037185668945, 89.0337142944336, -45.89653396606445, 306 43.84803771972656, 48.81806945800781, 51.79948425292969, 307 41.94132614135742, -1.1303654909133911, -50.42131042480469, 308 90.2870101928711, 55.620765686035156, 44.92119598388672, 309 56.828636169433594, 10.829925537109375, -19.693084716796875, 310 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 311 -7.699817180633545, 25.76774024963379, 73.60064697265625 312 ], 313 'descriptor': {shape: [12, 2], dataType: 'float32'} 314 }, 315 'gatherIndices': { 316 'data': [11], 317 'descriptor': {shape: [], dataType: 'int32'}, 318 'constant': true 319 } 320 }, 321 'operators': [{ 322 'name': 'gather', 323 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 324 'outputs': 'gatherOutput' 325 }], 326 'expectedOutputs': { 327 'gatherOutput': { 328 'data': [25.76774024963379, 73.60064697265625], 329 'descriptor': {shape: [2], dataType: 'float32'} 330 } 331 } 332 } 333 }, 334 { 335 'name': 'gather float32 2D tensor and 1D indices default options', 336 'graph': { 337 'inputs': { 338 'gatherInput': { 339 'data': [ 340 -66.05901336669922, -68.9197006225586, -77.02045440673828, 341 -26.158037185668945, 89.0337142944336, -45.89653396606445, 342 43.84803771972656, 48.81806945800781, 51.79948425292969, 343 41.94132614135742, -1.1303654909133911, -50.42131042480469, 344 90.2870101928711, 55.620765686035156, 44.92119598388672, 345 56.828636169433594, 10.829925537109375, -19.693084716796875, 346 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 347 -7.699817180633545, 25.76774024963379, 73.60064697265625 348 ], 349 'descriptor': {shape: [12, 2], dataType: 'float32'} 350 }, 351 'gatherIndices': { 352 'data': [1, 10, 9, 0, 3, 5, 3, 8], 353 'descriptor': {shape: [8], dataType: 'int32'}, 354 'constant': true 355 } 356 }, 357 'operators': [{ 358 'name': 'gather', 359 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 360 'outputs': 'gatherOutput' 361 }], 362 'expectedOutputs': { 363 'gatherOutput': { 364 'data': [ 365 -77.02045440673828, -26.158037185668945, 0.9129875898361206, 366 -7.699817180633545, -37.696800231933594, 43.11057662963867, 367 -66.05901336669922, -68.9197006225586, 43.84803771972656, 368 48.81806945800781, -1.1303654909133911, -50.42131042480469, 369 43.84803771972656, 48.81806945800781, 10.829925537109375, 370 -19.693084716796875 371 ], 372 'descriptor': {shape: [8, 2], dataType: 'float32'} 373 } 374 } 375 } 376 }, 377 { 378 'name': 'gather float32 2D tensor and 2D indices default options', 379 'graph': { 380 'inputs': { 381 'gatherInput': { 382 'data': [ 383 -66.05901336669922, -68.9197006225586, -77.02045440673828, 384 -26.158037185668945, 89.0337142944336, -45.89653396606445, 385 43.84803771972656, 48.81806945800781, 51.79948425292969, 386 41.94132614135742, -1.1303654909133911, -50.42131042480469, 387 90.2870101928711, 55.620765686035156, 44.92119598388672, 388 56.828636169433594, 10.829925537109375, -19.693084716796875, 389 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 390 -7.699817180633545, 25.76774024963379, 73.60064697265625 391 ], 392 'descriptor': {shape: [12, 2], dataType: 'float32'} 393 }, 394 'gatherIndices': { 395 'data': [4, 8, 9, 10], 396 'descriptor': {shape: [2, 2], dataType: 'int32'}, 397 'constant': true 398 } 399 }, 400 'operators': [{ 401 'name': 'gather', 402 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 403 'outputs': 'gatherOutput' 404 }], 405 'expectedOutputs': { 406 'gatherOutput': { 407 'data': [ 408 51.79948425292969, 41.94132614135742, 10.829925537109375, 409 -19.693084716796875, -37.696800231933594, 43.11057662963867, 410 0.9129875898361206, -7.699817180633545 411 ], 412 'descriptor': {shape: [2, 2, 2], dataType: 'float32'} 413 } 414 } 415 } 416 }, 417 { 418 'name': 'gather float32 2D tensor and 3D indices default options', 419 'graph': { 420 'inputs': { 421 'gatherInput': { 422 'data': [ 423 -66.05901336669922, -68.9197006225586, -77.02045440673828, 424 -26.158037185668945, 89.0337142944336, -45.89653396606445, 425 43.84803771972656, 48.81806945800781, 51.79948425292969, 426 41.94132614135742, -1.1303654909133911, -50.42131042480469, 427 90.2870101928711, 55.620765686035156, 44.92119598388672, 428 56.828636169433594, 10.829925537109375, -19.693084716796875, 429 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 430 -7.699817180633545, 25.76774024963379, 73.60064697265625 431 ], 432 'descriptor': {shape: [12, 2], dataType: 'float32'} 433 }, 434 'gatherIndices': { 435 'data': [8, 2, 2, 3, 4, 1, 2, 2, 7, 11, 4, 11, 6, 6, 7, 3, 11, 10], 436 'descriptor': {shape: [2, 3, 3], dataType: 'int32'}, 437 'constant': true 438 } 439 }, 440 'operators': [{ 441 'name': 'gather', 442 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 443 'outputs': 'gatherOutput' 444 }], 445 'expectedOutputs': { 446 'gatherOutput': { 447 'data': [ 448 10.829925537109375, -19.693084716796875, 89.0337142944336, 449 -45.89653396606445, 89.0337142944336, -45.89653396606445, 450 43.84803771972656, 48.81806945800781, 51.79948425292969, 451 41.94132614135742, -77.02045440673828, -26.158037185668945, 452 89.0337142944336, -45.89653396606445, 89.0337142944336, 453 -45.89653396606445, 44.92119598388672, 56.828636169433594, 454 25.76774024963379, 73.60064697265625, 51.79948425292969, 455 41.94132614135742, 25.76774024963379, 73.60064697265625, 456 90.2870101928711, 55.620765686035156, 90.2870101928711, 457 55.620765686035156, 44.92119598388672, 56.828636169433594, 458 43.84803771972656, 48.81806945800781, 25.76774024963379, 459 73.60064697265625, 0.9129875898361206, -7.699817180633545 460 ], 461 'descriptor': {shape: [2, 3, 3, 2], dataType: 'float32'} 462 } 463 } 464 } 465 }, 466 { 467 'name': 'gather float32 2D tensor and 4D indices default options', 468 'graph': { 469 'inputs': { 470 'gatherInput': { 471 'data': [ 472 -66.05901336669922, -68.9197006225586, -77.02045440673828, 473 -26.158037185668945, 89.0337142944336, -45.89653396606445, 474 43.84803771972656, 48.81806945800781, 51.79948425292969, 475 41.94132614135742, -1.1303654909133911, -50.42131042480469, 476 90.2870101928711, 55.620765686035156, 44.92119598388672, 477 56.828636169433594, 10.829925537109375, -19.693084716796875, 478 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 479 -7.699817180633545, 25.76774024963379, 73.60064697265625 480 ], 481 'descriptor': {shape: [12, 2], dataType: 'float32'} 482 }, 483 'gatherIndices': { 484 'data': [6, 9, 7, 3, 4, 7, 4, 3, 7, 7, 6, 0], 485 'descriptor': {shape: [1, 2, 2, 3], dataType: 'int32'}, 486 'constant': true 487 } 488 }, 489 'operators': [{ 490 'name': 'gather', 491 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 492 'outputs': 'gatherOutput' 493 }], 494 'expectedOutputs': { 495 'gatherOutput': { 496 'data': [ 497 90.2870101928711, 55.620765686035156, -37.696800231933594, 498 43.11057662963867, 44.92119598388672, 56.828636169433594, 499 43.84803771972656, 48.81806945800781, 51.79948425292969, 500 41.94132614135742, 44.92119598388672, 56.828636169433594, 501 51.79948425292969, 41.94132614135742, 43.84803771972656, 502 48.81806945800781, 44.92119598388672, 56.828636169433594, 503 44.92119598388672, 56.828636169433594, 90.2870101928711, 504 55.620765686035156, -66.05901336669922, -68.9197006225586 505 ], 506 'descriptor': {shape: [1, 2, 2, 3, 2], dataType: 'float32'} 507 } 508 } 509 } 510 }, 511 { 512 'name': 'gather float32 3D tensor and 2D indices default options', 513 'graph': { 514 'inputs': { 515 'gatherInput': { 516 'data': [ 517 -66.05901336669922, -68.9197006225586, -77.02045440673828, 518 -26.158037185668945, 89.0337142944336, -45.89653396606445, 519 43.84803771972656, 48.81806945800781, 51.79948425292969, 520 41.94132614135742, -1.1303654909133911, -50.42131042480469, 521 90.2870101928711, 55.620765686035156, 44.92119598388672, 522 56.828636169433594, 10.829925537109375, -19.693084716796875, 523 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 524 -7.699817180633545, 25.76774024963379, 73.60064697265625 525 ], 526 'descriptor': {shape: [3, 4, 2], dataType: 'float32'} 527 }, 528 'gatherIndices': { 529 'data': [2, 1, 1, 1], 530 'descriptor': {shape: [2, 2], dataType: 'int32'}, 531 'constant': true 532 } 533 }, 534 'operators': [{ 535 'name': 'gather', 536 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 537 'outputs': 'gatherOutput' 538 }], 539 'expectedOutputs': { 540 'gatherOutput': { 541 'data': [ 542 10.829925537109375, -19.693084716796875, -37.696800231933594, 543 43.11057662963867, 0.9129875898361206, -7.699817180633545, 544 25.76774024963379, 73.60064697265625, 51.79948425292969, 545 41.94132614135742, -1.1303654909133911, -50.42131042480469, 546 90.2870101928711, 55.620765686035156, 44.92119598388672, 547 56.828636169433594, 51.79948425292969, 41.94132614135742, 548 -1.1303654909133911, -50.42131042480469, 90.2870101928711, 549 55.620765686035156, 44.92119598388672, 56.828636169433594, 550 51.79948425292969, 41.94132614135742, -1.1303654909133911, 551 -50.42131042480469, 90.2870101928711, 55.620765686035156, 552 44.92119598388672, 56.828636169433594 553 ], 554 'descriptor': {shape: [2, 2, 4, 2], dataType: 'float32'} 555 } 556 } 557 } 558 }, 559 { 560 'name': 'gather float32 4D tensor and 2D indices default options', 561 'graph': { 562 'inputs': { 563 'gatherInput': { 564 'data': [ 565 -66.05901336669922, -68.9197006225586, -77.02045440673828, 566 -26.158037185668945, 89.0337142944336, -45.89653396606445, 567 43.84803771972656, 48.81806945800781, 51.79948425292969, 568 41.94132614135742, -1.1303654909133911, -50.42131042480469, 569 90.2870101928711, 55.620765686035156, 44.92119598388672, 570 56.828636169433594, 10.829925537109375, -19.693084716796875, 571 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 572 -7.699817180633545, 25.76774024963379, 73.60064697265625 573 ], 574 'descriptor': {shape: [8, 1, 1, 3], dataType: 'float32'} 575 }, 576 'gatherIndices': { 577 'data': [0, 0, 7, 4], 578 'descriptor': {shape: [2, 2], dataType: 'int32'}, 579 'constant': true 580 } 581 }, 582 'operators': [{ 583 'name': 'gather', 584 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 585 'outputs': 'gatherOutput' 586 }], 587 'expectedOutputs': { 588 'gatherOutput': { 589 'data': [ 590 -66.05901336669922, -68.9197006225586, -77.02045440673828, 591 -66.05901336669922, -68.9197006225586, -77.02045440673828, 592 -7.699817180633545, 25.76774024963379, 73.60064697265625, 593 90.2870101928711, 55.620765686035156, 44.92119598388672 594 ], 595 'descriptor': {shape: [2, 2, 1, 1, 3], dataType: 'float32'} 596 } 597 } 598 } 599 }, 600 { 601 'name': 'gather float32 5D tensor and 1D indices default options', 602 'graph': { 603 'inputs': { 604 'gatherInput': { 605 'data': [ 606 -66.05901336669922, -68.9197006225586, -77.02045440673828, 607 -26.158037185668945, 89.0337142944336, -45.89653396606445, 608 43.84803771972656, 48.81806945800781, 51.79948425292969, 609 41.94132614135742, -1.1303654909133911, -50.42131042480469, 610 90.2870101928711, 55.620765686035156, 44.92119598388672, 611 56.828636169433594, 10.829925537109375, -19.693084716796875, 612 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 613 -7.699817180633545, 25.76774024963379, 73.60064697265625 614 ], 615 'descriptor': {shape: [4, 2, 1, 1, 3], dataType: 'float32'} 616 }, 617 'gatherIndices': { 618 'data': [3, 2, 2], 619 'descriptor': {shape: [3], dataType: 'int32'}, 620 'constant': true 621 } 622 }, 623 'operators': [{ 624 'name': 'gather', 625 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 626 'outputs': 'gatherOutput' 627 }], 628 'expectedOutputs': { 629 'gatherOutput': { 630 'data': [ 631 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 632 -7.699817180633545, 25.76774024963379, 73.60064697265625, 633 90.2870101928711, 55.620765686035156, 44.92119598388672, 634 56.828636169433594, 10.829925537109375, -19.693084716796875, 635 90.2870101928711, 55.620765686035156, 44.92119598388672, 636 56.828636169433594, 10.829925537109375, -19.693084716796875 637 ], 638 'descriptor': {shape: [3, 2, 1, 1, 3], dataType: 'float32'} 639 } 640 } 641 } 642 }, 643 { 644 'name': 'gather float32 3D tensor and 1D indices options.axis=1', 645 'graph': { 646 'inputs': { 647 'gatherInput': { 648 'data': [ 649 -66.05901336669922, -68.9197006225586, -77.02045440673828, 650 -26.158037185668945, 89.0337142944336, -45.89653396606445, 651 43.84803771972656, 48.81806945800781, 51.79948425292969, 652 41.94132614135742, -1.1303654909133911, -50.42131042480469, 653 90.2870101928711, 55.620765686035156, 44.92119598388672, 654 56.828636169433594, 10.829925537109375, -19.693084716796875, 655 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 656 -7.699817180633545, 25.76774024963379, 73.60064697265625 657 ], 658 'descriptor': {shape: [3, 4, 2], dataType: 'float32'} 659 }, 660 'gatherIndices': { 661 'data': [1, 1, 2], 662 'descriptor': {shape: [3], dataType: 'int32'}, 663 'constant': true 664 } 665 }, 666 'operators': [{ 667 'name': 'gather', 668 'arguments': [ 669 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 670 {'options': {'axis': 1}} 671 ], 672 'outputs': 'gatherOutput' 673 }], 674 'expectedOutputs': { 675 'gatherOutput': { 676 'data': [ 677 -77.02045440673828, -26.158037185668945, -77.02045440673828, 678 -26.158037185668945, 89.0337142944336, -45.89653396606445, 679 -1.1303654909133911, -50.42131042480469, -1.1303654909133911, 680 -50.42131042480469, 90.2870101928711, 55.620765686035156, 681 -37.696800231933594, 43.11057662963867, -37.696800231933594, 682 43.11057662963867, 0.9129875898361206, -7.699817180633545 683 ], 684 'descriptor': {shape: [3, 3, 2], dataType: 'float32'} 685 } 686 } 687 } 688 }, 689 { 690 'name': 'gather float32 3D tensor and 2D indices options.axis=2', 691 'graph': { 692 'inputs': { 693 'gatherInput': { 694 'data': [ 695 -66.05901336669922, -68.9197006225586, -77.02045440673828, 696 -26.158037185668945, 89.0337142944336, -45.89653396606445, 697 43.84803771972656, 48.81806945800781, 51.79948425292969, 698 41.94132614135742, -1.1303654909133911, -50.42131042480469, 699 90.2870101928711, 55.620765686035156, 44.92119598388672, 700 56.828636169433594, 10.829925537109375, -19.693084716796875, 701 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 702 -7.699817180633545, 25.76774024963379, 73.60064697265625 703 ], 704 'descriptor': {shape: [3, 4, 2], dataType: 'float32'} 705 }, 706 'gatherIndices': { 707 'data': [0, 0, 0, 1], 708 'descriptor': {shape: [2, 2], dataType: 'int32'}, 709 'constant': true 710 } 711 }, 712 'operators': [{ 713 'name': 'gather', 714 'arguments': [ 715 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 716 {'options': {'axis': 2}} 717 ], 718 'outputs': 'gatherOutput' 719 }], 720 'expectedOutputs': { 721 'gatherOutput': { 722 'data': [ 723 -66.05901336669922, -66.05901336669922, -66.05901336669922, 724 -68.9197006225586, -77.02045440673828, -77.02045440673828, 725 -77.02045440673828, -26.158037185668945, 89.0337142944336, 726 89.0337142944336, 89.0337142944336, -45.89653396606445, 727 43.84803771972656, 43.84803771972656, 43.84803771972656, 728 48.81806945800781, 51.79948425292969, 51.79948425292969, 729 51.79948425292969, 41.94132614135742, -1.1303654909133911, 730 -1.1303654909133911, -1.1303654909133911, -50.42131042480469, 731 90.2870101928711, 90.2870101928711, 90.2870101928711, 732 55.620765686035156, 44.92119598388672, 44.92119598388672, 733 44.92119598388672, 56.828636169433594, 10.829925537109375, 734 10.829925537109375, 10.829925537109375, -19.693084716796875, 735 -37.696800231933594, -37.696800231933594, -37.696800231933594, 736 43.11057662963867, 0.9129875898361206, 0.9129875898361206, 737 0.9129875898361206, -7.699817180633545, 25.76774024963379, 738 25.76774024963379, 25.76774024963379, 73.60064697265625 739 ], 740 'descriptor': {shape: [3, 4, 2, 2], dataType: 'float32'} 741 } 742 } 743 } 744 }, 745 { 746 'name': 'gather float32 4D tensor and 2D indices explict options.axis=0', 747 'graph': { 748 'inputs': { 749 'gatherInput': { 750 'data': [ 751 -66.05901336669922, -68.9197006225586, -77.02045440673828, 752 -26.158037185668945, 89.0337142944336, -45.89653396606445, 753 43.84803771972656, 48.81806945800781, 51.79948425292969, 754 41.94132614135742, -1.1303654909133911, -50.42131042480469, 755 90.2870101928711, 55.620765686035156, 44.92119598388672, 756 56.828636169433594, 10.829925537109375, -19.693084716796875, 757 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 758 -7.699817180633545, 25.76774024963379, 73.60064697265625 759 ], 760 'descriptor': {shape: [8, 1, 1, 3], dataType: 'float32'} 761 }, 762 'gatherIndices': { 763 'data': [0, 0, 7, 4], 764 'descriptor': {shape: [2, 2], dataType: 'int32'}, 765 'constant': true 766 } 767 }, 768 'operators': [{ 769 'name': 'gather', 770 'arguments': [ 771 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 772 {'options': {'axis': 0}} 773 ], 774 'outputs': 'gatherOutput' 775 }], 776 'expectedOutputs': { 777 'gatherOutput': { 778 'data': [ 779 -66.05901336669922, -68.9197006225586, -77.02045440673828, 780 -66.05901336669922, -68.9197006225586, -77.02045440673828, 781 -7.699817180633545, 25.76774024963379, 73.60064697265625, 782 90.2870101928711, 55.620765686035156, 44.92119598388672 783 ], 784 'descriptor': {shape: [2, 2, 1, 1, 3], dataType: 'float32'} 785 } 786 } 787 } 788 }, 789 { 790 'name': 'gather float32 5D tensor and 0D scalar indices options.axis=4', 791 'graph': { 792 'inputs': { 793 'gatherInput': { 794 'data': [ 795 -66.05901336669922, -68.9197006225586, -77.02045440673828, 796 -26.158037185668945, 89.0337142944336, -45.89653396606445, 797 43.84803771972656, 48.81806945800781, 51.79948425292969, 798 41.94132614135742, -1.1303654909133911, -50.42131042480469, 799 90.2870101928711, 55.620765686035156, 44.92119598388672, 800 56.828636169433594, 10.829925537109375, -19.693084716796875, 801 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 802 -7.699817180633545, 25.76774024963379, 73.60064697265625 803 ], 804 'descriptor': {shape: [4, 2, 1, 1, 3], dataType: 'float32'} 805 }, 806 'gatherIndices': { 807 'data': [1], 808 'descriptor': {shape: [], dataType: 'int32'}, 809 'constant': true 810 } 811 }, 812 'operators': [{ 813 'name': 'gather', 814 'arguments': [ 815 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 816 {'options': {'axis': 4}} 817 ], 818 'outputs': 'gatherOutput' 819 }], 820 'expectedOutputs': { 821 'gatherOutput': { 822 'data': [ 823 -68.9197006225586, 89.0337142944336, 48.81806945800781, 824 -1.1303654909133911, 55.620765686035156, 10.829925537109375, 825 43.11057662963867, 25.76774024963379 826 ], 827 'descriptor': {shape: [4, 2, 1, 1], dataType: 'float32'} 828 } 829 } 830 } 831 }, 832 { 833 'name': 834 'gather float32 2D tensor and int32 0D negative indices default options', 835 'graph': { 836 'inputs': { 837 'gatherInput': { 838 'data': [ 839 -66.05901336669922, -68.9197006225586, -77.02045440673828, 840 -26.158037185668945, 89.0337142944336, -45.89653396606445, 841 43.84803771972656, 48.81806945800781, 51.79948425292969, 842 41.94132614135742, -1.1303654909133911, -50.42131042480469, 843 90.2870101928711, 55.620765686035156, 44.92119598388672, 844 56.828636169433594, 10.829925537109375, -19.693084716796875, 845 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 846 -7.699817180633545, 25.76774024963379, 73.60064697265625 847 ], 848 'descriptor': {shape: [2, 12], dataType: 'float32'} 849 }, 850 'gatherIndices': { 851 'data': [-2], 852 'descriptor': {shape: [], dataType: 'int32'}, 853 'constant': true 854 } 855 }, 856 'operators': [{ 857 'name': 'gather', 858 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 859 'outputs': 'gatherOutput' 860 }], 861 'expectedOutputs': { 862 'gatherOutput': { 863 'data': [ 864 -66.05901336669922, -68.9197006225586, -77.02045440673828, 865 -26.158037185668945, 89.0337142944336, -45.89653396606445, 866 43.84803771972656, 48.81806945800781, 51.79948425292969, 867 41.94132614135742, -1.1303654909133911, -50.42131042480469 868 ], 869 'descriptor': {shape: [12], dataType: 'float32'} 870 } 871 } 872 } 873 }, 874 { 875 'name': 876 'gather float32 2D tensor and int32 0D out-of-bound positive indices default options', 877 'graph': { 878 'inputs': { 879 'gatherInput': { 880 'data': [ 881 -66.05901336669922, -68.9197006225586, -77.02045440673828, 882 -26.158037185668945, 89.0337142944336, -45.89653396606445, 883 43.84803771972656, 48.81806945800781, 51.79948425292969, 884 41.94132614135742, -1.1303654909133911, -50.42131042480469, 885 90.2870101928711, 55.620765686035156, 44.92119598388672, 886 56.828636169433594, 10.829925537109375, -19.693084716796875, 887 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 888 -7.699817180633545, 25.76774024963379, 73.60064697265625 889 ], 890 'descriptor': {shape: [2, 12], dataType: 'float32'} 891 }, 892 'gatherIndices': { 893 'data': [10], 894 'descriptor': {shape: [], dataType: 'int32'}, 895 'constant': true 896 } 897 }, 898 'operators': [{ 899 'name': 'gather', 900 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 901 'outputs': 'gatherOutput' 902 }], 903 'expectedOutputs': { 904 'gatherOutput': { 905 'data': [ 906 90.2870101928711, 55.620765686035156, 44.92119598388672, 907 56.828636169433594, 10.829925537109375, -19.693084716796875, 908 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 909 -7.699817180633545, 25.76774024963379, 73.60064697265625 910 ], 911 'descriptor': {shape: [12], dataType: 'float32'} 912 } 913 } 914 } 915 }, 916 { 917 'name': 918 'gather float32 2D tensor and int32 0D out-of-bound negative indices default options', 919 'graph': { 920 'inputs': { 921 'gatherInput': { 922 'data': [ 923 -66.05901336669922, -68.9197006225586, -77.02045440673828, 924 -26.158037185668945, 89.0337142944336, -45.89653396606445, 925 43.84803771972656, 48.81806945800781, 51.79948425292969, 926 41.94132614135742, -1.1303654909133911, -50.42131042480469, 927 90.2870101928711, 55.620765686035156, 44.92119598388672, 928 56.828636169433594, 10.829925537109375, -19.693084716796875, 929 -37.696800231933594, 43.11057662963867, 0.9129875898361206, 930 -7.699817180633545, 25.76774024963379, 73.60064697265625 931 ], 932 'descriptor': {shape: [2, 12], dataType: 'float32'} 933 }, 934 'gatherIndices': { 935 'data': [-10], 936 'descriptor': {shape: [], dataType: 'int32'}, 937 'constant': true 938 } 939 }, 940 'operators': [{ 941 'name': 'gather', 942 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 943 'outputs': 'gatherOutput' 944 }], 945 'expectedOutputs': { 946 'gatherOutput': { 947 'data': [ 948 -66.05901336669922, -68.9197006225586, -77.02045440673828, 949 -26.158037185668945, 89.0337142944336, -45.89653396606445, 950 43.84803771972656, 48.81806945800781, 51.79948425292969, 951 41.94132614135742, -1.1303654909133911, -50.42131042480469 952 ], 953 'descriptor': {shape: [12], dataType: 'float32'} 954 } 955 } 956 } 957 }, 958 959 // float16 tests 960 { 961 'name': 962 'gather float16 1D tensor and uint32 0D scalar indices default options', 963 'graph': { 964 'inputs': { 965 'gatherInput': { 966 'data': [ 967 -66.0625, -68.9375, -77, -26.15625, 89.0625, 968 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 969 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 970 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 971 0.9130859375, -7.69921875, 25.765625, 73.625 972 ], 973 'descriptor': {shape: [24], dataType: 'float16'} 974 }, 975 'gatherIndices': { 976 'data': [4], 977 'descriptor': {shape: [], dataType: 'uint32'}, 978 'constant': true 979 } 980 }, 981 'operators': [{ 982 'name': 'gather', 983 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 984 'outputs': 'gatherOutput' 985 }], 986 'expectedOutputs': { 987 'gatherOutput': 988 {'data': [89.0625], 'descriptor': {shape: [], dataType: 'float16'}} 989 } 990 } 991 }, 992 { 993 'name': 994 'gather float16 1D tensor and int64 0D scalar indices default options', 995 'graph': { 996 'inputs': { 997 'gatherInput': { 998 'data': [ 999 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1000 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1001 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1002 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1003 0.9130859375, -7.69921875, 25.765625, 73.625 1004 ], 1005 'descriptor': {shape: [24], dataType: 'float16'} 1006 }, 1007 'gatherIndices': { 1008 'data': [4], 1009 'descriptor': {shape: [], dataType: 'int64'}, 1010 'constant': true 1011 } 1012 }, 1013 'operators': [{ 1014 'name': 'gather', 1015 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1016 'outputs': 'gatherOutput' 1017 }], 1018 'expectedOutputs': { 1019 'gatherOutput': 1020 {'data': [89.0625], 'descriptor': {shape: [], dataType: 'float16'}} 1021 } 1022 } 1023 }, 1024 { 1025 'name': 1026 'gather float16 1D tensor and int32 0D scalar indices default options', 1027 'graph': { 1028 'inputs': { 1029 'gatherInput': { 1030 'data': [ 1031 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1032 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1033 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1034 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1035 0.9130859375, -7.69921875, 25.765625, 73.625 1036 ], 1037 'descriptor': {shape: [24], dataType: 'float16'} 1038 }, 1039 'gatherIndices': { 1040 'data': [4], 1041 'descriptor': {shape: [], dataType: 'int32'}, 1042 'constant': true 1043 } 1044 }, 1045 'operators': [{ 1046 'name': 'gather', 1047 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1048 'outputs': 'gatherOutput' 1049 }], 1050 'expectedOutputs': { 1051 'gatherOutput': 1052 {'data': [89.0625], 'descriptor': {shape: [], dataType: 'float16'}} 1053 } 1054 } 1055 }, 1056 { 1057 'name': 'gather float16 1D tensor and int32 1D indices default options', 1058 'graph': { 1059 'inputs': { 1060 'gatherInput': { 1061 'data': [ 1062 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1063 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1064 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1065 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1066 0.9130859375, -7.69921875, 25.765625, 73.625 1067 ], 1068 'descriptor': {shape: [24], dataType: 'float16'} 1069 }, 1070 'gatherIndices': { 1071 'data': [16, 20, 6, 11, 17, 19, 13, 17], 1072 'descriptor': {shape: [8], dataType: 'int32'}, 1073 'constant': true 1074 } 1075 }, 1076 'operators': [{ 1077 'name': 'gather', 1078 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1079 'outputs': 'gatherOutput' 1080 }], 1081 'expectedOutputs': { 1082 'gatherOutput': { 1083 'data': [ 1084 10.828125, 0.9130859375, 43.84375, -50.40625, -19.6875, 43.125, 1085 55.625, -19.6875 1086 ], 1087 'descriptor': {shape: [8], dataType: 'float16'} 1088 } 1089 } 1090 } 1091 }, 1092 { 1093 'name': 'gather float16 1D tensor and int32 2D indices default options', 1094 'graph': { 1095 'inputs': { 1096 'gatherInput': { 1097 'data': [ 1098 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1099 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1100 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1101 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1102 0.9130859375, -7.69921875, 25.765625, 73.625 1103 ], 1104 'descriptor': {shape: [24], dataType: 'float16'} 1105 }, 1106 'gatherIndices': { 1107 'data': [14, 9, 21, 17], 1108 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1109 'constant': true 1110 } 1111 }, 1112 'operators': [{ 1113 'name': 'gather', 1114 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1115 'outputs': 'gatherOutput' 1116 }], 1117 'expectedOutputs': { 1118 'gatherOutput': { 1119 'data': [44.90625, 41.9375, -7.69921875, -19.6875], 1120 'descriptor': {shape: [2, 2], dataType: 'float16'} 1121 } 1122 } 1123 } 1124 }, 1125 { 1126 'name': 'gather float16 1D tensor and int32 3D indices default options', 1127 'graph': { 1128 'inputs': { 1129 'gatherInput': { 1130 'data': [ 1131 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1132 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1133 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1134 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1135 0.9130859375, -7.69921875, 25.765625, 73.625 1136 ], 1137 'descriptor': {shape: [24], dataType: 'float16'} 1138 }, 1139 'gatherIndices': { 1140 'data': 1141 [17, 19, 14, 16, 13, 0, 5, 15, 18, 18, 6, 20, 7, 22, 5, 1, 4, 19], 1142 'descriptor': {shape: [2, 3, 3], dataType: 'int32'}, 1143 'constant': true 1144 } 1145 }, 1146 'operators': [{ 1147 'name': 'gather', 1148 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1149 'outputs': 'gatherOutput' 1150 }], 1151 'expectedOutputs': { 1152 'gatherOutput': { 1153 'data': [ 1154 -19.6875, 43.125, 44.90625, 10.828125, 55.625, -66.0625, -45.90625, 1155 56.84375, -37.6875, -37.6875, 43.84375, 0.9130859375, 48.8125, 1156 25.765625, -45.90625, -68.9375, 89.0625, 43.125 1157 ], 1158 'descriptor': {shape: [2, 3, 3], dataType: 'float16'} 1159 } 1160 } 1161 } 1162 }, 1163 { 1164 'name': 'gather float16 1D tensor and int32 4D indices default options', 1165 'graph': { 1166 'inputs': { 1167 'gatherInput': { 1168 'data': [ 1169 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1170 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1171 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1172 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1173 0.9130859375, -7.69921875, 25.765625, 73.625 1174 ], 1175 'descriptor': {shape: [24], dataType: 'float16'} 1176 }, 1177 'gatherIndices': { 1178 'data': [18, 18, 22, 11, 8, 15, 12, 11, 7, 13, 7, 7], 1179 'descriptor': {shape: [1, 2, 2, 3], dataType: 'int32'}, 1180 'constant': true 1181 } 1182 }, 1183 'operators': [{ 1184 'name': 'gather', 1185 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1186 'outputs': 'gatherOutput' 1187 }], 1188 'expectedOutputs': { 1189 'gatherOutput': { 1190 'data': [ 1191 -37.6875, -37.6875, 25.765625, -50.40625, 51.8125, 56.84375, 1192 90.3125, -50.40625, 48.8125, 55.625, 48.8125, 48.8125 1193 ], 1194 'descriptor': {shape: [1, 2, 2, 3], dataType: 'float16'} 1195 } 1196 } 1197 } 1198 }, 1199 { 1200 'name': 'gather float16 2D tensor and 0D scalar indices default options', 1201 'graph': { 1202 'inputs': { 1203 'gatherInput': { 1204 'data': [ 1205 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1206 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1207 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1208 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1209 0.9130859375, -7.69921875, 25.765625, 73.625 1210 ], 1211 'descriptor': {shape: [12, 2], dataType: 'float16'} 1212 }, 1213 'gatherIndices': { 1214 'data': [11], 1215 'descriptor': {shape: [], dataType: 'int32'}, 1216 'constant': true 1217 } 1218 }, 1219 'operators': [{ 1220 'name': 'gather', 1221 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1222 'outputs': 'gatherOutput' 1223 }], 1224 'expectedOutputs': { 1225 'gatherOutput': { 1226 'data': [25.765625, 73.625], 1227 'descriptor': {shape: [2], dataType: 'float16'} 1228 } 1229 } 1230 } 1231 }, 1232 { 1233 'name': 'gather float16 2D tensor and 1D indices default options', 1234 'graph': { 1235 'inputs': { 1236 'gatherInput': { 1237 'data': [ 1238 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1239 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1240 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1241 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1242 0.9130859375, -7.69921875, 25.765625, 73.625 1243 ], 1244 'descriptor': {shape: [12, 2], dataType: 'float16'} 1245 }, 1246 'gatherIndices': { 1247 'data': [1, 10, 9, 0, 3, 5, 3, 8], 1248 'descriptor': {shape: [8], dataType: 'int32'}, 1249 'constant': true 1250 } 1251 }, 1252 'operators': [{ 1253 'name': 'gather', 1254 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1255 'outputs': 'gatherOutput' 1256 }], 1257 'expectedOutputs': { 1258 'gatherOutput': { 1259 'data': [ 1260 -77, -26.15625, 0.9130859375, -7.69921875, -37.6875, 43.125, 1261 -66.0625, -68.9375, 43.84375, 48.8125, -1.1298828125, -50.40625, 1262 43.84375, 48.8125, 10.828125, -19.6875 1263 ], 1264 'descriptor': {shape: [8, 2], dataType: 'float16'} 1265 } 1266 } 1267 } 1268 }, 1269 { 1270 'name': 'gather float16 2D tensor and 2D indices default options', 1271 'graph': { 1272 'inputs': { 1273 'gatherInput': { 1274 'data': [ 1275 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1276 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1277 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1278 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1279 0.9130859375, -7.69921875, 25.765625, 73.625 1280 ], 1281 'descriptor': {shape: [12, 2], dataType: 'float16'} 1282 }, 1283 'gatherIndices': { 1284 'data': [4, 8, 9, 10], 1285 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1286 'constant': true 1287 } 1288 }, 1289 'operators': [{ 1290 'name': 'gather', 1291 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1292 'outputs': 'gatherOutput' 1293 }], 1294 'expectedOutputs': { 1295 'gatherOutput': { 1296 'data': [ 1297 51.8125, 41.9375, 10.828125, -19.6875, -37.6875, 43.125, 1298 0.9130859375, -7.69921875 1299 ], 1300 'descriptor': {shape: [2, 2, 2], dataType: 'float16'} 1301 } 1302 } 1303 } 1304 }, 1305 { 1306 'name': 'gather float16 2D tensor and 3D indices default options', 1307 'graph': { 1308 'inputs': { 1309 'gatherInput': { 1310 'data': [ 1311 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1312 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1313 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1314 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1315 0.9130859375, -7.69921875, 25.765625, 73.625 1316 ], 1317 'descriptor': {shape: [12, 2], dataType: 'float16'} 1318 }, 1319 'gatherIndices': { 1320 'data': [8, 2, 2, 3, 4, 1, 2, 2, 7, 11, 4, 11, 6, 6, 7, 3, 11, 10], 1321 'descriptor': {shape: [2, 3, 3], dataType: 'int32'}, 1322 'constant': true 1323 } 1324 }, 1325 'operators': [{ 1326 'name': 'gather', 1327 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1328 'outputs': 'gatherOutput' 1329 }], 1330 'expectedOutputs': { 1331 'gatherOutput': { 1332 'data': [ 1333 10.828125, -19.6875, 89.0625, -45.90625, 89.0625, 1334 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1335 -77, -26.15625, 89.0625, -45.90625, 89.0625, 1336 -45.90625, 44.90625, 56.84375, 25.765625, 73.625, 1337 51.8125, 41.9375, 25.765625, 73.625, 90.3125, 1338 55.625, 90.3125, 55.625, 44.90625, 56.84375, 1339 43.84375, 48.8125, 25.765625, 73.625, 0.9130859375, 1340 -7.69921875 1341 ], 1342 'descriptor': {shape: [2, 3, 3, 2], dataType: 'float16'} 1343 } 1344 } 1345 } 1346 }, 1347 { 1348 'name': 'gather float16 2D tensor and 4D indices default options', 1349 'graph': { 1350 'inputs': { 1351 'gatherInput': { 1352 'data': [ 1353 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1354 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1355 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1356 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1357 0.9130859375, -7.69921875, 25.765625, 73.625 1358 ], 1359 'descriptor': {shape: [12, 2], dataType: 'float16'} 1360 }, 1361 'gatherIndices': { 1362 'data': [6, 9, 7, 3, 4, 7, 4, 3, 7, 7, 6, 0], 1363 'descriptor': {shape: [1, 2, 2, 3], dataType: 'int32'}, 1364 'constant': true 1365 } 1366 }, 1367 'operators': [{ 1368 'name': 'gather', 1369 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1370 'outputs': 'gatherOutput' 1371 }], 1372 'expectedOutputs': { 1373 'gatherOutput': { 1374 'data': [ 1375 90.3125, 55.625, -37.6875, 43.125, 44.90625, 56.84375, 1376 43.84375, 48.8125, 51.8125, 41.9375, 44.90625, 56.84375, 1377 51.8125, 41.9375, 43.84375, 48.8125, 44.90625, 56.84375, 1378 44.90625, 56.84375, 90.3125, 55.625, -66.0625, -68.9375 1379 ], 1380 'descriptor': {shape: [1, 2, 2, 3, 2], dataType: 'float16'} 1381 } 1382 } 1383 } 1384 }, 1385 { 1386 'name': 'gather float16 3D tensor and 2D indices default options', 1387 'graph': { 1388 'inputs': { 1389 'gatherInput': { 1390 'data': [ 1391 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1392 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1393 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1394 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1395 0.9130859375, -7.69921875, 25.765625, 73.625 1396 ], 1397 'descriptor': {shape: [3, 4, 2], dataType: 'float16'} 1398 }, 1399 'gatherIndices': { 1400 'data': [2, 1, 1, 1], 1401 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1402 'constant': true 1403 } 1404 }, 1405 'operators': [{ 1406 'name': 'gather', 1407 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1408 'outputs': 'gatherOutput' 1409 }], 1410 'expectedOutputs': { 1411 'gatherOutput': { 1412 'data': [ 1413 10.828125, -19.6875, -37.6875, 43.125, 1414 0.9130859375, -7.69921875, 25.765625, 73.625, 1415 51.8125, 41.9375, -1.1298828125, -50.40625, 1416 90.3125, 55.625, 44.90625, 56.84375, 1417 51.8125, 41.9375, -1.1298828125, -50.40625, 1418 90.3125, 55.625, 44.90625, 56.84375, 1419 51.8125, 41.9375, -1.1298828125, -50.40625, 1420 90.3125, 55.625, 44.90625, 56.84375 1421 ], 1422 'descriptor': {shape: [2, 2, 4, 2], dataType: 'float16'} 1423 } 1424 } 1425 } 1426 }, 1427 { 1428 'name': 'gather float16 4D tensor and 2D indices default options', 1429 'graph': { 1430 'inputs': { 1431 'gatherInput': { 1432 'data': [ 1433 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1434 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1435 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1436 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1437 0.9130859375, -7.69921875, 25.765625, 73.625 1438 ], 1439 'descriptor': {shape: [8, 1, 1, 3], dataType: 'float16'} 1440 }, 1441 'gatherIndices': { 1442 'data': [0, 0, 7, 4], 1443 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1444 'constant': true 1445 } 1446 }, 1447 'operators': [{ 1448 'name': 'gather', 1449 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1450 'outputs': 'gatherOutput' 1451 }], 1452 'expectedOutputs': { 1453 'gatherOutput': { 1454 'data': [ 1455 -66.0625, -68.9375, -77, -66.0625, -68.9375, -77, -7.69921875, 1456 25.765625, 73.625, 90.3125, 55.625, 44.90625 1457 ], 1458 'descriptor': {shape: [2, 2, 1, 1, 3], dataType: 'float16'} 1459 } 1460 } 1461 } 1462 }, 1463 { 1464 'name': 'gather float16 5D tensor and 1D indices default options', 1465 'graph': { 1466 'inputs': { 1467 'gatherInput': { 1468 'data': [ 1469 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1470 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1471 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1472 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1473 0.9130859375, -7.69921875, 25.765625, 73.625 1474 ], 1475 'descriptor': {shape: [4, 2, 1, 1, 3], dataType: 'float16'} 1476 }, 1477 'gatherIndices': { 1478 'data': [3, 2, 2], 1479 'descriptor': {shape: [3], dataType: 'int32'}, 1480 'constant': true 1481 } 1482 }, 1483 'operators': [{ 1484 'name': 'gather', 1485 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1486 'outputs': 'gatherOutput' 1487 }], 1488 'expectedOutputs': { 1489 'gatherOutput': { 1490 'data': [ 1491 -37.6875, 43.125, 0.9130859375, -7.69921875, 25.765625, 73.625, 1492 90.3125, 55.625, 44.90625, 56.84375, 10.828125, -19.6875, 90.3125, 1493 55.625, 44.90625, 56.84375, 10.828125, -19.6875 1494 ], 1495 'descriptor': {shape: [3, 2, 1, 1, 3], dataType: 'float16'} 1496 } 1497 } 1498 } 1499 }, 1500 { 1501 'name': 'gather float16 3D tensor and 1D indices options.axis=1', 1502 'graph': { 1503 'inputs': { 1504 'gatherInput': { 1505 'data': [ 1506 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1507 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1508 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1509 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1510 0.9130859375, -7.69921875, 25.765625, 73.625 1511 ], 1512 'descriptor': {shape: [3, 4, 2], dataType: 'float16'} 1513 }, 1514 'gatherIndices': { 1515 'data': [1, 1, 2], 1516 'descriptor': {shape: [3], dataType: 'int32'}, 1517 'constant': true 1518 } 1519 }, 1520 'operators': [{ 1521 'name': 'gather', 1522 'arguments': [ 1523 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 1524 {'options': {'axis': 1}} 1525 ], 1526 'outputs': 'gatherOutput' 1527 }], 1528 'expectedOutputs': { 1529 'gatherOutput': { 1530 'data': [ 1531 -77, -26.15625, -77, -26.15625, 89.0625, -45.90625, -1.1298828125, 1532 -50.40625, -1.1298828125, -50.40625, 90.3125, 55.625, -37.6875, 1533 43.125, -37.6875, 43.125, 0.9130859375, -7.69921875 1534 ], 1535 'descriptor': {shape: [3, 3, 2], dataType: 'float16'} 1536 } 1537 } 1538 } 1539 }, 1540 { 1541 'name': 'gather float16 3D tensor and 2D indices options.axis=2', 1542 'graph': { 1543 'inputs': { 1544 'gatherInput': { 1545 'data': [ 1546 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1547 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1548 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1549 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1550 0.9130859375, -7.69921875, 25.765625, 73.625 1551 ], 1552 'descriptor': {shape: [3, 4, 2], dataType: 'float16'} 1553 }, 1554 'gatherIndices': { 1555 'data': [0, 0, 0, 1], 1556 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1557 'constant': true 1558 } 1559 }, 1560 'operators': [{ 1561 'name': 'gather', 1562 'arguments': [ 1563 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 1564 {'options': {'axis': 2}} 1565 ], 1566 'outputs': 'gatherOutput' 1567 }], 1568 'expectedOutputs': { 1569 'gatherOutput': { 1570 'data': [ 1571 -66.0625, -66.0625, -66.0625, -68.9375, -77, 1572 -77, -77, -26.15625, 89.0625, 89.0625, 1573 89.0625, -45.90625, 43.84375, 43.84375, 43.84375, 1574 48.8125, 51.8125, 51.8125, 51.8125, 41.9375, 1575 -1.1298828125, -1.1298828125, -1.1298828125, -50.40625, 90.3125, 1576 90.3125, 90.3125, 55.625, 44.90625, 44.90625, 1577 44.90625, 56.84375, 10.828125, 10.828125, 10.828125, 1578 -19.6875, -37.6875, -37.6875, -37.6875, 43.125, 1579 0.9130859375, 0.9130859375, 0.9130859375, -7.69921875, 25.765625, 1580 25.765625, 25.765625, 73.625 1581 ], 1582 'descriptor': {shape: [3, 4, 2, 2], dataType: 'float16'} 1583 } 1584 } 1585 } 1586 }, 1587 { 1588 'name': 'gather float16 4D tensor and 2D indices explict options.axis=0', 1589 'graph': { 1590 'inputs': { 1591 'gatherInput': { 1592 'data': [ 1593 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1594 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1595 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1596 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1597 0.9130859375, -7.69921875, 25.765625, 73.625 1598 ], 1599 'descriptor': {shape: [8, 1, 1, 3], dataType: 'float16'} 1600 }, 1601 'gatherIndices': { 1602 'data': [0, 0, 7, 4], 1603 'descriptor': {shape: [2, 2], dataType: 'int32'}, 1604 'constant': true 1605 } 1606 }, 1607 'operators': [{ 1608 'name': 'gather', 1609 'arguments': [ 1610 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 1611 {'options': {'axis': 0}} 1612 ], 1613 'outputs': 'gatherOutput' 1614 }], 1615 'expectedOutputs': { 1616 'gatherOutput': { 1617 'data': [ 1618 -66.0625, -68.9375, -77, -66.0625, -68.9375, -77, -7.69921875, 1619 25.765625, 73.625, 90.3125, 55.625, 44.90625 1620 ], 1621 'descriptor': {shape: [2, 2, 1, 1, 3], dataType: 'float16'} 1622 } 1623 } 1624 } 1625 }, 1626 { 1627 'name': 'gather float16 5D tensor and 0D scalar indices options.axis=4', 1628 'graph': { 1629 'inputs': { 1630 'gatherInput': { 1631 'data': [ 1632 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1633 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1634 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1635 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1636 0.9130859375, -7.69921875, 25.765625, 73.625 1637 ], 1638 'descriptor': {shape: [4, 2, 1, 1, 3], dataType: 'float16'} 1639 }, 1640 'gatherIndices': { 1641 'data': [1], 1642 'descriptor': {shape: [], dataType: 'int32'}, 1643 'constant': true 1644 } 1645 }, 1646 'operators': [{ 1647 'name': 'gather', 1648 'arguments': [ 1649 {'input': 'gatherInput'}, {'indices': 'gatherIndices'}, 1650 {'options': {'axis': 4}} 1651 ], 1652 'outputs': 'gatherOutput' 1653 }], 1654 'expectedOutputs': { 1655 'gatherOutput': { 1656 'data': [ 1657 -68.9375, 89.0625, 48.8125, -1.1298828125, 55.625, 10.828125, 1658 43.125, 25.765625 1659 ], 1660 'descriptor': {shape: [4, 2, 1, 1], dataType: 'float16'} 1661 } 1662 } 1663 } 1664 }, 1665 { 1666 'name': 1667 'gather float16 2D tensor and int32 0D negative indices default options', 1668 'graph': { 1669 'inputs': { 1670 'gatherInput': { 1671 'data': [ 1672 -66.0625, -68.9375, -77, -26.15625, 89.0625, 1673 -45.90625, 43.84375, 48.8125, 51.8125, 41.9375, 1674 -1.1298828125, -50.40625, 90.3125, 55.625, 44.90625, 1675 56.84375, 10.828125, -19.6875, -37.6875, 43.125, 1676 0.9130859375, -7.69921875, 25.765625, 73.625 1677 ], 1678 'descriptor': {shape: [2, 12], dataType: 'float16'} 1679 }, 1680 'gatherIndices': { 1681 'data': [-2], 1682 'descriptor': {shape: [], dataType: 'int32'}, 1683 'constant': true 1684 } 1685 }, 1686 'operators': [{ 1687 'name': 'gather', 1688 'arguments': [{'input': 'gatherInput'}, {'indices': 'gatherIndices'}], 1689 'outputs': 'gatherOutput' 1690 }], 1691 'expectedOutputs': { 1692 'gatherOutput': { 1693 'data': [ 1694 -66.0625, -68.9375, -77, -26.15625, 89.0625, -45.90625, 43.84375, 1695 48.8125, 51.8125, 41.9375, -1.1298828125, -50.40625 1696 ], 1697 'descriptor': {shape: [12], dataType: 'float16'} 1698 } 1699 } 1700 } 1701 } 1702 ]; 1703 1704 webnn_conformance_test(gatherTests, buildAndExecuteGraph, getZeroULPTolerance);