Represent a runtime instance of an ONNX model.

interface InferenceSession {
    inputNames: readonly string[];
    outputNames: readonly string[];
    endProfiling(): void;
    release(): Promise<void>;
    run(feeds, options?): Promise<OnnxValueMapType>;
    run(feeds, fetches, options?): Promise<OnnxValueMapType>;
    startProfiling(): void;
}

Properties

inputNames: readonly string[]

Get input names of the loaded model.

outputNames: readonly string[]

Get output names of the loaded model.

Methods

  • Release the inference session and the underlying resources.

    Returns Promise<void>

  • Execute the model asynchronously with the given feeds and options.

    Parameters

    • feeds: OnnxValueMapType

      Representation of the model input. See type description of InferenceSession.InputType for detail.

    • Optional options: RunOptions

      Optional. A set of options that controls the behavior of model inference.

    Returns Promise<OnnxValueMapType>

    A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding values.

  • Execute the model asynchronously with the given feeds, fetches and options.

    Parameters

    • feeds: OnnxValueMapType

      Representation of the model input. See type description of InferenceSession.InputType for detail.

    • fetches: FetchesType

      Representation of the model output. See type description of InferenceSession.OutputType for detail.

    • Optional options: RunOptions

      Optional. A set of options that controls the behavior of model inference.

    Returns Promise<OnnxValueMapType>

    A promise that resolves to a map, which uses output names as keys and OnnxValue as corresponding values.

Generated using TypeDoc