Skip to content

Commit 55511ef

Browse files
authored
[NNotePad] Make sure the Promises are await (#322)
The `outputOperands.map` code doesn't await the Promises, use `Promise.all` to ensure the Promises are await. Fixed #321
1 parent 3afc047 commit 55511ef

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

nnotepad/js/nnotepad.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,12 +668,13 @@ export class NNotepad {
668668
const namedOutputs = {};
669669
const outputTensors = {};
670670
const outputBuffers = {};
671-
await outputOperands.map(async (op, index) => {
671+
await Promise.all(outputOperands.map(async (op, index) => {
672672
const name = `output-${index}`;
673673
namedOutputs[name] = op;
674674
outputBuffers[name] = WebNNUtil.bufferForOperand(op);
675675
outputTensors[name] = await WebNNUtil.tensorForOperand(op, context);
676-
});
676+
}));
677+
677678
let graph;
678679
try {
679680
graph = await builder.build(namedOutputs);

0 commit comments

Comments
 (0)