tff.structure.map_structure
Stay organized with collections
Save and categorize content based on your preferences.
Applies fn
to each entry in structure
and returns a new structure.
tff.structure.map_structure(
fn: Callable[..., object], *structures
) -> object
This is a special implementation of tf.nest.map_structure
that works for Struct
.
Args |
fn
|
a callable that accepts as many arguments as there are structures.
|
*structures
|
a scalar, tuple, or list of constructed scalars and/or
tuples/lists, or scalars. Note: numpy arrays are considered scalars.
|
Returns |
A new structure with the same arity as structure and same type as
structure[0] , whose values correspond to fn(x[0], x[1], ...) where
x[i] is a value in the corresponding location in structure[i] .
|
Raises |
TypeError
|
if fn is not a callable, or *structure is not all Struct or
all tf.Tensor typed values.
|
ValueError
|
if *structure is empty.
|
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-09-20 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-09-20 UTC."],[],[]]