Anonymous View
ONNX Runtime JavaScript API
    Preparing search index...

    Interface InferenceSession

    Represent a runtime instance of an ONNX model.

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

    Properties

    inputMetadata: readonly ValueMetadata[]

    Get input metadata of the loaded model.

    inputNames: readonly string[]

    Get input names of the loaded model.

    outputMetadata: readonly ValueMetadata[]

    Get output metadata 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.

      • Optionaloptions: 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.

      • Optionaloptions: 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.