tf.contrib.framework.nest.get_traverse_shallow_structure
Stay organized with collections
Save and categorize content based on your preferences.
Generates a shallow structure from a traverse_fn
and structure
.
tf.contrib.framework.nest.get_traverse_shallow_structure(
traverse_fn, structure, expand_composites=False
)
traverse_fn
must accept any possible subtree of structure
and return
a depth=1 structure containing True
or False
values, describing which
of the top-level subtrees may be traversed. It may also
return scalar True
or False
"traversal is OK / not OK for all subtrees."
Examples are available in the unit tests (nest_test.py).
Args |
traverse_fn
|
Function taking a substructure and returning either a scalar
bool (whether to traverse that substructure or not) or a depth=1
shallow structure of the same type, describing which parts of the
substructure to traverse.
|
structure
|
The structure to traverse.
|
expand_composites
|
If true, then composite tensors such as tf.SparseTensor
and tf.RaggedTensor are expanded into their component tensors.
|
Returns |
A shallow structure containing python bools, which can be passed to
map_structure_up_to and flatten_up_to .
|
Raises |
TypeError
|
if traverse_fn returns a sequence for a non-sequence input,
or a structure with depth higher than 1 for a sequence input,
or if any leaf values in the returned structure or scalar are not type
bool .
|
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 2020-10-01 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 2020-10-01 UTC."],[],[]]