Interface OrtSession.SessionOptions.EpContextDataReadCallback

Enclosing class:
OrtSession.SessionOptions
Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public static interface OrtSession.SessionOptions.EpContextDataReadCallback
Supplies external EPContext data during session initialization.

The returned array is copied into memory owned by ONNX Runtime during the enclosing native operation. Do not modify or reuse its contents until that operation completes; concurrent modification can change the data being copied. Return a fresh array when the callback uses mutable shared storage. Returning null or throwing an exception fails the ONNX Runtime operation without falling back to filesystem access.

ONNX Runtime may invoke this callback concurrently from multiple threads. Implementations must synchronize access to shared state.

Session creation uses a snapshot of the source OrtSession.SessionOptions. Replacing or clearing the callback on those options from inside this callback does not affect the in-progress creation. Closing the source options while creation is in progress is rejected.

  • Method Summary

    Modifier and Type
    Method
    Description
    byte[]
    read(String name)
    Reads one complete named EPContext payload.
  • Method Details

    • read

      byte[] read(String name) throws Exception
      Reads one complete named EPContext payload.
      Parameters:
      name - The logical UTF-8 data identifier stored in the EPContext node.
      Returns:
      The payload. A zero-length array represents an empty payload.
      Throws:
      Exception - If the payload cannot be read.