Summary
Introduce two base APIs:
class Space(...):
def is_subset(self, other: "Space") -> bool:
...
def clip(self, x: Any) -> Any:
...
Goal: make subspace relationships explicit and allow projecting data from a superset space into a subset space in a uniform way.
Motivation
We already rely on contains for validation, but we lack:
- a way to reason about relationships between spaces (
subset)
- a way to project data across compatible spaces (
clip)
BoxSpace.clip already exists, but this concept should be generalized across all spaces (especially DictSpace / TupleSpace) for wrappers, dataset adapters, and action/observation projection.
Proposed semantics
Core contract:
If target.is_subset(source) is True, then any $x \in \text{source}$ should be projectable via
target.clip(x) such that target.contains(output).
Ownership: clip is defined on the target (subset) space.
Summary
Introduce two base APIs:
Goal: make subspace relationships explicit and allow projecting data from a superset space into a subset space in a uniform way.
Motivation
We already rely on
containsfor validation, but we lack:subset)clip)BoxSpace.clipalready exists, but this concept should be generalized across all spaces (especiallyDictSpace/TupleSpace) for wrappers, dataset adapters, and action/observation projection.Proposed semantics
Core contract:
Ownership: clip is defined on the target (subset) space.