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.
|