Skip to content

Commit

Permalink
Bug 1901593 [wpt PR 46678] - webnn: Remove some activations not usabl…
Browse files Browse the repository at this point in the history
…e with recurrent ops, a=testonly

Automatic update from web-platform-tests
webnn: Remove some activations not usable with recurrent ops

clamp() and softmax() may no longer be created as MLActivations

More details on the spec PR:
webmachinelearning/webnn#703

Bug: 341518634
Change-Id: I7dda713c8be5454690f21c66665d90be274513f7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5598089
Commit-Queue: Austin Sullivan <[email protected]>
Reviewed-by: Alex Gough <[email protected]>
Reviewed-by: ningxin hu <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1313205}

--

wpt-commits: a632273a65dd5e8ba5f76ae0d03e6cb4f3affeee
wpt-pr: 46678
  • Loading branch information
a-sully authored and moz-wptsync-bot committed Jun 14, 2024
1 parent 85c5f8d commit 9f12e40
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

validateInputFromAnotherBuilder('clamp');

validateUnaryOperation(
'clamp', allWebNNOperandDataTypes, /*alsoBuildActivation=*/ true);
validateUnaryOperation('clamp', allWebNNOperandDataTypes);

promise_test(async t => {
const options = {minValue: 1.0, maxValue: 3.0};
Expand All @@ -27,11 +26,6 @@ promise_test(async t => {
assert_array_equals(output.shape(), [1, 2, 3, 4]);
}, '[clamp] Test building an operator with options.minValue == options.maxValue');

promise_test(async t => {
const options = {minValue: 2.0};
builder.clamp(options);
}, '[clamp] Test building an activation with options');

promise_test(async t => {
const options = {minValue: 3.0, maxValue: 1.0};
const input =
Expand All @@ -46,15 +40,3 @@ promise_test(async t => {
const input = builder.input('input', {dataType: 'float16', dimensions: []});
assert_throws_js(TypeError, () => builder.clamp(input, options));
}, '[clamp] Throw if options.minValue is -Infinity when building an operator');

promise_test(async t => {
const options = {minValue: 2.0, maxValue: -1.0};
assert_throws_js(TypeError, () => builder.clamp(options));
}, '[clamp] Throw if options.minValue > options.maxValue when building an activation');

// To be removed once NaN `maxValue` is allowed. Tracked in
// https://github.com/webmachinelearning/webnn/pull/647.
promise_test(async t => {
const options = {maxValue: NaN};
assert_throws_js(TypeError, () => builder.clamp(options));
}, '[clamp] Throw if options.maxValue is NaN when building an activation');
Original file line number Diff line number Diff line change
Expand Up @@ -430,8 +430,8 @@ multi_builder_test(async (t, builder, otherBuilder) => {
}, '[gru] throw if initialHiddenState option is from another builder');

multi_builder_test(async (t, builder, otherBuilder) => {
const activation = builder.clamp();
const activationFromOtherBuilder = otherBuilder.clamp();
const activation = builder.relu();
const activationFromOtherBuilder = otherBuilder.relu();
const options = {activations: [activation, activationFromOtherBuilder]};

const input = builder.input('input', kExampleInputDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ multi_builder_test(async (t, builder, otherBuilder) => {
}, '[gruCell] throw if recurrentBias option is from another builder');

multi_builder_test(async (t, builder, otherBuilder) => {
const activation = builder.clamp();
const activationFromOtherBuilder = otherBuilder.clamp();
const activation = builder.relu();
const activationFromOtherBuilder = otherBuilder.relu();
const options = {activations: [activation, activationFromOtherBuilder]};

const input = builder.input('input', kExampleInputDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ multi_builder_test(async (t, builder, otherBuilder) => {
}, '[lstm] throw if initialCellState option is from another builder');

multi_builder_test(async (t, builder, otherBuilder) => {
const activation = builder.clamp();
const activationFromOtherBuilder = otherBuilder.clamp();
const activation = builder.relu();
const activationFromOtherBuilder = otherBuilder.relu();
const options = {activations: [activation, activationFromOtherBuilder]};

const input = builder.input('input', kExampleInputDescriptor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ multi_builder_test(async (t, builder, otherBuilder) => {
}, '[lstmCell] throw if peepholeWeight option is from another builder');

multi_builder_test(async (t, builder, otherBuilder) => {
const activation = builder.clamp();
const activationFromOtherBuilder = otherBuilder.clamp();
const activation = builder.relu();
const activationFromOtherBuilder = otherBuilder.relu();
const options = {activations: [activation, activationFromOtherBuilder]};

const input = builder.input('input', kExampleInputDescriptor);
Expand Down

0 comments on commit 9f12e40

Please sign in to comment.