From faa813891b0e4c6a18d3045c2a61b059b0ff456c Mon Sep 17 00:00:00 2001 From: R107333 Date: Fri, 3 Feb 2023 11:21:58 +0100 Subject: [PATCH 1/2] Add act to preprocess_fn call in collector. This allows to for instance to change the action registered into the buffer when the environment modify the action. (useful in offline learning for instance,since the true actions are in a dataset and the actions of the agent are ignored) --- tianshou/data/collector.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tianshou/data/collector.py b/tianshou/data/collector.py index b57e6f01d..089b5aff0 100644 --- a/tianshou/data/collector.py +++ b/tianshou/data/collector.py @@ -347,6 +347,7 @@ def collect( info=self.data.info, policy=self.data.policy, env_id=ready_env_ids, + act=self.data.act, ) ) From bdb11d8209420369858b15b32c4e3098fc071233 Mon Sep 17 00:00:00 2001 From: R107333 Date: Fri, 3 Feb 2023 13:28:22 +0100 Subject: [PATCH 2/2] Add act to preprocess_fn call in collectors. This allows to for instance to change the action registered into the buffer when the environment modify the action. (useful in offline learning for instance,since the true actions are in a dataset and the actions of the agent are ignored) --- tianshou/data/collector.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tianshou/data/collector.py b/tianshou/data/collector.py index 089b5aff0..88f6c76ba 100644 --- a/tianshou/data/collector.py +++ b/tianshou/data/collector.py @@ -627,6 +627,7 @@ def collect( truncated=self.data.truncated, info=self.data.info, env_id=ready_env_ids, + act=self.data.act, ) ) except TypeError: @@ -637,6 +638,7 @@ def collect( done=self.data.done, info=self.data.info, env_id=ready_env_ids, + act=self.data.act, ) )