consolidate_spec¶
- class torchrl.data.consolidate_spec(spec: Composite, recurse_through_entries: bool = True, recurse_through_stack: bool = True)[source]¶
Given a TensorSpec, removes exclusive keys by adding 0 shaped specs.
- Parameters:
spec (Composite) – the spec to be consolidated.
recurse_through_entries (bool) – if True, call the function recursively on all entries of the spec. Default is True.
recurse_through_stack (bool) – if True, if the provided spec is lazy, the function recursively on all specs in its list. Default is True.