diff --git a/js/common/lib/inference-session-impl.ts b/js/common/lib/inference-session-impl.ts index c43ea7e419..65be994ef5 100644 --- a/js/common/lib/inference-session-impl.ts +++ b/js/common/lib/inference-session-impl.ts @@ -115,6 +115,10 @@ export class InferenceSession implements InferenceSessionInterface { return returnValue; } + async release(): Promise { + return this.handler.dispose(); + } + static create(path: string, options?: SessionOptions): Promise; static create(buffer: ArrayBufferLike, options?: SessionOptions): Promise; static create(buffer: ArrayBufferLike, byteOffset: number, byteLength?: number, options?: SessionOptions): diff --git a/js/common/lib/inference-session.ts b/js/common/lib/inference-session.ts index e32cd0dfa0..e9c3d2da80 100644 --- a/js/common/lib/inference-session.ts +++ b/js/common/lib/inference-session.ts @@ -306,6 +306,15 @@ export interface InferenceSession { // #endregion + // #region release() + + /** + * Release the inference session and the underlying resources. + */ + release(): Promise; + + // #endregion + // #region profiling /**