diff options
Diffstat (limited to 'testing/web-platform/tests/webnn/validation_tests/elu.https.any.js')
-rw-r--r-- | testing/web-platform/tests/webnn/validation_tests/elu.https.any.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/testing/web-platform/tests/webnn/validation_tests/elu.https.any.js b/testing/web-platform/tests/webnn/validation_tests/elu.https.any.js index 6e842cb691..53ec5e54ae 100644 --- a/testing/web-platform/tests/webnn/validation_tests/elu.https.any.js +++ b/testing/web-platform/tests/webnn/validation_tests/elu.https.any.js @@ -5,3 +5,43 @@ 'use strict'; validateInputFromAnotherBuilder('elu'); + +validateUnaryOperation( + 'elu', floatingPointTypes, /*alsoBuildActivation=*/ true); + +promise_test(async t => { + const options = {alpha: 1.0}; + const input = + builder.input('input', {dataType: 'float32', dimensions: [1, 2, 3]}); + const output = builder.elu(input, options); + assert_equals(output.dataType(), 'float32'); + assert_array_equals(output.shape(), [1, 2, 3]); +}, '[elu] Test building an operator with options'); + +promise_test(async t => { + const options = {alpha: 1.5}; + builder.elu(options); +}, '[elu] Test building an activation with options'); + +promise_test(async t => { + const options = {alpha: -1.0}; + const input = + builder.input('input', {dataType: 'float32', dimensions: [1, 2, 3]}); + assert_throws_js(TypeError, () => builder.elu(input, options)); +}, '[elu] Throw if options.alpha <= 0 when building an operator'); + +promise_test(async t => { + const options = {alpha: NaN}; + const input = builder.input('input', {dataType: 'float16', dimensions: []}); + assert_throws_js(TypeError, () => builder.elu(input, options)); +}, '[elu] Throw if options.alpha is NaN when building an operator'); + +promise_test(async t => { + const options = {alpha: 0}; + assert_throws_js(TypeError, () => builder.elu(options)); +}, '[elu] Throw if options.alpha <= 0 when building an activation'); + +promise_test(async t => { + const options = {alpha: Infinity}; + assert_throws_js(TypeError, () => builder.elu(options)); +}, '[elu] Throw if options.alpha is Infinity when building an activation'); |