Skip to content

Commit

Permalink
Revert "[microTVM] Add open and close methods to Session class"
Browse files Browse the repository at this point in the history
This reverts commit 5976550.

Instead of adding an open() method to the API, contextlib.ExitStack() +
enter_context() will be used to manage the context for micro session.
  • Loading branch information
gromero committed Oct 24, 2021
1 parent 7534618 commit 42167f9
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions python/tvm/micro/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def __init__(
----------
transport_context_manager : ContextManager[transport.Transport]
If given, `flasher` and `binary` should not be given. On entry, this context manager
should establish a transport between this TVM instance and the device.
should establish a tarnsport between this TVM instance and the device.
session_name : str
Name of the session, used for debugging.
timeout_override : TransportTimeouts
Expand Down Expand Up @@ -107,7 +107,7 @@ def _wrap_transport_write(self, data, timeout_microsec):

return len(data) # TODO(areusch): delete

def open(self):
def __enter__(self):
"""Initialize this session and establish an RPC session with the on-device RPC server.
Returns
Expand Down Expand Up @@ -142,12 +142,6 @@ def open(self):
self.transport.__exit__(*sys.exc_info())
raise

def close(self):
self.transport.__exit__()

def __enter__(self):
return self.open()

def __exit__(self, exc_type, exc_value, exc_traceback):
"""Tear down this session and associated RPC session resources."""
if not self._exit_called:
Expand Down

0 comments on commit 42167f9

Please sign in to comment.