Skip to content

Commit

Permalink
Fix: sensor_data_to_rgbd checks if 1 env, but not if force_gpu is true
Browse files Browse the repository at this point in the history
  • Loading branch information
arth-shukla committed Mar 2, 2024
1 parent ede12ea commit 1e7e578
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mani_skill2/envs/utils/observations/observations.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import numpy as np
import torch
import sapien.physx as physx

from mani_skill2.sensors.base_sensor import BaseSensor, BaseSensorConfig
from mani_skill2.sensors.camera import Camera
Expand All @@ -30,7 +31,7 @@ def sensor_data_to_rgbd(observation: Dict, sensors: Dict[str, BaseSensor]):
depth = -ori_images[key][..., [2]] # [H, W, 1]
# NOTE (stao): This is a bit of a hack since normally we have generic to_numpy call to convert internal torch tensors to numpy if we do not use GPU simulation
# but torch does not have a uint16 type so we convert that here earlier
if depth.shape[0] == 1:
if not physx.is_gpu_enabled and depth.shape[0] == 1:
depth = depth.numpy().astype(np.uint16)
new_images["depth"] = depth
else:
Expand Down

0 comments on commit 1e7e578

Please sign in to comment.