tf_agents.utils.nest_utils.get_outer_rank
Stay organized with collections
Save and categorize content based on your preferences.
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]