rfx.utils
Utility functions and helpers for multi-embodiment training, including DOF padding and observation/action transforms.Padding Functions
DOF padding utilities for training models across robots with different numbers of joints.PaddingConfig
Configuration for state/action padding.Constructor
Actual state dimension for this robot.
Actual action dimension for this robot.
Maximum state dimension across all robots in the dataset.
Maximum action dimension across all robots in the dataset.
pad_state
State tensor of shape
(batch, state_dim) or (batch, seq_len, state_dim).Actual state dimension.
Target padded dimension.
Padded state tensor of shape
(batch, max_state_dim) or (batch, seq_len, max_state_dim).pad_action
Action tensor of shape
(batch, action_dim) or (batch, seq_len, action_dim).Actual action dimension.
Target padded dimension.
Padded action tensor of shape
(batch, max_action_dim) or (batch, seq_len, max_action_dim).unpad_action
Padded action tensor.
Actual action dimension to extract.
Unpadded action tensor of shape
(..., action_dim).Transform Classes
Observation and action transforms for training.ObservationNormalizer
Running mean/std normalizer for observations using Welford’s algorithm.Constructor
Dimension of the state to normalize.
Maximum absolute value after normalization.
Small constant for numerical stability.
Methods
update
Batch of states, shape
(batch_size, state_dim).normalize
Observation dictionary containing
"state", optionally "images" and "language".Normalized observation dictionary.
to_dict
Dictionary containing all normalizer state.
from_dict
Serialized normalizer state.
Reconstructed normalizer.
ActionChunker
Action chunking for temporal abstraction. Ensembles multiple action predictions over a temporal horizon.Constructor
Number of timesteps to predict ahead.
Dimension of each action.
How to ensemble predictions:
"first", "average", or "exponential".Temperature for exponential weighting (only used if ensemble_mode=“exponential”).
Methods
add_chunk
Action chunk of shape
(batch, horizon, action_dim).get_action
Action tensor of shape
(batch, action_dim).reset
Ensemble Modes
"first": Use only the first prediction from the most recent chunk"average": Average all predictions for the current timestep"exponential": Weighted average with exponentially decaying weights based on prediction age
