hard_sigmoid.https.any.js (49123B)
1 // META: title=test WebNN API hardSigmoid 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-hard-sigmoid 12 // Calculate the non-smooth hard sigmoid function on the input tensor, used 13 // instead of the sigmoid function for faster computation. 14 // 15 // dictionary MLHardSigmoidOptions { 16 // double alpha = 0.2; 17 // double beta = 0.5; 18 // }; 19 // 20 // MLOperand hardSigmoid( 21 // MLOperand input, optional MLHardSigmoidOptions options = {}); 22 23 const hardSigmoidTests = [ 24 { 25 'name': 'hardSigmoid float32 positive 0D tensor default options', 26 'graph': { 27 'inputs': { 28 'hardSigmoidInput': { 29 'data': [0.05907066911458969], 30 'descriptor': {shape: [], dataType: 'float32'} 31 } 32 }, 33 'operators': [{ 34 'name': 'hardSigmoid', 35 'arguments': [{'input': 'hardSigmoidInput'}], 36 'outputs': 'hardSigmoidOutput' 37 }], 38 'expectedOutputs': { 39 'hardSigmoidOutput': { 40 'data': [0.5118141174316406], 41 'descriptor': {shape: [], dataType: 'float32'} 42 } 43 } 44 } 45 }, 46 { 47 'name': 'hardSigmoid float32 positive 1D constant tensor default options', 48 'graph': { 49 'inputs': { 50 'hardSigmoidInput': { 51 'data': [ 52 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 53 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 54 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 55 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 56 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 57 0.663689911365509, 0.5547611713409424, 0.554258406162262, 58 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 59 0.8455570340156555, 0.555302083492279, 0.5603444576263428 60 ], 61 'descriptor': {shape: [24], dataType: 'float32'} 62 } 63 }, 64 'operators': [{ 65 'name': 'hardSigmoid', 66 'arguments': [{'input': 'hardSigmoidInput'}], 67 'outputs': 'hardSigmoidOutput' 68 }], 69 'expectedOutputs': { 70 'hardSigmoidOutput': { 71 'data': [ 72 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 73 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 74 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 75 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 76 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 77 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 78 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 79 0.669111430644989, 0.6110604405403137, 0.6120688915252686 80 ], 81 'descriptor': {shape: [24], dataType: 'float32'} 82 } 83 } 84 } 85 }, 86 { 87 'name': 'hardSigmoid float32 positive 1D tensor default options', 88 'graph': { 89 'inputs': { 90 'hardSigmoidInput': { 91 'data': [ 92 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 93 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 94 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 95 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 96 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 97 0.663689911365509, 0.5547611713409424, 0.554258406162262, 98 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 99 0.8455570340156555, 0.555302083492279, 0.5603444576263428 100 ], 101 'descriptor': {shape: [24], dataType: 'float32'} 102 } 103 }, 104 'operators': [{ 105 'name': 'hardSigmoid', 106 'arguments': [{'input': 'hardSigmoidInput'}], 107 'outputs': 'hardSigmoidOutput' 108 }], 109 'expectedOutputs': { 110 'hardSigmoidOutput': { 111 'data': [ 112 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 113 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 114 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 115 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 116 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 117 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 118 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 119 0.669111430644989, 0.6110604405403137, 0.6120688915252686 120 ], 121 'descriptor': {shape: [24], dataType: 'float32'} 122 } 123 } 124 } 125 }, 126 { 127 'name': 'hardSigmoid float32 positive 2D tensor default options', 128 'graph': { 129 'inputs': { 130 'hardSigmoidInput': { 131 'data': [ 132 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 133 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 134 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 135 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 136 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 137 0.663689911365509, 0.5547611713409424, 0.554258406162262, 138 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 139 0.8455570340156555, 0.555302083492279, 0.5603444576263428 140 ], 141 'descriptor': {shape: [4, 6], dataType: 'float32'} 142 } 143 }, 144 'operators': [{ 145 'name': 'hardSigmoid', 146 'arguments': [{'input': 'hardSigmoidInput'}], 147 'outputs': 'hardSigmoidOutput' 148 }], 149 'expectedOutputs': { 150 'hardSigmoidOutput': { 151 'data': [ 152 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 153 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 154 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 155 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 156 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 157 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 158 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 159 0.669111430644989, 0.6110604405403137, 0.6120688915252686 160 ], 161 'descriptor': {shape: [4, 6], dataType: 'float32'} 162 } 163 } 164 } 165 }, 166 { 167 'name': 'hardSigmoid float32 positive 3D tensor default options', 168 'graph': { 169 'inputs': { 170 'hardSigmoidInput': { 171 'data': [ 172 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 173 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 174 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 175 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 176 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 177 0.663689911365509, 0.5547611713409424, 0.554258406162262, 178 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 179 0.8455570340156555, 0.555302083492279, 0.5603444576263428 180 ], 181 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 182 } 183 }, 184 'operators': [{ 185 'name': 'hardSigmoid', 186 'arguments': [{'input': 'hardSigmoidInput'}], 187 'outputs': 'hardSigmoidOutput' 188 }], 189 'expectedOutputs': { 190 'hardSigmoidOutput': { 191 'data': [ 192 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 193 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 194 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 195 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 196 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 197 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 198 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 199 0.669111430644989, 0.6110604405403137, 0.6120688915252686 200 ], 201 'descriptor': {shape: [2, 3, 4], dataType: 'float32'} 202 } 203 } 204 } 205 }, 206 { 207 'name': 'hardSigmoid float32 positive 4D tensor default options', 208 'graph': { 209 'inputs': { 210 'hardSigmoidInput': { 211 'data': [ 212 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 213 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 214 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 215 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 216 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 217 0.663689911365509, 0.5547611713409424, 0.554258406162262, 218 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 219 0.8455570340156555, 0.555302083492279, 0.5603444576263428 220 ], 221 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 222 } 223 }, 224 'operators': [{ 225 'name': 'hardSigmoid', 226 'arguments': [{'input': 'hardSigmoidInput'}], 227 'outputs': 'hardSigmoidOutput' 228 }], 229 'expectedOutputs': { 230 'hardSigmoidOutput': { 231 'data': [ 232 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 233 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 234 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 235 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 236 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 237 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 238 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 239 0.669111430644989, 0.6110604405403137, 0.6120688915252686 240 ], 241 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 242 } 243 } 244 } 245 }, 246 { 247 'name': 'hardSigmoid float32 positive 5D tensor default options', 248 'graph': { 249 'inputs': { 250 'hardSigmoidInput': { 251 'data': [ 252 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 253 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 254 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 255 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 256 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 257 0.663689911365509, 0.5547611713409424, 0.554258406162262, 258 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 259 0.8455570340156555, 0.555302083492279, 0.5603444576263428 260 ], 261 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 262 } 263 }, 264 'operators': [{ 265 'name': 'hardSigmoid', 266 'arguments': [{'input': 'hardSigmoidInput'}], 267 'outputs': 'hardSigmoidOutput' 268 }], 269 'expectedOutputs': { 270 'hardSigmoidOutput': { 271 'data': [ 272 0.5118141174316406, 0.6415218114852905, 0.6045681238174438, 273 0.5846202969551086, 0.6328738331794739, 0.6900588274002075, 274 0.5218378305435181, 0.5025954246520996, 0.5951059460639954, 275 0.6064510345458984, 0.6368615627288818, 0.5932421684265137, 276 0.5609799027442932, 0.6605174541473389, 0.5497192740440369, 277 0.6327379941940308, 0.6109522581100464, 0.6108517050743103, 278 0.6462276577949524, 0.5976191759109497, 0.6553369164466858, 279 0.669111430644989, 0.6110604405403137, 0.6120688915252686 280 ], 281 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float32'} 282 } 283 } 284 } 285 }, 286 { 287 'name': 288 'hardSigmoid float32 positive 4D tensor specified positive options.alpha default options.beta', 289 'graph': { 290 'inputs': { 291 'hardSigmoidInput': { 292 'data': [ 293 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 294 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 295 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 296 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 297 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 298 0.663689911365509, 0.5547611713409424, 0.554258406162262, 299 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 300 0.8455570340156555, 0.555302083492279, 0.5603444576263428 301 ], 302 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 303 } 304 }, 305 'operators': [{ 306 'name': 'hardSigmoid', 307 'arguments': [ 308 {'input': 'hardSigmoidInput'}, 309 {'options': {'alpha': 0.7854232544278235}} 310 ], 311 'outputs': 'hardSigmoidOutput' 312 }], 313 'expectedOutputs': { 314 'hardSigmoidOutput': { 315 'data': [ 316 0.546395480632782, 317 1, 318 0.9106510877609253, 319 0.8323138356208801, 320 1, 321 1, 322 0.5857596397399902, 323 0.5101925134658813, 324 0.8734921216964722, 325 0.9180455803871155, 326 1, 327 0.8661727905273438, 328 0.7394752502441406, 329 1, 330 0.6952533721923828, 331 1, 332 0.9357223510742188, 333 0.9353274703025818, 334 1, 335 0.8833619952201843, 336 1, 337 1, 338 0.936147153377533, 339 0.9401075839996338 340 ], 341 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 342 } 343 } 344 } 345 }, 346 { 347 'name': 348 'hardSigmoid float32 negative 4D tensor specified negative options.alpha default options.beta', 349 'graph': { 350 'inputs': { 351 'hardSigmoidInput': { 352 'data': [ 353 -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, 354 -0.4231015741825104, -0.6643692851066589, -0.950294017791748, 355 -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, 356 -0.5322551727294922, -0.684307873249054, -0.4662107527256012, 357 -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, 358 -0.663689911365509, -0.5547611713409424, -0.554258406162262, 359 -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, 360 -0.8455570340156555, -0.555302083492279, -0.5603444576263428 361 ], 362 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 363 } 364 }, 365 'operators': [{ 366 'name': 'hardSigmoid', 367 'arguments': [ 368 {'input': 'hardSigmoidInput'}, 369 {'options': {'alpha': -0.7854232544278235}} 370 ], 371 'outputs': 'hardSigmoidOutput' 372 }], 373 'expectedOutputs': { 374 'hardSigmoidOutput': { 375 'data': [ 376 0.546395480632782, 377 1, 378 0.9106510877609253, 379 0.8323138356208801, 380 1, 381 1, 382 0.5857596397399902, 383 0.5101925134658813, 384 0.8734921216964722, 385 0.9180455803871155, 386 1, 387 0.8661727905273438, 388 0.7394752502441406, 389 1, 390 0.6952533721923828, 391 1, 392 0.9357223510742188, 393 0.9353274703025818, 394 1, 395 0.8833619952201843, 396 1, 397 1, 398 0.936147153377533, 399 0.9401075839996338 400 ], 401 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 402 } 403 } 404 } 405 }, 406 { 407 'name': 408 'hardSigmoid float32 positive 4D tensor specified positive options.beta default options.alpha', 409 'graph': { 410 'inputs': { 411 'hardSigmoidInput': { 412 'data': [ 413 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 414 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 415 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 416 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 417 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 418 0.663689911365509, 0.5547611713409424, 0.554258406162262, 419 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 420 0.8455570340156555, 0.555302083492279, 0.5603444576263428 421 ], 422 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 423 } 424 }, 425 'operators': [{ 426 'name': 'hardSigmoid', 427 'arguments': [ 428 {'input': 'hardSigmoidInput'}, 429 {'options': {'beta': 0.4361860418530341}} 430 ], 431 'outputs': 'hardSigmoidOutput' 432 }], 433 'expectedOutputs': { 434 'hardSigmoidOutput': { 435 'data': [ 436 0.4480001926422119, 0.577707827091217, 0.5407541394233704, 437 0.5208063721656799, 0.5690599083900452, 0.626244843006134, 438 0.4580238461494446, 0.4387814700603485, 0.5312919616699219, 439 0.5426371097564697, 0.5730476379394531, 0.5294281840324402, 440 0.4971659779548645, 0.5967035293579102, 0.48590531945228577, 441 0.5689240097999573, 0.5471382737159729, 0.5470377206802368, 442 0.5824136734008789, 0.533805251121521, 0.5915229320526123, 443 0.6052974462509155, 0.5472464561462402, 0.5482549667358398 444 ], 445 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 446 } 447 } 448 } 449 }, 450 { 451 'name': 452 'hardSigmoid float32 negative 4D tensor specified negative options.beta default options.alpha', 453 'graph': { 454 'inputs': { 455 'hardSigmoidInput': { 456 'data': [ 457 -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, 458 -0.4231015741825104, -0.6643692851066589, -0.950294017791748, 459 -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, 460 -0.5322551727294922, -0.684307873249054, -0.4662107527256012, 461 -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, 462 -0.663689911365509, -0.5547611713409424, -0.554258406162262, 463 -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, 464 -0.8455570340156555, -0.555302083492279, -0.5603444576263428 465 ], 466 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 467 } 468 }, 469 'operators': [{ 470 'name': 'hardSigmoid', 471 'arguments': [ 472 {'input': 'hardSigmoidInput'}, 473 {'options': {'beta': -0.436186041853034}} 474 ], 475 'outputs': 'hardSigmoidOutput' 476 }], 477 'expectedOutputs': { 478 'hardSigmoidOutput': { 479 'data': [ 480 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 481 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 482 ], 483 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 484 } 485 } 486 } 487 }, 488 { 489 'name': 490 'hardSigmoid float32 positive 4D tensor specified all options (positive options.alpha and positive options.beta)', 491 'graph': { 492 'inputs': { 493 'hardSigmoidInput': { 494 'data': [ 495 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 496 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 497 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 498 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 499 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 500 0.663689911365509, 0.5547611713409424, 0.554258406162262, 501 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 502 0.8455570340156555, 0.555302083492279, 0.5603444576263428 503 ], 504 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 505 } 506 }, 507 'operators': [{ 508 'name': 'hardSigmoid', 509 'arguments': [ 510 {'input': 'hardSigmoidInput'}, 511 {'options': {'alpha': 0.7854232544278235, 'beta': 0.4361860418530341}} 512 ], 513 'outputs': 'hardSigmoidOutput' 514 }], 515 'expectedOutputs': { 516 'hardSigmoidOutput': { 517 'data': [ 518 0.4825815260410309, 519 0.9919585585594177, 520 0.8468371629714966, 521 0.7684998512268066, 522 0.9579971432685852, 523 1, 524 0.5219456553459167, 525 0.44637855887413025, 526 0.8096781373023987, 527 0.8542316555976868, 528 0.9736573696136475, 529 0.8023588061332703, 530 0.6756613254547119, 531 1, 532 0.6314394474029541, 533 0.9574635624885559, 534 0.8719083666801453, 535 0.8715134859085083, 536 1, 537 0.8195480108261108, 538 1, 539 1, 540 0.8723332285881042, 541 0.8762935996055603 542 ], 543 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 544 } 545 } 546 } 547 }, 548 { 549 'name': 550 'hardSigmoid float32 positive 4D tensor specified all options (negative options.alpha and negative options.beta)', 551 'graph': { 552 'inputs': { 553 'hardSigmoidInput': { 554 'data': [ 555 0.05907066911458969, 0.7076089382171631, 0.5228404998779297, 556 0.4231015741825104, 0.6643692851066589, 0.950294017791748, 557 0.10918906331062317, 0.0129771139472723, 0.4755297303199768, 558 0.5322551727294922, 0.684307873249054, 0.4662107527256012, 559 0.3048996329307556, 0.8025872707366943, 0.2485964000225067, 560 0.663689911365509, 0.5547611713409424, 0.554258406162262, 561 0.7311381697654724, 0.4880960285663605, 0.7766845226287842, 562 0.8455570340156555, 0.555302083492279, 0.5603444576263428 563 ], 564 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 565 } 566 }, 567 'operators': [{ 568 'name': 'hardSigmoid', 569 'arguments': [ 570 {'input': 'hardSigmoidInput'}, { 571 'options': 572 {'alpha': -0.7854232544278235, 'beta': -0.4361860418530341} 573 } 574 ], 575 'outputs': 'hardSigmoidOutput' 576 }], 577 'expectedOutputs': { 578 'hardSigmoidOutput': { 579 'data': [ 580 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 581 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 582 ], 583 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 584 } 585 } 586 } 587 }, 588 { 589 'name': 590 'hardSigmoid float32 negative 4D tensor all options (positive options.alpha and negative options.beta)', 591 'graph': { 592 'inputs': { 593 'hardSigmoidInput': { 594 'data': [ 595 -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, 596 -0.4231015741825104, -0.6643692851066589, -0.950294017791748, 597 -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, 598 -0.5322551727294922, -0.684307873249054, -0.4662107527256012, 599 -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, 600 -0.663689911365509, -0.5547611713409424, -0.554258406162262, 601 -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, 602 -0.8455570340156555, -0.555302083492279, -0.5603444576263428 603 ], 604 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 605 } 606 }, 607 'operators': [{ 608 'name': 'hardSigmoid', 609 'arguments': [ 610 {'input': 'hardSigmoidInput'}, { 611 'options': 612 {'alpha': 0.7854232544278235, 'beta': -0.4361860418530341} 613 } 614 ], 615 'outputs': 'hardSigmoidOutput' 616 }], 617 'expectedOutputs': { 618 'hardSigmoidOutput': { 619 'data': [ 620 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 621 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 622 ], 623 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 624 } 625 } 626 } 627 }, 628 { 629 'name': 630 'hardSigmoid float32 negative 4D tensor specified all options (negative options.alpha and positive options.beta)', 631 'graph': { 632 'inputs': { 633 'hardSigmoidInput': { 634 'data': [ 635 -0.05907066911458969, -0.7076089382171631, -0.5228404998779297, 636 -0.4231015741825104, -0.6643692851066589, -0.950294017791748, 637 -0.10918906331062317, -0.0129771139472723, -0.4755297303199768, 638 -0.5322551727294922, -0.684307873249054, -0.4662107527256012, 639 -0.3048996329307556, -0.8025872707366943, -0.2485964000225067, 640 -0.663689911365509, -0.5547611713409424, -0.554258406162262, 641 -0.7311381697654724, -0.4880960285663605, -0.7766845226287842, 642 -0.8455570340156555, -0.555302083492279, -0.5603444576263428 643 ], 644 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 645 } 646 }, 647 'operators': [{ 648 'name': 'hardSigmoid', 649 'arguments': [ 650 {'input': 'hardSigmoidInput'}, { 651 'options': 652 {'alpha': -0.7854232544278235, 'beta': 0.4361860418530341} 653 } 654 ], 655 'outputs': 'hardSigmoidOutput' 656 }], 657 'expectedOutputs': { 658 'hardSigmoidOutput': { 659 'data': [ 660 0.4825815260410309, 661 0.9919585585594177, 662 0.8468371629714966, 663 0.7684998512268066, 664 0.9579971432685852, 665 1, 666 0.5219456553459167, 667 0.44637855887413025, 668 0.8096781373023987, 669 0.8542316555976868, 670 0.9736573696136475, 671 0.8023588061332703, 672 0.6756613254547119, 673 1, 674 0.6314394474029541, 675 0.9574635624885559, 676 0.8719083666801453, 677 0.8715134859085083, 678 1, 679 0.8195480108261108, 680 1, 681 1, 682 0.8723332285881042, 683 0.8762935996055603 684 ], 685 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float32'} 686 } 687 } 688 } 689 }, 690 691 // float16 tests 692 { 693 'name': 'hardSigmoid float16 positive 0D tensor default options', 694 'graph': { 695 'inputs': { 696 'hardSigmoidInput': { 697 'data': [0.05908203125], 698 'descriptor': {shape: [], dataType: 'float16'} 699 } 700 }, 701 'operators': [{ 702 'name': 'hardSigmoid', 703 'arguments': [{'input': 'hardSigmoidInput'}], 704 'outputs': 'hardSigmoidOutput' 705 }], 706 'expectedOutputs': { 707 'hardSigmoidOutput': { 708 'data': [0.51171875], 709 'descriptor': {shape: [], dataType: 'float16'} 710 } 711 } 712 } 713 }, 714 { 715 'name': 'hardSigmoid float16 positive 1D constant tensor default options', 716 'graph': { 717 'inputs': { 718 'hardSigmoidInput': { 719 'data': [ 720 0.05908203125, 0.70751953125, 0.52294921875, 721 0.423095703125, 0.66455078125, 0.9501953125, 722 0.10919189453125, 0.01297760009765625, 0.4755859375, 723 0.5322265625, 0.68408203125, 0.46630859375, 724 0.304931640625, 0.802734375, 0.2486572265625, 725 0.66357421875, 0.5546875, 0.55419921875, 726 0.73095703125, 0.488037109375, 0.77685546875, 727 0.845703125, 0.55517578125, 0.560546875 728 ], 729 'descriptor': {shape: [24], dataType: 'float16'} 730 } 731 }, 732 'operators': [{ 733 'name': 'hardSigmoid', 734 'arguments': [{'input': 'hardSigmoidInput'}], 735 'outputs': 'hardSigmoidOutput' 736 }], 737 'expectedOutputs': { 738 'hardSigmoidOutput': { 739 'data': [ 740 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 741 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 742 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 743 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 744 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 745 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 746 ], 747 'descriptor': {shape: [24], dataType: 'float16'} 748 } 749 } 750 } 751 }, 752 { 753 'name': 'hardSigmoid float16 positive 1D tensor default options', 754 'graph': { 755 'inputs': { 756 'hardSigmoidInput': { 757 'data': [ 758 0.05908203125, 0.70751953125, 0.52294921875, 759 0.423095703125, 0.66455078125, 0.9501953125, 760 0.10919189453125, 0.01297760009765625, 0.4755859375, 761 0.5322265625, 0.68408203125, 0.46630859375, 762 0.304931640625, 0.802734375, 0.2486572265625, 763 0.66357421875, 0.5546875, 0.55419921875, 764 0.73095703125, 0.488037109375, 0.77685546875, 765 0.845703125, 0.55517578125, 0.560546875 766 ], 767 'descriptor': {shape: [24], dataType: 'float16'} 768 } 769 }, 770 'operators': [{ 771 'name': 'hardSigmoid', 772 'arguments': [{'input': 'hardSigmoidInput'}], 773 'outputs': 'hardSigmoidOutput' 774 }], 775 'expectedOutputs': { 776 'hardSigmoidOutput': { 777 'data': [ 778 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 779 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 780 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 781 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 782 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 783 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 784 ], 785 'descriptor': {shape: [24], dataType: 'float16'} 786 } 787 } 788 } 789 }, 790 { 791 'name': 'hardSigmoid float16 positive 2D tensor default options', 792 'graph': { 793 'inputs': { 794 'hardSigmoidInput': { 795 'data': [ 796 0.05908203125, 0.70751953125, 0.52294921875, 797 0.423095703125, 0.66455078125, 0.9501953125, 798 0.10919189453125, 0.01297760009765625, 0.4755859375, 799 0.5322265625, 0.68408203125, 0.46630859375, 800 0.304931640625, 0.802734375, 0.2486572265625, 801 0.66357421875, 0.5546875, 0.55419921875, 802 0.73095703125, 0.488037109375, 0.77685546875, 803 0.845703125, 0.55517578125, 0.560546875 804 ], 805 'descriptor': {shape: [4, 6], dataType: 'float16'} 806 } 807 }, 808 'operators': [{ 809 'name': 'hardSigmoid', 810 'arguments': [{'input': 'hardSigmoidInput'}], 811 'outputs': 'hardSigmoidOutput' 812 }], 813 'expectedOutputs': { 814 'hardSigmoidOutput': { 815 'data': [ 816 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 817 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 818 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 819 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 820 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 821 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 822 ], 823 'descriptor': {shape: [4, 6], dataType: 'float16'} 824 } 825 } 826 } 827 }, 828 { 829 'name': 'hardSigmoid float16 positive 3D tensor default options', 830 'graph': { 831 'inputs': { 832 'hardSigmoidInput': { 833 'data': [ 834 0.05908203125, 0.70751953125, 0.52294921875, 835 0.423095703125, 0.66455078125, 0.9501953125, 836 0.10919189453125, 0.01297760009765625, 0.4755859375, 837 0.5322265625, 0.68408203125, 0.46630859375, 838 0.304931640625, 0.802734375, 0.2486572265625, 839 0.66357421875, 0.5546875, 0.55419921875, 840 0.73095703125, 0.488037109375, 0.77685546875, 841 0.845703125, 0.55517578125, 0.560546875 842 ], 843 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 844 } 845 }, 846 'operators': [{ 847 'name': 'hardSigmoid', 848 'arguments': [{'input': 'hardSigmoidInput'}], 849 'outputs': 'hardSigmoidOutput' 850 }], 851 'expectedOutputs': { 852 'hardSigmoidOutput': { 853 'data': [ 854 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 855 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 856 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 857 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 858 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 859 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 860 ], 861 'descriptor': {shape: [2, 3, 4], dataType: 'float16'} 862 } 863 } 864 } 865 }, 866 { 867 'name': 'hardSigmoid float16 positive 4D tensor default options', 868 'graph': { 869 'inputs': { 870 'hardSigmoidInput': { 871 'data': [ 872 0.05908203125, 0.70751953125, 0.52294921875, 873 0.423095703125, 0.66455078125, 0.9501953125, 874 0.10919189453125, 0.01297760009765625, 0.4755859375, 875 0.5322265625, 0.68408203125, 0.46630859375, 876 0.304931640625, 0.802734375, 0.2486572265625, 877 0.66357421875, 0.5546875, 0.55419921875, 878 0.73095703125, 0.488037109375, 0.77685546875, 879 0.845703125, 0.55517578125, 0.560546875 880 ], 881 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 882 } 883 }, 884 'operators': [{ 885 'name': 'hardSigmoid', 886 'arguments': [{'input': 'hardSigmoidInput'}], 887 'outputs': 'hardSigmoidOutput' 888 }], 889 'expectedOutputs': { 890 'hardSigmoidOutput': { 891 'data': [ 892 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 893 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 894 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 895 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 896 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 897 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 898 ], 899 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 900 } 901 } 902 } 903 }, 904 { 905 'name': 'hardSigmoid float16 positive 5D tensor default options', 906 'graph': { 907 'inputs': { 908 'hardSigmoidInput': { 909 'data': [ 910 0.05908203125, 0.70751953125, 0.52294921875, 911 0.423095703125, 0.66455078125, 0.9501953125, 912 0.10919189453125, 0.01297760009765625, 0.4755859375, 913 0.5322265625, 0.68408203125, 0.46630859375, 914 0.304931640625, 0.802734375, 0.2486572265625, 915 0.66357421875, 0.5546875, 0.55419921875, 916 0.73095703125, 0.488037109375, 0.77685546875, 917 0.845703125, 0.55517578125, 0.560546875 918 ], 919 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 920 } 921 }, 922 'operators': [{ 923 'name': 'hardSigmoid', 924 'arguments': [{'input': 'hardSigmoidInput'}], 925 'outputs': 'hardSigmoidOutput' 926 }], 927 'expectedOutputs': { 928 'hardSigmoidOutput': { 929 'data': [ 930 0.51171875, 0.6416015625, 0.6044921875, 0.58447265625, 931 0.6328125, 0.68994140625, 0.52197265625, 0.50244140625, 932 0.59521484375, 0.6064453125, 0.63671875, 0.59326171875, 933 0.56103515625, 0.66064453125, 0.5498046875, 0.6328125, 934 0.61083984375, 0.61083984375, 0.64599609375, 0.59765625, 935 0.6552734375, 0.6689453125, 0.61083984375, 0.6123046875 936 ], 937 'descriptor': {shape: [1, 2, 1, 3, 4], dataType: 'float16'} 938 } 939 } 940 } 941 }, 942 { 943 'name': 944 'hardSigmoid float16 positive 4D tensor specified positive options.alpha default options.beta', 945 'graph': { 946 'inputs': { 947 'hardSigmoidInput': { 948 'data': [ 949 0.05908203125, 0.70751953125, 0.52294921875, 950 0.423095703125, 0.66455078125, 0.9501953125, 951 0.10919189453125, 0.01297760009765625, 0.4755859375, 952 0.5322265625, 0.68408203125, 0.46630859375, 953 0.304931640625, 0.802734375, 0.2486572265625, 954 0.66357421875, 0.5546875, 0.55419921875, 955 0.73095703125, 0.488037109375, 0.77685546875, 956 0.845703125, 0.55517578125, 0.560546875 957 ], 958 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 959 } 960 }, 961 'operators': [{ 962 'name': 'hardSigmoid', 963 'arguments': [ 964 {'input': 'hardSigmoidInput'}, 965 {'options': {'alpha': 0.7854232544278235}} 966 ], 967 'outputs': 'hardSigmoidOutput' 968 }], 969 'expectedOutputs': { 970 'hardSigmoidOutput': { 971 'data': [ 972 0.54638671875, 973 1, 974 0.91064453125, 975 0.83251953125, 976 1, 977 1, 978 0.5859375, 979 0.51025390625, 980 0.87353515625, 981 0.91796875, 982 1, 983 0.8662109375, 984 0.7392578125, 985 1, 986 0.6953125, 987 1, 988 0.935546875, 989 0.93505859375, 990 1, 991 0.88330078125, 992 1, 993 1, 994 0.93603515625, 995 0.9404296875 996 ], 997 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 998 } 999 } 1000 } 1001 }, 1002 { 1003 'name': 1004 'hardSigmoid float16 negative 4D tensor specified negative options.alpha default options.beta', 1005 'graph': { 1006 'inputs': { 1007 'hardSigmoidInput': { 1008 'data': [ 1009 -0.05908203125, -0.70751953125, -0.52294921875, 1010 -0.423095703125, -0.66455078125, -0.9501953125, 1011 -0.10919189453125, -0.01297760009765625, -0.4755859375, 1012 -0.5322265625, -0.68408203125, -0.46630859375, 1013 -0.304931640625, -0.802734375, -0.2486572265625, 1014 -0.66357421875, -0.5546875, -0.55419921875, 1015 -0.73095703125, -0.488037109375, -0.77685546875, 1016 -0.845703125, -0.55517578125, -0.560546875 1017 ], 1018 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1019 } 1020 }, 1021 'operators': [{ 1022 'name': 'hardSigmoid', 1023 'arguments': [ 1024 {'input': 'hardSigmoidInput'}, 1025 {'options': {'alpha': -0.7854232544278235}} 1026 ], 1027 'outputs': 'hardSigmoidOutput' 1028 }], 1029 'expectedOutputs': { 1030 'hardSigmoidOutput': { 1031 'data': [ 1032 0.54638671875, 1033 1, 1034 0.91064453125, 1035 0.83251953125, 1036 1, 1037 1, 1038 0.5859375, 1039 0.51025390625, 1040 0.87353515625, 1041 0.91796875, 1042 1, 1043 0.8662109375, 1044 0.7392578125, 1045 1, 1046 0.6953125, 1047 1, 1048 0.935546875, 1049 0.93505859375, 1050 1, 1051 0.88330078125, 1052 1, 1053 1, 1054 0.93603515625, 1055 0.9404296875 1056 ], 1057 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1058 } 1059 } 1060 } 1061 }, 1062 { 1063 'name': 1064 'hardSigmoid float16 positive 4D tensor specified positive options.beta default options.alpha', 1065 'graph': { 1066 'inputs': { 1067 'hardSigmoidInput': { 1068 'data': [ 1069 0.05908203125, 0.70751953125, 0.52294921875, 1070 0.423095703125, 0.66455078125, 0.9501953125, 1071 0.10919189453125, 0.01297760009765625, 0.4755859375, 1072 0.5322265625, 0.68408203125, 0.46630859375, 1073 0.304931640625, 0.802734375, 0.2486572265625, 1074 0.66357421875, 0.5546875, 0.55419921875, 1075 0.73095703125, 0.488037109375, 0.77685546875, 1076 0.845703125, 0.55517578125, 0.560546875 1077 ], 1078 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1079 } 1080 }, 1081 'operators': [{ 1082 'name': 'hardSigmoid', 1083 'arguments': [ 1084 {'input': 'hardSigmoidInput'}, 1085 {'options': {'beta': 0.4361860418530341}} 1086 ], 1087 'outputs': 'hardSigmoidOutput' 1088 }], 1089 'expectedOutputs': { 1090 'hardSigmoidOutput': { 1091 'data': [ 1092 0.447998046875, 0.57763671875, 0.541015625, 0.52099609375, 1093 0.5693359375, 0.62646484375, 0.4580078125, 0.438720703125, 1094 0.53125, 0.54248046875, 0.5732421875, 0.529296875, 1095 0.4970703125, 0.5966796875, 0.48583984375, 0.56884765625, 1096 0.54736328125, 0.546875, 0.58251953125, 0.53369140625, 1097 0.591796875, 0.60546875, 0.54736328125, 0.54833984375 1098 ], 1099 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1100 } 1101 } 1102 } 1103 }, 1104 { 1105 'name': 1106 'hardSigmoid float16 negative 4D tensor specified negative options.beta default options.alpha', 1107 'graph': { 1108 'inputs': { 1109 'hardSigmoidInput': { 1110 'data': [ 1111 -0.05908203125, -0.70751953125, -0.52294921875, 1112 -0.423095703125, -0.66455078125, -0.9501953125, 1113 -0.10919189453125, -0.01297760009765625, -0.4755859375, 1114 -0.5322265625, -0.68408203125, -0.46630859375, 1115 -0.304931640625, -0.802734375, -0.2486572265625, 1116 -0.66357421875, -0.5546875, -0.55419921875, 1117 -0.73095703125, -0.488037109375, -0.77685546875, 1118 -0.845703125, -0.55517578125, -0.560546875 1119 ], 1120 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1121 } 1122 }, 1123 'operators': [{ 1124 'name': 'hardSigmoid', 1125 'arguments': [ 1126 {'input': 'hardSigmoidInput'}, 1127 {'options': {'beta': -0.436186041853034}} 1128 ], 1129 'outputs': 'hardSigmoidOutput' 1130 }], 1131 'expectedOutputs': { 1132 'hardSigmoidOutput': { 1133 'data': [ 1134 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1135 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1136 ], 1137 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1138 } 1139 } 1140 } 1141 }, 1142 { 1143 'name': 1144 'hardSigmoid float16 positive 4D tensor specified all options (positive options.alpha and positive options.beta)', 1145 'graph': { 1146 'inputs': { 1147 'hardSigmoidInput': { 1148 'data': [ 1149 0.05908203125, 0.70751953125, 0.52294921875, 1150 0.423095703125, 0.66455078125, 0.9501953125, 1151 0.10919189453125, 0.01297760009765625, 0.4755859375, 1152 0.5322265625, 0.68408203125, 0.46630859375, 1153 0.304931640625, 0.802734375, 0.2486572265625, 1154 0.66357421875, 0.5546875, 0.55419921875, 1155 0.73095703125, 0.488037109375, 0.77685546875, 1156 0.845703125, 0.55517578125, 0.560546875 1157 ], 1158 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1159 } 1160 }, 1161 'operators': [{ 1162 'name': 'hardSigmoid', 1163 'arguments': [ 1164 {'input': 'hardSigmoidInput'}, 1165 {'options': {'alpha': 0.7854232544278235, 'beta': 0.4361860418530341}} 1166 ], 1167 'outputs': 'hardSigmoidOutput' 1168 }], 1169 'expectedOutputs': { 1170 'hardSigmoidOutput': { 1171 'data': [ 1172 0.482666015625, 1173 0.99169921875, 1174 0.8466796875, 1175 0.7685546875, 1176 0.9580078125, 1177 1, 1178 0.52197265625, 1179 0.4462890625, 1180 0.8095703125, 1181 0.85400390625, 1182 0.9736328125, 1183 0.80224609375, 1184 0.67578125, 1185 1, 1186 0.63134765625, 1187 0.95751953125, 1188 0.8720703125, 1189 0.87158203125, 1190 1, 1191 0.8193359375, 1192 1, 1193 1, 1194 0.8720703125, 1195 0.87646484375 1196 ], 1197 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1198 } 1199 } 1200 } 1201 }, 1202 { 1203 'name': 1204 'hardSigmoid float16 positive 4D tensor specified all options (negative options.alpha and negative options.beta)', 1205 'graph': { 1206 'inputs': { 1207 'hardSigmoidInput': { 1208 'data': [ 1209 0.05908203125, 0.70751953125, 0.52294921875, 1210 0.423095703125, 0.66455078125, 0.9501953125, 1211 0.10919189453125, 0.01297760009765625, 0.4755859375, 1212 0.5322265625, 0.68408203125, 0.46630859375, 1213 0.304931640625, 0.802734375, 0.2486572265625, 1214 0.66357421875, 0.5546875, 0.55419921875, 1215 0.73095703125, 0.488037109375, 0.77685546875, 1216 0.845703125, 0.55517578125, 0.560546875 1217 ], 1218 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1219 } 1220 }, 1221 'operators': [{ 1222 'name': 'hardSigmoid', 1223 'arguments': [ 1224 {'input': 'hardSigmoidInput'}, { 1225 'options': 1226 {'alpha': -0.7854232544278235, 'beta': -0.4361860418530341} 1227 } 1228 ], 1229 'outputs': 'hardSigmoidOutput' 1230 }], 1231 'expectedOutputs': { 1232 'hardSigmoidOutput': { 1233 'data': [ 1234 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1235 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1236 ], 1237 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1238 } 1239 } 1240 } 1241 }, 1242 { 1243 'name': 1244 'hardSigmoid float16 negative 4D tensor all options (positive options.alpha and negative options.beta)', 1245 'graph': { 1246 'inputs': { 1247 'hardSigmoidInput': { 1248 'data': [ 1249 -0.05908203125, -0.70751953125, -0.52294921875, 1250 -0.423095703125, -0.66455078125, -0.9501953125, 1251 -0.10919189453125, -0.01297760009765625, -0.4755859375, 1252 -0.5322265625, -0.68408203125, -0.46630859375, 1253 -0.304931640625, -0.802734375, -0.2486572265625, 1254 -0.66357421875, -0.5546875, -0.55419921875, 1255 -0.73095703125, -0.488037109375, -0.77685546875, 1256 -0.845703125, -0.55517578125, -0.560546875 1257 ], 1258 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1259 } 1260 }, 1261 'operators': [{ 1262 'name': 'hardSigmoid', 1263 'arguments': [ 1264 {'input': 'hardSigmoidInput'}, { 1265 'options': 1266 {'alpha': 0.7854232544278235, 'beta': -0.4361860418530341} 1267 } 1268 ], 1269 'outputs': 'hardSigmoidOutput' 1270 }], 1271 'expectedOutputs': { 1272 'hardSigmoidOutput': { 1273 'data': [ 1274 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1275 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 1276 ], 1277 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1278 } 1279 } 1280 } 1281 }, 1282 { 1283 'name': 1284 'hardSigmoid float16 negative 4D tensor specified all options (negative options.alpha and positive options.beta)', 1285 'graph': { 1286 'inputs': { 1287 'hardSigmoidInput': { 1288 'data': [ 1289 -0.05908203125, -0.70751953125, -0.52294921875, 1290 -0.423095703125, -0.66455078125, -0.9501953125, 1291 -0.10919189453125, -0.01297760009765625, -0.4755859375, 1292 -0.5322265625, -0.68408203125, -0.46630859375, 1293 -0.304931640625, -0.802734375, -0.2486572265625, 1294 -0.66357421875, -0.5546875, -0.55419921875, 1295 -0.73095703125, -0.488037109375, -0.77685546875, 1296 -0.845703125, -0.55517578125, -0.560546875 1297 ], 1298 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1299 } 1300 }, 1301 'operators': [{ 1302 'name': 'hardSigmoid', 1303 'arguments': [ 1304 {'input': 'hardSigmoidInput'}, { 1305 'options': 1306 {'alpha': -0.7854232544278235, 'beta': 0.4361860418530341} 1307 } 1308 ], 1309 'outputs': 'hardSigmoidOutput' 1310 }], 1311 'expectedOutputs': { 1312 'hardSigmoidOutput': { 1313 'data': [ 1314 0.482666015625, 1315 0.99169921875, 1316 0.8466796875, 1317 0.7685546875, 1318 0.9580078125, 1319 1, 1320 0.52197265625, 1321 0.4462890625, 1322 0.8095703125, 1323 0.85400390625, 1324 0.9736328125, 1325 0.80224609375, 1326 0.67578125, 1327 1, 1328 0.63134765625, 1329 0.95751953125, 1330 0.8720703125, 1331 0.87158203125, 1332 1, 1333 0.8193359375, 1334 1, 1335 1, 1336 0.8720703125, 1337 0.87646484375 1338 ], 1339 'descriptor': {shape: [1, 2, 3, 4], dataType: 'float16'} 1340 } 1341 } 1342 } 1343 } 1344 ]; 1345 1346 webnn_conformance_test( 1347 hardSigmoidTests, buildAndExecuteGraph, getPrecisionTolerance);