transform
transform
¶
normalize_sample
¶
Normalize a pre-built sample.
Tokenization is a separate step; see tokenize_observation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sample
|
dict[str, dict[str, Tensor]]
|
Pre-built sample with observation and action dictionaries. |
required |
normalizer
|
LinearNormalizer
|
Normalizer to use for normalization. |
required |
observation_space
|
ObservationSpace
|
Observation space configuration. |
required |
action_space
|
ActionSpace
|
Action space configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, dict[str, Tensor]]
|
Normalized sample. |
Source code in src/versatil/data/processing/transform.py
normalize_observation
¶
Normalize observations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
dict[str, Tensor]
|
Observation dictionary. |
required |
normalizer
|
LinearNormalizer
|
Normalizer to use for normalization. |
required |
observation_space
|
ObservationSpace
|
Observation space configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Normalized observation dictionary. |
Source code in src/versatil/data/processing/transform.py
normalize_actions
¶
Normalize actions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actions
|
dict[str, Tensor]
|
Action dictionary. |
required |
normalizer
|
LinearNormalizer
|
Normalizer to use for normalization. |
required |
action_space
|
ActionSpace
|
Action space configuration. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Tensor]
|
Normalized action dictionary. |
Source code in src/versatil/data/processing/transform.py
unnormalize_actions
¶
Unnormalize actions using the normalizer with per-key statistics.
Source code in src/versatil/data/processing/transform.py
tokenize_sample
¶
Tokenize observations and actions according to the action space configuration.
Source code in src/versatil/data/processing/transform.py
tokenize_observation
¶
Tokenize observations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
observation
|
dict[str, Tensor]
|
Observation dictionary. |
required |
obs_tokenizer
|
ObservationTokenizer
|
Fitted observation tokenizer. |
required |
batched
|
bool
|
Whether observations carry a leading batch dimension in front of the observation horizon. |
False
|
Source code in src/versatil/data/processing/transform.py
tokenize_actions
¶
Tokenize actions.
Source code in src/versatil/data/processing/transform.py
detokenize_actions
¶
Detokenize actions.