Skip to content

Commit

Permalink
[WebNN] Remove wasm.currentContext check (#22886)
Browse files Browse the repository at this point in the history
If a WebNN session is threw early, this check for `wasm.currentContext`
will break all the following WebNN sessions, this often happens in npm
tests.
  • Loading branch information
Honry authored Nov 19, 2024
1 parent 0d00fc3 commit 8a06f13
Showing 1 changed file with 0 additions and 3 deletions.
3 changes: 0 additions & 3 deletions js/web/lib/wasm/wasm-core-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,9 +291,6 @@ export const createSession = async (
const providerName = typeof provider === 'string' ? provider : provider.name;
if (providerName === 'webnn') {
wasm.shouldTransferToMLTensor = false;
if (wasm.currentContext) {
throw new Error('WebNN execution provider is already set.');
}
if (typeof provider !== 'string') {
const webnnOptions = provider as InferenceSession.WebNNExecutionProviderOption;
const context = (webnnOptions as InferenceSession.WebNNOptionsWithMLContext)?.context;
Expand Down

0 comments on commit 8a06f13

Please sign in to comment.