addition of "is_first" and "is_terminal" for envs

This commit is contained in:
NM512
2023-04-29 07:34:27 +09:00
parent 3d0e2c8b5a
commit 12cccd8475
2 changed files with 11 additions and 4 deletions

View File

@@ -44,7 +44,8 @@ class DeepMindControl:
obs = dict(time_step.observation)
obs["image"] = self.render()
# There is no terminal state in DMC
obs["is_terminal"] = False
obs["is_terminal"] = False if time_step.first() else time_step.discount == 0
obs["is_first"] = time_step.first()
done = time_step.last()
info = {"discount": np.array(time_step.discount, np.float32)}
return obs, reward, done, info
@@ -53,7 +54,8 @@ class DeepMindControl:
time_step = self._env.reset()
obs = dict(time_step.observation)
obs["image"] = self.render()
obs["is_terminal"] = False
obs["is_terminal"] = False if time_step.first() else time_step.discount == 0
obs["is_first"] = time_step.first()
return obs
def render(self, *args, **kwargs):