Skip to content

Commit 6019406

Browse files
authored
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
1 parent 774d3d8 commit 6019406

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tianshou/data/collector.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ def collect(
347347
info=self.data.info,
348348
policy=self.data.policy,
349349
env_id=ready_env_ids,
350+
act=self.data.act,
350351
)
351352
)
352353

@@ -626,6 +627,7 @@ def collect(
626627
truncated=self.data.truncated,
627628
info=self.data.info,
628629
env_id=ready_env_ids,
630+
act=self.data.act,
629631
)
630632
)
631633
except TypeError:
@@ -636,6 +638,7 @@ def collect(
636638
done=self.data.done,
637639
info=self.data.info,
638640
env_id=ready_env_ids,
641+
act=self.data.act,
639642
)
640643
)
641644

0 commit comments

Comments
 (0)