MLModelRunner that requests advice from an external agent over two files.
Synopsis
Declared in <llvm/Analysis/InteractiveModelRunner.h>
class InteractiveModelRunner
: public MLModelRunner
Description
It uses 2 files ‐ ideally named pipes ‐ one to send data to that agent, and one to receive advice. The data exchange uses the training logger (Utils/TrainingLogger.h) format. Specifically, the compiler will send the log header, set the context, and send observations; the host is expected to reply with a tensor value after each observation as a binary buffer that's conforming to the shape of the advice. Interleaved, the data closely resembles the training log for a log where we don't capture the reward signal.
Note that the correctness of the received data is the responsibility of the host. In particular, if insufficient data were sent, the compiler will block when waiting for an advice.
Note that the host can either open the pipes RW, or open first the pipe to the compiler ‐ i.e. the "Inbound" ‐ and then the "Outbound", to avoid deadlock. This is because the compiler first tries to open the inbound (which will hang until there's a writer on the other end).
Base Classes
Name |
Description |
Interface for evaluating an ML model given tensors as arguments. |
Enums
Name |
Description |
Kind of concrete MLModelRunner implementation. |
Member Functions
Name |
Description |
|
Construct an interactive runner that exchanges tensors with a host agent. |
|
Destroy this InteractiveModelRunner. |
|
Deleted copy assignment; MLModelRunner is not assignable. |
Evaluate the model and return the result cast to type |
|
Return the concrete runner kind of this instance. |
|
|
|
|
|
|
Switch the logging context to |
Static Member Functions
Name |
Description |
Return true if |
Protected Member Functions
Name |
Description |
|
Run the model and return an untyped pointer to the result buffer. |
Bind input buffer |