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
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.
Args |
tensors
|
Nested list/tuple/dict of Tensors or SparseTensors.
|
specs
|
Nested list/tuple/dict of TensorSpecs, describing the shape of
unbatched tensors.
|
Returns |
The number of outer dimensions for all Tensors (zero if all are
unbatched or empty).
|
Raises |
ValueError
|
If
- 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.
|