Skip to content
This repository has been archived by the owner on Sep 18, 2024. It is now read-only.

Up-to-date with send/recv API change of tianshou #4586

Merged
merged 1 commit into from
Feb 28, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions nni/retiarii/strategy/_rl_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,17 @@ def __getattr__(self, key):
def reset(self):
return self.env.reset()

def send(self, action):
# for tianshou >= 0.4.6
if action is None:
self.result = self.pool.apply_async(self.env.reset)
else:
self.send_action(action)

def recv(self):
# for tianshou >= 0.4.6
return self.result.get()

@staticmethod
def wait(*args, **kwargs):
raise NotImplementedError('Async collect is not supported yet.')
Expand Down