Skip to content

Commit

Permalink
temp
Browse files Browse the repository at this point in the history
  • Loading branch information
arth-shukla committed Jan 22, 2024
1 parent 9a19e1b commit 833a230
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
8 changes: 7 additions & 1 deletion mani_skill2/envs/sapien_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,20 +614,26 @@ def _clear_sim_state(self):
# -------------------------------------------------------------------------- #

def step(self, action: Union[None, np.ndarray, Dict]):
print("gamer1")
with sapien.profile("step_action"):
self.step_action(action)
self._elapsed_steps += 1
print("gamer2")
# TODO (stao): I think evaluation should always occur first before generating observations
# as evaluation is more likely to use privileged information whereas observations only sometimes should include privileged information
print("gamer3")
with sapien.profile("get_obs"):
obs = self.get_obs()
print("gamer4")
info = self.get_info(obs=obs)
print("gamer5")
reward = self.get_reward(obs=obs, action=action, info=info)
print("gamer6")
terminated = info["success"]
if self.num_envs == 1:
terminated = terminated[0]
reward = reward[0]

print("gamer7")
if physx.is_gpu_enabled():
return obs, reward, terminated, torch.Tensor(False), info
else:
Expand Down
3 changes: 0 additions & 3 deletions mani_skill2/utils/sapien_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,9 @@ def _unbatch(array: Union[Array, Sequence]):
if isinstance(array, torch.Tensor):
return array.squeeze(0)
if isinstance(array, np.ndarray):
print('NDARRAY', array)
print(array.shape)
if np.iterable(array) and array.shape[0] == 1:
return array.squeeze(0)
if isinstance(array, list):
print('LIST', array)
if len(array) == 1:
return array[0]
return array
Expand Down

0 comments on commit 833a230

Please sign in to comment.