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

Used in the notebooks

Used in the guide Used in the tutorials

Applies func(x[0], x[1], ...) where x[i] is an entry in structure[i]. All structures in structure must have the same arity, and the return value will contain results with the same structure layout.


  • A single Python dict:
a = {"hello": 24, "world": 76}
tf.nest.map_structure(lambda p: p * 2, a