MCPcopy Create free account
hub / github.com/SpatialVLA/SpatialVLA / relabel_bridge_actions

Function relabel_bridge_actions

data/utils/data_utils.py:179–189  ·  view source on GitHub ↗

Relabels actions to use reached proprioceptive state; discards last timestep (no-action).

(traj: Dict[str, Any])

Source from the content-addressed store, hash-verified

177
178# === Bridge-V2 =>> Dataset-Specific Transform ===
179def relabel_bridge_actions(traj: Dict[str, Any]) -> Dict[str, Any]:
180 """Relabels actions to use reached proprioceptive state; discards last timestep (no-action)."""
181 movement_actions = (
182 traj["observation"]["state"][1:, :6] - traj["observation"]["state"][:-1, :6]
183 )
184 traj_truncated = tf.nest.map_structure(lambda x: x[:-1], traj)
185 traj_truncated["action"] = tf.concat(
186 [movement_actions, traj["action"][:-1, -1:]], axis=1
187 )
188
189 return traj_truncated
190
191
192# === RLDS Dataset Initialization Utilities ===

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected