MLCompilerBridge
Tools for streamlining communication with ML models for compiler optimizations.
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs
environment.h File Reference

Base Environment class to support ONNX based inference of RL models. More...

#include "MLModelRunner/ONNXModelRunner/agent.h"
#include <map>
Include dependency graph for environment.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  MLBridge::Environment
 

Namespaces

namespace  MLBridge
 

Typedefs

typedef signed Action
 

Detailed Description

Base Environment class to support ONNX based inference of RL models.

This class is used to define the environment for the agents to interact with.

The Environment should be defined by the compiler pass that is using the MLCompilerBridge. The environment should be defined by inheriting from this class and implementing the step() and reset() methods.

step() and reset() are typical methods used in RL environments.

The step() method takes an action as input and returns the observation corresponding to the next state. The reset() method returns the initial observation.

Usage:

  1. Create an environment class inheriting from MLBridge::Environment
  2. Implement step() and reset() methods

Example:

class MyEnvironment : public MLBridge::Environment {
public:
Observation &step(Action action) override {
// Implement the step function here
}
Observation &reset() override {
// Implement the reset function here
}
};
signed Action
virtual Observation & step(Action action)=0
Step function takes an action as input and returns the observation corresponding to the next state.
virtual Observation & reset()=0
Reset function returns the initial observation.

This environment can then be used by the ONNXModelRunner to interact with the agents. getNextAgent() and setNextAgent() methods can be used to set the next agent to interact with. These methods are used in step() and reset() to get the next agent to interact with in case of multi-agent environment.

Definition in file environment.h.

Typedef Documentation

◆ Action

typedef signed Action

Definition at line 53 of file environment.h.