unienv_interface.transformations.iter_transform¶
Classes:
| Name | Description |
|---|---|
LeafwiseTransformation |
Apply a separate transformation to each leaf of a dict/tuple space. |
IterativeTransformation |
|
Functions:
| Name | Description |
|---|---|
default_is_leaf_fn |
|
find_leaf_source_space |
|
LeafwiseTransformation
¶
LeafwiseTransformation(
transformations: Union[DataTransformation, Mapping[str, Any], Tuple[Any, ...]],
)
Bases: DataTransformation
Apply a separate transformation to each leaf of a dict/tuple space.
transformations mirrors the space structure: a mapping for a
DictSpace, a tuple for a TupleSpace and a DataTransformation for
a leaf. This is what :meth:IterativeTransformation.direction_inverse
returns when the leaves need different inverses (e.g. rescaling leaves with
different source bounds).
Methods:
| Name | Description |
|---|---|
get_target_space_from_source |
|
transform |
|
direction_inverse |
|
close |
|
serialize |
|
deserialize_from |
|
Attributes:
| Name | Type | Description |
|---|---|---|
transformations |
|
|
has_inverse |
|
has_inverse
instance-attribute
¶
serialize
¶
serialize(
source_space: Optional[Space[Any, BDeviceType, BDtypeType, BRNGType]] = None,
) -> Dict[str, Any]
deserialize_from
classmethod
¶
deserialize_from(
json_data: Dict[str, Any],
source_space: Optional[Space[Any, BDeviceType, BDtypeType, BRNGType]] = None,
) -> LeafwiseTransformation
IterativeTransformation
¶
IterativeTransformation(
transformation: DataTransformation,
is_leaf_node_fn: Callable[
[Space[Any, BDeviceType, BDtypeType, BRNGType]], bool
] = default_is_leaf_fn,
inv_is_leaf_node_fn: Callable[
[Space[Any, BDeviceType, BDtypeType, BRNGType]], bool
] = default_is_leaf_fn,
)
Bases: DataTransformation
Methods:
| Name | Description |
|---|---|
get_target_space_from_source |
|
transform |
|
direction_inverse |
Return the inverse transformation. |
close |
|
serialize |
|
deserialize_from |
|
Attributes:
| Name | Type | Description |
|---|---|---|
transformation |
|
|
is_leaf_node_fn |
|
|
inv_is_leaf_node_fn |
|
|
has_inverse |
|
get_target_space_from_source
¶
get_target_space_from_source(
source_space: Space[Any, BDeviceType, BDtypeType, BRNGType],
)
transform
¶
transform(
source_space: Space, data: Union[Mapping[str, Any], BArrayType]
) -> Union[Mapping[str, Any], BArrayType]
direction_inverse
¶
direction_inverse(
source_space=None,
) -> Optional[Union[IterativeTransformation, LeafwiseTransformation]]
Return the inverse transformation.
Inverses that depend on the source space (e.g. RescaleTransformation)
are computed per leaf of source_space. When all leaves are equal a
single IterativeTransformation is returned, otherwise a
LeafwiseTransformation holding one inverse per leaf.
serialize
¶
serialize(
source_space: Optional[Space[Any, BDeviceType, BDtypeType, BRNGType]] = None,
) -> Dict[str, Any]
deserialize_from
classmethod
¶
deserialize_from(
json_data: Dict[str, Any],
source_space: Optional[Space[Any, BDeviceType, BDtypeType, BRNGType]] = None,
) -> IterativeTransformation