From 5b992085928f0b14b93a1e12a2b05a627b23cb55 Mon Sep 17 00:00:00 2001 From: jtigue-bdai <166445701+jtigue-bdai@users.noreply.github.com> Date: Fri, 11 Oct 2024 13:44:34 -0400 Subject: [PATCH] Reduce code and rely on device checking in tensor.to Co-authored-by: Mayank Mittal <12863862+Mayankm96@users.noreply.github.com> Signed-off-by: jtigue-bdai <166445701+jtigue-bdai@users.noreply.github.com> --- .../omni.isaac.lab/omni/isaac/lab/utils/noise/noise_model.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/extensions/omni.isaac.lab/omni/isaac/lab/utils/noise/noise_model.py b/source/extensions/omni.isaac.lab/omni/isaac/lab/utils/noise/noise_model.py index ed4144dbcb..d99da58aae 100644 --- a/source/extensions/omni.isaac.lab/omni/isaac/lab/utils/noise/noise_model.py +++ b/source/extensions/omni.isaac.lab/omni/isaac/lab/utils/noise/noise_model.py @@ -30,10 +30,7 @@ def constant_noise(data: torch.Tensor, cfg: noise_cfg.ConstantNoiseCfg) -> torch # fix tensor device for bias on first call and update config parameters if isinstance(cfg.bias, torch.Tensor): - if cfg.bias.device is not data.device: - cfg.bias = cfg.bias.to( - data.device, - ) + cfg.bias = cfg.bias.to(device=data.device) if cfg.operation == "add": return data + cfg.bias