From 6019406cffe3db74feb254eef8deaff1410e8a28 Mon Sep 17 00:00:00 2001 From: Jose Antonio Martin H Date: Fri, 3 Feb 2023 20:19:38 +0100 Subject: [PATCH] Add "act" to preprocess_fn call in collector. (#801) This allows, 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. - [ ] I have marked all applicable categories: + [ ] exception-raising fix + [ ] algorithm implementation fix + [ ] documentation modification + [X] new feature - [X ] I have reformatted the code using `make format` (**required**) - [X] I have checked the code using `make commit-checks` (**required**) - [] If applicable, I have mentioned the relevant/related issue(s) - [X] If applicable, I have listed every items in this Pull Request below --- tianshou/data/collector.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tianshou/data/collector.py b/tianshou/data/collector.py index b57e6f0..88f6c76 100644 --- a/tianshou/data/collector.py +++ b/tianshou/data/collector.py @@ -347,6 +347,7 @@ class Collector(object): info=self.data.info, policy=self.data.policy, env_id=ready_env_ids, + act=self.data.act, ) ) @@ -626,6 +627,7 @@ class AsyncCollector(Collector): truncated=self.data.truncated, info=self.data.info, env_id=ready_env_ids, + act=self.data.act, ) ) except TypeError: @@ -636,6 +638,7 @@ class AsyncCollector(Collector): done=self.data.done, info=self.data.info, env_id=ready_env_ids, + act=self.data.act, ) )