tff.structure.map_structure

Applies fn to each entry in structure and returns a new structure.

This is a special implementation of tf.nest.map_structure that works for Struct.

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.

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

TypeError if fn is not a callable, or *structure is not all Struct or all tf.Tensor typed values.
ValueError if *structure is empty.