Skip to content
This repository was archived by the owner on Jul 7, 2023. It is now read-only.

Commit 29e6950

Browse files
konradczechowskiCopybara-Service
authored andcommitted
internal merge of PR #1364
PiperOrigin-RevId: 228901855
1 parent 9266e67 commit 29e6950

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

tensor2tensor/rl/player.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@
6161
from tensor2tensor.rl.envs.simulated_batch_env import PIL_Image
6262
from tensor2tensor.rl.envs.simulated_batch_env import PIL_ImageDraw
6363
from tensor2tensor.rl.envs.simulated_batch_gym_env import FlatBatchEnv
64-
from tensor2tensor.rl.rl_utils import absolute_hinge_difference, full_game_name
64+
from tensor2tensor.rl.rl_utils import absolute_hinge_difference
65+
from tensor2tensor.rl.rl_utils import full_game_name
6566
# Import flags from t2t_trainer and trainer_model_based
6667
import tensor2tensor.rl.trainer_model_based_params # pylint: disable=unused-import
6768
from tensor2tensor.utils import registry
@@ -136,7 +137,7 @@ class PlayerEnv(gym.Env):
136137
HEADER_HEIGHT = 27
137138

138139
def __init__(self, action_meanings):
139-
"""
140+
"""Constructor for PlayerEnv.
140141
141142
Args:
142143
action_meanings: list of strings indicating action names. Can be obtain by
@@ -252,7 +253,6 @@ def _augment_observation(self, ob, reward, cumulative_reward):
252253
pixel_fill = (0, 255, 0)
253254
else:
254255
pixel_fill = (255, 0, 0)
255-
pixel_fill = (255, 0, 0)
256256
header[0, :, :] = pixel_fill
257257
return np.concatenate([header, ob], axis=0)
258258

@@ -312,6 +312,10 @@ def __init__(self, real_env, sim_env, action_meanings):
312312
sim_env: simulation of `real_env` to be compared with. E.g.
313313
`SimulatedGymEnv` must allow to update initial frames for next reset
314314
with `add_to_initial_stack` method.
315+
action_meanings: list of strings indicating action names. Can be obtain by
316+
>>> env = gym.make("PongNoFrameskip-v4") # insert your game name
317+
>>> env.unwrapped.get_action_meanings()
318+
See gym AtariEnv get_action_meanings() for more details.
315319
"""
316320
super(SimAndRealEnvPlayer, self).__init__(action_meanings)
317321
assert real_env.observation_space.shape == sim_env.observation_space.shape

0 commit comments

Comments
 (0)