MCPcopy Create free account
hub / github.com/MotrixLab/insactor / deserialize_qp

Function deserialize_qp

diffmimic/utils/io.py:6–14  ·  view source on GitHub ↗
(nparray)

Source from the content-addressed store, hash-verified

4
5
6def deserialize_qp(nparray) -> brax.QP:
7 num_bodies = nparray.shape[-1] // 13
8 batch_dims = nparray.shape[:-1]
9 slices = [num_bodies * x for x in [0, 3, 7, 10, 13]]
10 pos = jnp.reshape(nparray[..., slices[0]:slices[1]], batch_dims + (num_bodies, 3))
11 rot = jnp.reshape(nparray[..., slices[1]:slices[2]], batch_dims + (num_bodies, 4))
12 vel = jnp.reshape(nparray[..., slices[2]:slices[3]], batch_dims + (num_bodies, 3))
13 ang = jnp.reshape(nparray[..., slices[3]:slices[4]], batch_dims + (num_bodies, 3))
14 return QP(pos=pos, rot=rot, vel=vel, ang=ang)
15
16
17def serialize_qp(qp) -> jnp.array:

Callers 8

show_rollout_trajFunction · 0.90
displayFunction · 0.90
add_scene_to_trajFunction · 0.90
remove_scene_from_trajFunction · 0.90
add_scene_to_trajFunction · 0.90
remove_scene_from_trajFunction · 0.90
reset_refMethod · 0.90
reset_refMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected