Update _get_data_into_warp. Fixes #3109
PiperOrigin-RevId: 871790690 Change-Id: I225579f7559ca5c1de92af6606d02ff763f9f4d1
This commit is contained in:
committed by
Copybara-Service
parent
6b197e198a
commit
8541128853
@@ -1486,10 +1486,11 @@ def _get_data_into_warp(
|
|||||||
if field.name in (
|
if field.name in (
|
||||||
'actuator_moment',
|
'actuator_moment',
|
||||||
'contact',
|
'contact',
|
||||||
'efc_J',
|
|
||||||
'qM',
|
'qM',
|
||||||
'qLD',
|
'qLD',
|
||||||
'qLDiagInv',
|
'qLDiagInv',
|
||||||
|
'ten_J',
|
||||||
|
'flexedge_J',
|
||||||
):
|
):
|
||||||
continue
|
continue
|
||||||
if field.name.startswith('efc_'):
|
if field.name.startswith('efc_'):
|
||||||
|
|||||||
@@ -744,6 +744,22 @@ class DataIOTest(parameterized.TestCase):
|
|||||||
self.assertEqual(d_2.contact.frame.shape, (1, 9))
|
self.assertEqual(d_2.contact.frame.shape, (1, 9))
|
||||||
np.testing.assert_allclose(d_2.contact.frame, d.contact.frame)
|
np.testing.assert_allclose(d_2.contact.frame, d.contact.frame)
|
||||||
|
|
||||||
|
def test_get_data_into_warp(self):
|
||||||
|
"""Test get_data_into for impl='warp'."""
|
||||||
|
|
||||||
|
# TODO(taylorhowell): After put_data supports impl='warp' update test above
|
||||||
|
# and remove this test.
|
||||||
|
if not mjxw.WARP_INSTALLED:
|
||||||
|
self.skipTest('Warp is not installed.')
|
||||||
|
if not mjx_io.has_cuda_gpu_device():
|
||||||
|
self.skipTest('No CUDA GPU device.')
|
||||||
|
|
||||||
|
m = mujoco.MjModel.from_xml_string('<mujoco></mujoco>')
|
||||||
|
d = mujoco.MjData(m)
|
||||||
|
mx = mjx.put_model(m, impl='warp')
|
||||||
|
dx = mjx.make_data(m, impl='warp')
|
||||||
|
mjx.get_data_into(d, mx, dx)
|
||||||
|
|
||||||
@parameterized.parameters('jax', 'c')
|
@parameterized.parameters('jax', 'c')
|
||||||
def test_get_data_into_wrong_shape(self, impl):
|
def test_get_data_into_wrong_shape(self, impl):
|
||||||
"""Tests that get_data_into throwsif input and output shapes don't match."""
|
"""Tests that get_data_into throwsif input and output shapes don't match."""
|
||||||
|
|||||||
Reference in New Issue
Block a user