Tianshou/tianshou/env/utils.py

15 lines
343 B
Python
Raw Normal View History

2020-03-11 09:09:56 +08:00
import cloudpickle
class CloudpickleWrapper(object):
2020-04-04 21:02:06 +08:00
"""A cloudpickle wrapper used in :class:`~tianshou.env.SubprocVectorEnv`"""
2020-03-11 09:09:56 +08:00
def __init__(self, data):
self.data = data
2020-03-11 09:38:14 +08:00
2020-03-11 09:09:56 +08:00
def __getstate__(self):
return cloudpickle.dumps(self.data)
2020-03-11 09:38:14 +08:00
2020-03-11 09:09:56 +08:00
def __setstate__(self, data):
self.data = cloudpickle.loads(data)