Repository: pytorch/rl

Issue:
[BUG] RenameTransform
## Describe the bug

When using the RenameTransform on a key in the tensordict, the renamed object is not included in the output_spec. 

## To Reproduce

Script to reproduce observed behavior:

```
import torch
import torch.cuda

from torchrl.envs import EnvCreator, ParallelEnv

from torchrl.envs.libs.gym import GymEnv
from torchrl.envs import (
    StepCounter,
    RenameTransform,
    TransformedEnv,

)


def env_maker(env_name, frame_skip=1, device="cpu", from_pixels=False):
    return GymEnv(
        env_name, device=device, frame_skip=frame_skip, from_pixels=from_pixels
    )


def make_transformed_env(env):
    transformed_env = TransformedEnv(env)
    transformed_env.append_transform(StepCounter())
    transformed_env.append_transform(RenameTransform(["step_count"], ["timesteps"], create_copy=True))

    return transformed_env


def main():
    test_env = make_transformed_env(ParallelEnv(1, EnvCreator(lambda: env_maker("Pendulum-v1"))))
    print(test_env.output_spec)

if __name__ == "__main__":
    main()
```
Further, when setting create_copy=False and adding the line `test_env.rollout(max_steps=10)` we get a KeyError `'key "step_count" not found in TensorDict with keys [\'action\', \'done\', \'next\', \'observation\', \'timesteps\']'`

## Expected behavior

The key timesteps should be included in the output_spec for both when create_copy=True or False.

## Additional context

When debugging this issue I found that the `transform_output_spec` function of the RenameTransform gets never called to adapt the output_spec accordingly. However, I have not found out why it never is called. 

## Checklist

- [X] I have checked that there is no similar issue in the repo (**required**)
- [X] I have read the [documentation](https://github.com/pytorch/rl/tree/main/docs/) (**required**)
- [X] I have provided a minimal working example to reproduce the bug (**required**)



Discussion:

Resolving patch:
diff --git a/torchrl/envs/transforms/transforms.py b/torchrl/envs/transforms/transforms.py
--- a/torchrl/envs/transforms/transforms.py
+++ b/torchrl/envs/transforms/transforms.py
@@ -781,6 +781,11 @@ def transform_observation_spec(self, observation_spec: TensorSpec) -> TensorSpec
             observation_spec = t.transform_observation_spec(observation_spec)
         return observation_spec
 
+    def transform_output_spec(self, output_spec: TensorSpec) -> TensorSpec:
+        for t in self.transforms:
+            output_spec = t.transform_output_spec(output_spec)
+        return output_spec
+
     def transform_reward_spec(self, reward_spec: TensorSpec) -> TensorSpec:
         for t in self.transforms:
             reward_spec = t.transform_reward_spec(reward_spec)
@@ -3693,7 +3698,6 @@ class RenameTransform(Transform):
                     batch_size=torch.Size([3]),
                     device=cpu,
                     is_shared=False),
-                reward: Tensor(shape=torch.Size([3, 1]), device=cpu, dtype=torch.float32, is_shared=False),
                 stuff: Tensor(shape=torch.Size([3, 3]), device=cpu, dtype=torch.float32, is_shared=False)},
             batch_size=torch.Size([3]),
             device=cpu,


Test patch:
diff --git a/test/test_transforms.py b/test/test_transforms.py
--- a/test/test_transforms.py
+++ b/test/test_transforms.py
@@ -6675,32 +6675,29 @@ def test_crop_mask(self, mask_key):
 
 @pytest.mark.parametrize("create_copy", [True, False])
 class TestRenameTransform(TransformBase):
-    def test_single_trans_env_check(self, create_copy):
-        env = TransformedEnv(
-            ContinuousActionVecMockEnv(),
-            RenameTransform(
-                [
-                    "observation",
-                ],
-                [
-                    "stuff",
-                ],
-                create_copy=create_copy,
-            ),
+    @pytest.mark.parametrize("compose", [True, False])
+    def test_single_trans_env_check(self, create_copy, compose):
+        t = RenameTransform(
+            ["observation"],
+            ["stuff"],
+            create_copy=create_copy,
         )
+        if compose:
+            t = Compose(t)
+        env = TransformedEnv(ContinuousActionVecMockEnv(), t)
         check_env_specs(env)
-        env = TransformedEnv(
-            ContinuousActionVecMockEnv(),
-            RenameTransform(
-                ["observation_orig"],
-                ["stuff"],
-                ["observation_orig"],
-                [
-                    "stuff",
-                ],
-                create_copy=create_copy,
-            ),
+        t = RenameTransform(
+            ["observation_orig"],
+            ["stuff"],
+            ["observation_orig"],
+            [
+                "stuff",
+            ],
+            create_copy=create_copy,
         )
+        if compose:
+            t = Compose(t)
+        env = TransformedEnv(ContinuousActionVecMockEnv(), t)
         check_env_specs(env)
 
     def test_serial_trans_env_check(self, create_copy):