Unverified Commit 6b828681 authored by Yuge Zhang's avatar Yuge Zhang Committed by GitHub
Browse files

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

parent fa5127b3
......@@ -43,6 +43,17 @@ class MultiThreadEnvWorker(EnvWorker):
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.')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment