pytorch / pytorch/rl

[Feature Request] FrameSkipTransform - output every intermediate step?

Open
#1,633 6 comments 0 reactions 1 assignee View on GitHub

@vmoens is already working on this.

Since Oct 19, 2023.

enhancement
Dominant language
Python
Stars
3.6k
Forks
484
Avg merge
1d 1h
Merged PRs (30d)
207

Description

Motivation

A feature request regarding the FrameSkipTransform (documentation here). When the frame_skip parameter is set to an integer greater than 1, i.e. frame_skip = 2, and I do a rollout in the resulting environment with num_steps steps, I receive num_steps observations. The underlying untransformed environment actually takes frame_skip * num_steps steps (with each action being repeated frame_skip times), but the transformed environment only outputs every frame_skip observation.

I find this be a bit counterintuitive. Personally, I would find it more natural if the transformed env would output the full frame_skip * num_steps steps. If say, num_steps =2, then the "action" entry in the TensorDict would then look something like [-0.1, -0.1, -0.15, -0.15, -0.2, -0.2, ...], i.e. it would show the repeated actions.

Solution

Is this doable with the current way Transforms work? If so, happy to contribute this. This could be an option in the FrameSkipTransform, allowing the user to choose between either outputting every step the env actually takes, or only every frame_skip step like it currently does.

Checklist

  • I have checked that there is no similar issue in the repo (required)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.