temporal_aggregation
temporal_aggregation
¶
Temporal aggregation for action sequences.
TemporalAggregator
¶
TemporalAggregator(device, action_keys_to_dimensions, prediction_horizon, max_timesteps=10000, exponential_decay=0.01, favor_more_recent=True)
Exponential-weighted temporal averaging of overlapping action predictions.
Accumulates action chunks over time and returns a weighted average for the current step. Works with any set of action keys and dimensions.
Initialize temporal aggregator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
device
|
device
|
Torch device for tensors. |
required |
action_keys_to_dimensions
|
dict[str, int]
|
Mapping from action key to dimension. |
required |
prediction_horizon
|
int
|
Number of future steps predicted per inference. |
required |
max_timesteps
|
int
|
Maximum episode length. |
10000
|
exponential_decay
|
float
|
Decay factor for exponential weighting. |
0.01
|
favor_more_recent
|
bool
|
Whether to weight newer predictions more heavily. |
True
|
Source code in src/versatil/inference/temporal_aggregation.py
store_and_average
¶
Store current predictions and return averaged action for this timestep.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
current_predictions
|
dict[str, Tensor]
|
Dict mapping action key to predicted tensor of shape (prediction_horizon, dimension). |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Dict mapping action key to averaged tensor of shape (dimension,). |