|View source on GitHub|
Compares tensors to specs to determine the number of batch dimensions.
tf_agents.utils.nest_utils.get_outer_rank( tensors, specs )
Used in the notebooks
|Used in the tutorials|
For each tensor, it checks the dimensions with respect to specs and returns the number of batch dimensions if all nested tensors and specs agree with each other.
tensors: Nested list/tuple/dict of Tensors or SparseTensors.
specs: Nested list/tuple/dict of TensorSpecs, describing the shape of unbatched tensors.
The number of outer dimensions for all Tensors (zero if all are unbatched or empty).
- Any of the tensors or specs have shapes with ndims == None, or
- The shape of Tensors are not compatible with specs, or
- A mix of batched and unbatched tensors are provided.
- The tensors are batched but have an incorrect number of outer dims.