onnxruntime/js/web/test/data/ops/skip-simplified-layer-norm.jsonc
Yulong Wang 4385602386
[js/web] fix test runner with optional input/output (#20399)
### Description
fix test runner with optional input/output.

This change fixes the OP test runner (.jsonc format test) with optional
input(s) and/or output(s).

this fix reveals a problem of dealing with optional outputs:

> Take SkipSimplifiedLayerNorm as example: 
>
> if in the ONNX model, the node's outputs are: [ 'output_0', '' ]
instead of [ 'output_0' ], the current implementation will fail. The
difference is, in the first case, context.outputCount == 2, and then the
typescript implementation will try to create a tensor for output[1]. It
will eventually call to C++ function (OpKernelContext::Output), and the
output.DataRaw() will be nullptr. WebGPU backend will fail because it
cannot deal with a TensorView with data == 0.
>

This problem may need to be fixed or workaround in separated PR. This PR
does not fix this problem. Failed test cases are modified to work -
please note this PR does not break those test cases as they never work.
2024-04-22 12:53:10 -07:00

53 lines
1.5 KiB
Text

[
{
"name": "SkipSimplifiedLayerNormalization",
"operator": "SkipSimplifiedLayerNormalization",
"opset": { "domain": "com.microsoft", "version": 1 },
"attributes": [
{
"name": "epsilon",
"data": 1e-5,
"type": "float"
}
],
"inputShapeDefinitions": "rankOnly",
"cases": [
{
"name": "default",
"inputs": [
{
"data": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16],
"dims": [1, 2, 8],
"type": "float32"
},
{
"data": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15],
"dims": [1, 2, 8],
"type": "float32"
},
{
"data": [2, 2, 2, 2, 2, 2, 2, 2],
"dims": [8],
"type": "float32"
}
],
"outputs": [
{
"data": [
0.21693046391010284, 0.650791347026825, 1.084652304649353, 1.5185132026672363, 1.9523741006851196,
2.386234998703003, 2.820096015930176, 3.2539567947387695, 1.3915272951126099, 1.5552364587783813,
1.7189455032348633, 1.8826546669006348, 2.046363592147827, 2.2100727558135986, 2.37378191947937,
2.5374910831451416
],
"dims": [1, 2, 8],
"type": "float32"
}
// {
// "data": null,
// "type": "float32"
// }
]
}
]
}
]