consolidate_spec¶
- class torchrl.data.consolidate_spec(spec: CompositeSpec, recurse_through_entries: bool = True, recurse_through_stack: bool = True)[source]¶
Given a TensorSpec, removes exclusive keys by adding 0 shaped specs.
- Parameters:
spec (CompositeSpec) – 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.