tff.types.type_to_py_container

Recursively convert structure.Structs to Python containers.

This is in some sense the inverse operation to structure.from_container.

This function assumes some unique behavior with regards to tff.SequenceType. If the value is a list, it may yield other tff.StructTypes as well as Python types. Otherwise, it may only yield Python types.

value A structure of anonymous tuples of values corresponding to type_spec.
type_spec The tff.Type to which value should conform, possibly including computation_types.StructWithPythonType.

The input value, with containers converted to appropriate Python containers as specified by the type_spec.

ValueError If the conversion is not possible due to a mix of named and unnamed values, or if value contains names that are mismatched or not present in the corresponding index of type_spec.