tf_agents.utils.nest_utils.batch_nested_tensors
Stay organized with collections
Save and categorize content based on your preferences.
Add batch dimension if needed to nested tensors while checking their specs.
tf_agents.utils.nest_utils.batch_nested_tensors(
tensors, specs=None
)
If specs is None, a batch dimension is added to each tensor.
If specs are provided, each tensor is compared to the corresponding spec,
and a batch dimension is added only if the tensor doesn't already have it.
For each tensor, it checks the dimensions with respect to specs, and adds an
extra batch dimension if it doesn't already have it.
Args |
tensors
|
Nested list/tuple or dict of Tensors.
|
specs
|
Nested list/tuple or dict of TensorSpecs, describing the shape of the
non-batched Tensors.
|
Returns |
A nested batched version of each tensor.
|
Raises |
ValueError
|
if the tensors and specs have incompatible dimensions or shapes.
|
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."],[],[]]