added benchmark task Crafter
This commit is contained in:
@@ -179,18 +179,22 @@ class RewardObs:
|
||||
@property
|
||||
def observation_space(self):
|
||||
spaces = self._env.observation_space.spaces
|
||||
assert "reward" not in spaces
|
||||
spaces["reward"] = gym.spaces.Box(-np.inf, np.inf, shape=(1,), dtype=np.float32)
|
||||
if "reward" not in spaces:
|
||||
spaces["reward"] = gym.spaces.Box(
|
||||
-np.inf, np.inf, shape=(1,), dtype=np.float32
|
||||
)
|
||||
return gym.spaces.Dict(spaces)
|
||||
|
||||
def step(self, action):
|
||||
obs, reward, done, info = self._env.step(action)
|
||||
obs["reward"] = reward
|
||||
if "reward" not in obs:
|
||||
obs["reward"] = reward
|
||||
return obs, reward, done, info
|
||||
|
||||
def reset(self):
|
||||
obs = self._env.reset()
|
||||
obs["reward"] = 0.0
|
||||
if "reward" not in obs:
|
||||
obs["reward"] = 0.0
|
||||
return obs
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user