Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

webnn: replace DataError with TypeError #46845

Merged
merged 1 commit into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions webnn/validation_tests/lstm.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,23 +113,23 @@ const tests = [
]
},
{
name: '[lstm] DataError is expected if hiddenSize equals to zero',
name: '[lstm] TypeError is expected if hiddenSize equals to zero',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
steps: steps,
hiddenSize: 0
},
{
name: '[lstm] DataError is expected if hiddenSize is too large',
name: '[lstm] TypeError is expected if hiddenSize is too large',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
steps: steps,
hiddenSize: 4294967295,
},
{
name: '[lstm] DataError is expected if steps equals to zero',
name: '[lstm] TypeError is expected if steps equals to zero',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
Expand All @@ -138,7 +138,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the data type is not one of the floating point types',
'[lstm] TypeError is expected if the data type is not one of the floating point types',
input: {dataType: 'uint32', dimensions: kValidInputDimensions},
weight: {dataType: 'uint32', dimensions: kValidWeightDimensions},
recurrentWeight:
Expand All @@ -147,7 +147,7 @@ const tests = [
hiddenSize: hiddenSize
},
{
name: '[lstm] DataError is expected if the rank of input is not 3',
name: '[lstm] TypeError is expected if the rank of input is not 3',
input: {dataType: 'float32', dimensions: [steps, batchSize]},
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
Expand All @@ -156,15 +156,15 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if input.dimensions[0] is not equal to steps',
'[lstm] TypeError is expected if input.dimensions[0] is not equal to steps',
input: {dataType: 'float32', dimensions: [1000, batchSize, inputSize]},
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
steps: steps,
hiddenSize: hiddenSize
},
{
name: '[lstm] DataError is expected if the shape of weight is incorrect',
name: '[lstm] TypeError is expected if the shape of weight is incorrect',
input: kExampleInputDescriptor,
weight: {
dataType: 'float32',
Expand All @@ -176,7 +176,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the rank of recurrentWeight is not 3',
'[lstm] TypeError is expected if the rank of recurrentWeight is not 3',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight:
Expand All @@ -186,7 +186,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the size of options.activations is not 3',
'[lstm] TypeError is expected if the size of options.activations is not 3',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
Expand All @@ -195,7 +195,7 @@ const tests = [
options: {activations: ['sigmoid', 'tanh']}
},
{
name: '[lstm] DataError is expected if the rank of options.bias is not 2',
name: '[lstm] TypeError is expected if the rank of options.bias is not 2',
input: {dataType: 'float16', dimensions: kValidInputDimensions},
weight: {dataType: 'float16', dimensions: kValidWeightDimensions},
recurrentWeight:
Expand All @@ -206,7 +206,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the shape of options.recurrentBias.dimensions is incorrect',
'[lstm] TypeError is expected if the shape of options.recurrentBias.dimensions is incorrect',
input: {dataType: 'float16', dimensions: kValidInputDimensions},
weight: {dataType: 'float16', dimensions: kValidWeightDimensions},
recurrentWeight:
Expand All @@ -219,7 +219,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the dataType of options.peepholeWeight is incorrect',
'[lstm] TypeError is expected if the dataType of options.peepholeWeight is incorrect',
input: {dataType: 'float16', dimensions: kValidInputDimensions},
weight: {dataType: 'float16', dimensions: kValidWeightDimensions},
recurrentWeight:
Expand All @@ -233,7 +233,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the dataType of options.initialHiddenState is incorrect',
'[lstm] TypeError is expected if the dataType of options.initialHiddenState is incorrect',
input: {dataType: 'float16', dimensions: kValidInputDimensions},
weight: {dataType: 'float16', dimensions: kValidWeightDimensions},
recurrentWeight:
Expand All @@ -249,7 +249,7 @@ const tests = [
},
{
name:
'[lstm] DataError is expected if the shape of options.initialCellState is incorrect',
'[lstm] TypeError is expected if the shape of options.initialCellState is incorrect',
input: kExampleInputDescriptor,
weight: kExampleWeightDescriptor,
recurrentWeight: kExampleRecurrentWeightDescriptor,
Expand Down Expand Up @@ -333,8 +333,8 @@ tests.forEach(
assert_array_equals(outputs[i].shape(), test.outputs[i].dimensions);
}
} else {
assert_throws_dom(
'DataError',
assert_throws_js(
TypeError,
() => builder.lstm(
input, weight, recurrentWeight, test.steps, test.hiddenSize,
options));
Expand Down
2 changes: 1 addition & 1 deletion webnn/validation_tests/triangular.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ promise_test(async t => {
assert_throws_js(TypeError, () => builder.triangular(input));
}
}
}, "[triangular] DataError is expected if input's rank is less than 2");
}, "[triangular] TypeError is expected if input's rank is less than 2");

validateInputFromAnotherBuilder('triangular');