Skip to content

Commit

Permalink
[Feature] Replace RewardClipping with SignTransform in Atari examples (
Browse files Browse the repository at this point in the history
  • Loading branch information
albertbou92 authored Feb 12, 2024
1 parent 6f6c896 commit 69d44f5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions examples/a2c/utils_atari.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
NoopResetEnv,
ParallelEnv,
Resize,
RewardClipping,
RewardSum,
SignTransform,
StepCounter,
ToTensorImage,
TransformedEnv,
Expand Down Expand Up @@ -73,7 +73,7 @@ def make_parallel_env(env_name, num_envs, device, is_test=False):
env.append_transform(RewardSum())
env.append_transform(StepCounter(max_steps=4500))
if not is_test:
env.append_transform(RewardClipping(-1, 1))
env.append_transform(SignTransform(in_keys=["reward"]))
env.append_transform(DoubleToFloat())
env.append_transform(VecNorm(in_keys=["pixels"]))
return env
Expand Down
4 changes: 2 additions & 2 deletions examples/dqn/utils_atari.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
GymEnv,
NoopResetEnv,
Resize,
RewardClipping,
RewardSum,
SignTransform,
StepCounter,
ToTensorImage,
TransformedEnv,
Expand All @@ -42,7 +42,7 @@ def make_env(env_name, frame_skip, device, is_test=False):
env.append_transform(NoopResetEnv(noops=30, random=True))
if not is_test:
env.append_transform(EndOfLifeTransform())
env.append_transform(RewardClipping(-1, 1))
env.append_transform(SignTransform(in_keys=["reward"]))
env.append_transform(ToTensorImage())
env.append_transform(GrayScale())
env.append_transform(Resize(84, 84))
Expand Down
4 changes: 2 additions & 2 deletions examples/impala/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
GymEnv,
NoopResetEnv,
Resize,
RewardClipping,
RewardSum,
SignTransform,
StepCounter,
ToTensorImage,
TransformedEnv,
Expand Down Expand Up @@ -46,7 +46,7 @@ def make_env(env_name, device, is_test=False):
env.append_transform(NoopResetEnv(noops=30, random=True))
if not is_test:
env.append_transform(EndOfLifeTransform())
env.append_transform(RewardClipping(-1, 1))
env.append_transform(SignTransform(in_keys=["reward"]))
env.append_transform(ToTensorImage(from_int=False))
env.append_transform(GrayScale())
env.append_transform(Resize(84, 84))
Expand Down
4 changes: 2 additions & 2 deletions examples/ppo/utils_atari.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
NoopResetEnv,
ParallelEnv,
Resize,
RewardClipping,
RewardSum,
SignTransform,
StepCounter,
ToTensorImage,
TransformedEnv,
Expand Down Expand Up @@ -71,7 +71,7 @@ def make_parallel_env(env_name, num_envs, device, is_test=False):
env.append_transform(RewardSum())
env.append_transform(StepCounter(max_steps=4500))
if not is_test:
env.append_transform(RewardClipping(-1, 1))
env.append_transform(SignTransform(in_keys=["reward"]))
env.append_transform(DoubleToFloat())
env.append_transform(VecNorm(in_keys=["pixels"]))
return env
Expand Down

0 comments on commit 69d44f5

Please sign in to comment.