Skip to content

Commit

Permalink
Minor changes in documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
svkeerthy committed Jan 27, 2024
1 parent 4d26853 commit ae43ed9
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
24 changes: 12 additions & 12 deletions CompilerInterface/PipeCompilerInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def __init__(self, data_format=None, pipe_name=None):
self.pipe_name = pipe_name
self.to_compiler = None
self.from_compiler = None
self.tc = None
self.fc = None
self.tc_buffer = None
self.fc_buffer = None
self.buffer = None
self.init_pipes()

Expand All @@ -40,13 +40,13 @@ def __del__(self):
def evaluate(self, mode=None):
out = self.serdes_obj.getOutputBuffer()
if out is not None:
self.tc.write(out)
self.tc.flush()
self.tc_buffer.write(out)
self.tc_buffer.flush()

if mode == "exit":
return None

result = self.serdes_obj.deserializeData(self.fc)
result = self.serdes_obj.deserializeData(self.fc_buffer)

return result

Expand All @@ -64,16 +64,16 @@ def init_pipes(self):

## Resets the buffered reader/writers.
def reset_pipes(self):
self.tc = io.BufferedWriter(io.FileIO(self.to_compiler, "wb"))
self.fc = io.BufferedReader(io.FileIO(self.from_compiler, "rb"))
self.tc_buffer = io.BufferedWriter(io.FileIO(self.to_compiler, "wb"))
self.fc_buffer = io.BufferedReader(io.FileIO(self.from_compiler, "rb"))

## Closes the buffered reader/writers.
def close_pipes(self):
if self.fc is not None:
self.tc.close()
self.fc.close()
self.tc = None
self.fc = None
if self.fc_buffer is not None:
self.tc_buffer.close()
self.fc_buffer.close()
self.tc_buffer = None
self.fc_buffer = None

## Deletes the pipe files.
def remove_pipes(self):
Expand Down
3 changes: 1 addition & 2 deletions CompilerInterface/log_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
# ------------------------------------------------------------------------------
##
## @file
## Reader for training log.
## See lib/Analysis/TrainingLogger.cpp for a description of the format.
## Reader for training log. Used by Pipe compiler interface with bitstream data.
##
# ------------------------------------------------------------------------------

Expand Down
1 change: 0 additions & 1 deletion include/MLModelRunner/MLModelRunner.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ class MLModelRunner {
BaseSerDes::Kind getSerDesKind() const { return SerDesType; }

virtual void requestExit() = 0;
std::promise<void> *exit_requested;

/// User-facing interface for setting the features to be sent to the model.
/// The features are passed as a list of key-value pairs.
Expand Down
8 changes: 4 additions & 4 deletions include/MLModelRunner/ONNXModelRunner/environment.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ class Environment {
std::map<std::string, Observation &> obsMap;

public:
/// CheckDone returns true if the termination condition is met.
/// CheckDone returns true if the termination condition is met at the end of
/// the episode.
bool checkDone() { return done == true; };

/// SetDone sets the termination condition to true.
void setDone() { done = true; }
void resetDone() { done = false; }

/// GetNextAgent returns the name of the next agent to interact with.
/// GetNextAgent returns the name/ID of the next agent to interact with.
std::string getNextAgent() { return nextAgent; };

/// SetNextAgent sets the name of the next agent to interact with.
Expand All @@ -83,8 +84,7 @@ class Environment {

/// Reset function returns the initial observation. This method should be
/// implemented by the user. This method can internally call setNextAgent() to
/// set the next agent to interact with and setDone()/resetDone() to set/reset
/// the termination condition.
/// set the next agent to interact with.
virtual Observation &reset() = 0;
};
} // namespace MLBridge
Expand Down

0 comments on commit ae43ed9

Please sign in to comment.