From e4a9f535a4fe05c2120ae9cd7afb17665f917e6b Mon Sep 17 00:00:00 2001 From: Baruch Tabanpour Date: Thu, 19 Oct 2023 17:28:50 -0700 Subject: [PATCH] Make MJX device_put type validation more verbose. PiperOrigin-RevId: 575050350 Change-Id: I7cab4ee54d462b61e9478dbd58d99bb9fb662daf --- doc/changelog.rst | 1 + mjx/mujoco/mjx/_src/device.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index e212eb61..e64a7300 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -15,6 +15,7 @@ MJX Bug fixes 1. Fix typos and supported fields in the docs (fixes :github:issue:`1105` and :github:issue:`1106`). 2. Fix bug where mixed `jnt_limited` joints are not being constrained correctly. +3. Make `device_put` type validation more verbose (fixed :github:issue:`1113`). Version 3.0.0 (October 18, 2023) -------------------------------- diff --git a/mjx/mujoco/mjx/_src/device.py b/mjx/mujoco/mjx/_src/device.py index 3c3c213f..a917e7f9 100644 --- a/mjx/mujoco/mjx/_src/device.py +++ b/mjx/mujoco/mjx/_src/device.py @@ -116,8 +116,9 @@ def _validate(m: mujoco.MjModel): typs = set(val) if isinstance(val, Iterable) else {val} unsupported_typs = typs - set(_TYPE_MAP[mj_type]) - if unsupported_typs: - raise NotImplementedError(f'{unsupported_typs} not implemented.') + unsupported = [mj_type(t) for t in unsupported_typs] + if unsupported: + raise NotImplementedError(f'{unsupported} not implemented.') # check condim if any(dim != 3 for dim in m.geom_condim) or any(