Skip to content

Commit

Permalink
[webnn] Add float32 tests for WebNN clamp op.
Browse files Browse the repository at this point in the history
  • Loading branch information
BruceDai committed Nov 30, 2022
1 parent 7767126 commit 1d8984d
Show file tree
Hide file tree
Showing 4 changed files with 1,150 additions and 6 deletions.
10 changes: 10 additions & 0 deletions webnn/clamp.https.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// META: title=test WebNN API clamp operation
// META: global=window,dedicatedworker
// META: script=./resources/utils.js
// META: timeout=long

'use strict';

// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-clamp

testWebNNOperation('clamp', '/webnn/resources/test_data/clamp.json', buildOperationWithSingleInput);
5 changes: 3 additions & 2 deletions webnn/concat.https.any.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@

// https://webmachinelearning.github.io/webnn/#api-mlgraphbuilder-concat

const buildConcat = (builder, resources) => {
const buildConcat = (operationName, builder, resources) => {
// MLOperand concat(sequence<MLOperand> inputs, long axis);
const namedOutputOperand = {};
const inputOperands = [];
for (let input of resources.inputs) {
inputOperands.push(builder.input(input.name, {type: input.type, dimensions: input.shape}));
}
namedOutputOperand[resources.expected.name] = builder.concat(inputOperands, resources.axis);
// invoke builder.concat()
namedOutputOperand[resources.expected.name] = builder[operationName](inputOperands, resources.axis);
return namedOutputOperand;
};

Expand Down
Loading

0 comments on commit 1d8984d

Please sign in to comment.