Andrei Cozma commited on
Commit
a33a97c
·
1 Parent(s): 64d4eec
Files changed (1) hide show
  1. AgentBase.py +3 -2
AgentBase.py CHANGED
@@ -104,8 +104,6 @@ class AgentBase:
104
  i = 0
105
  # Generate an episode following the current policy
106
  while i < max_steps and not solved and not done:
107
- # Render the environment if needed
108
- rgb_array = self.env.render() if render else None
109
  # Sample the next action from the policy
110
  action = self.choose_action(policy, state, **kwargs)
111
  # Keeping track of the trajectory
@@ -123,6 +121,9 @@ class AgentBase:
123
  # Generate the output at intermediate steps for the demo
124
  yield episode_hist, solved, rgb_array
125
 
 
 
 
126
  # For CliffWalking-v0 and Taxi-v3, the episode is solved when it terminates
127
  if done and self.env_name in ["CliffWalking-v0", "Taxi-v3"]:
128
  solved = True
 
104
  i = 0
105
  # Generate an episode following the current policy
106
  while i < max_steps and not solved and not done:
 
 
107
  # Sample the next action from the policy
108
  action = self.choose_action(policy, state, **kwargs)
109
  # Keeping track of the trajectory
 
121
  # Generate the output at intermediate steps for the demo
122
  yield episode_hist, solved, rgb_array
123
 
124
+ # Render the environment if needed
125
+ rgb_array = self.env.render() if render else None
126
+
127
  # For CliffWalking-v0 and Taxi-v3, the episode is solved when it terminates
128
  if done and self.env_name in ["CliffWalking-v0", "Taxi-v3"]:
129
  solved = True