We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bfeba46 commit d823108Copy full SHA for d823108
js/web/lib/wasm/jsep/backend-webnn.ts
@@ -82,8 +82,11 @@ export class WebNNBackend {
82
}
83
84
public unregisterMlContext(sessionId: number): void {
85
- this.mlContextBySessionId.delete(sessionId);
86
const mlContext = this.mlContextBySessionId.get(sessionId)!;
+ if (!mlContext) {
87
+ throw new Error(`No MLContext found for session ${sessionId}`);
88
+ }
89
+ this.mlContextBySessionId.delete(sessionId);
90
const sessionIds = this.sessionIdsByMlContext.get(mlContext)!;
91
sessionIds.delete(sessionId);
92
if (sessionIds.size === 0) {
0 commit comments