tf.contrib.framework.nest.map_structure_with_tuple_paths
Stay organized with collections
Save and categorize content based on your preferences.
Applies func
to each entry in structure
and returns a new structure.
tf.contrib.framework.nest.map_structure_with_tuple_paths(
func, *structure, **kwargs
)
Applies func(tuple_path, x[0], x[1], ..., **kwargs)
where x[i]
is an entry
in structure[i]
and tuple_path
is a tuple of indices and/or dictionary
keys (as returned by nest.yield_flat_paths
), which uniquely specifies the
common path to x[i] in the structures. All structures in structure
must have
the same arity, and the return value will contain the results in the same
structure. Special kwarg check_types
determines whether the types of
iterables within the structure must be the same-- see **kwargs definition
below.
Args |
func
|
A callable with the signature func(tuple_path, *values, **kwargs)
that is evaluated on the leaves of the structure.
|
*structure
|
A variable number of compatible structures to process.
|
**kwargs
|
Optional kwargs to be passed through to func. Special kwarg
check_types is not passed to func, but instead determines whether the
types of iterables within the structures have to be same (e.g.
map_structure(func, [1], (1,)) raises a TypeError exception). To allow
this set this argument to False .
|
Returns |
A structure of the same form as the input structures whose leaves are the
result of evaluating func on corresponding leaves of the input structures.
|
Raises |
TypeError
|
If func is not callable or if the structures do not match
each other by depth tree.
|
TypeError
|
If check_types is not False and the two structures differ in
the type of sequence in any of their substructures.
|
ValueError
|
If no structures are provided.
|
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."],[],[]]