timestep_conditioning
timestep_conditioning
¶
Shared validation helpers for timestep-conditioned action decoders.
validate_noisy_action_tensors
¶
Validate noisy action tensors against action-head output dimensions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions
|
dict[str, Tensor]
|
Dictionary of noisy actions provided by the decoding algorithm. |
required |
action_heads
|
Mapping[str, BaseActionHead]
|
Decoder action heads keyed by action name. |
required |
prediction_horizon
|
int
|
Expected action chunk length. |
required |
decoder_name
|
str
|
Name used in error messages. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, device]
|
Batch size and device shared by all action tensors. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If keys, ranks, horizon, dimensions, batch size, or devices are inconsistent. |
Source code in src/versatil/models/decoding/decoders/timestep_conditioning.py
validate_action_tensors_against_dimensions
¶
validate_action_tensors_against_dimensions(actions, action_dimensions, prediction_horizon, decoder_name)
Validate action tensors before concatenating them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions
|
dict[str, Tensor]
|
Dictionary of action tensors provided by the decoding algorithm. |
required |
action_dimensions
|
Mapping[str, int]
|
Expected last dimension for each action key. |
required |
prediction_horizon
|
int
|
Expected action chunk length. |
required |
decoder_name
|
str
|
Name used in error messages. |
required |
Returns:
| Type | Description |
|---|---|
tuple[int, device]
|
Batch size and device shared by all action tensors. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If keys, ranks, horizon, dimensions, batch size, or devices are inconsistent. |
Source code in src/versatil/models/decoding/decoders/timestep_conditioning.py
extract_timestep_conditioning
¶
Extract and validate timestep conditioning without mutating features.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
dict[str, Tensor]
|
Decoder feature dictionary. |
required |
batch_size
|
int
|
Batch size inferred from action tensors. |
required |
action_device
|
device
|
Device shared by action tensors. |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
Timestep tensor with shape |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the timestep key is missing or has an invalid shape, batch size, or device. |
Source code in src/versatil/models/decoding/decoders/timestep_conditioning.py
filter_timestep_feature
¶
Return observation features without timestep conditioning.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
features
|
dict[str, Tensor]
|
Decoder feature dictionary. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
New feature dictionary without the timestep key. |