mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-07-06 04:28:32 +00:00
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
|
// Licensed under the MIT License.
|
||
|
|
|
||
|
|
import {InferenceSession} from './inference-session';
|
||
|
|
import {OnnxValue} from './onnx-value';
|
||
|
|
|
||
|
|
export declare namespace SessionHandler {
|
||
|
|
type FeedsType = {[name: string]: OnnxValue};
|
||
|
|
type FetchesType = {[name: string]: OnnxValue | null};
|
||
|
|
type ReturnType = {[name: string]: OnnxValue};
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Represent a handler instance of an inference session.
|
||
|
|
*/
|
||
|
|
export interface SessionHandler {
|
||
|
|
dispose(): Promise<void>;
|
||
|
|
|
||
|
|
readonly inputNames: string[];
|
||
|
|
readonly outputNames: string[];
|
||
|
|
|
||
|
|
run(feeds: SessionHandler.FeedsType, fetches: SessionHandler.FetchesType,
|
||
|
|
options: InferenceSession.RunOptions): Promise<SessionHandler.ReturnType>;
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Represent a backend that provides implementation of model inferencing.
|
||
|
|
*/
|
||
|
|
export interface Backend {
|
||
|
|
/**
|
||
|
|
* Initialize the backend asynchronously. Should throw when failed.
|
||
|
|
*/
|
||
|
|
init(): Promise<void>;
|
||
|
|
|
||
|
|
createSessionHandler(uriOrBuffer: string|Uint8Array, options?: InferenceSession.SessionOptions):
|
||
|
|
Promise<SessionHandler>;
|
||
|
|
}
|
||
|
|
|
||
|
|
export {registerBackend} from './backend-impl';
|