Recursively convert structure.Struct
s to Python containers.
tff.types.type_to_py_container(
value,
type_spec: tff.types.Type
)
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.
Args |
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 .
|
Returns |
The input value, with containers converted to appropriate Python
containers as specified by the type_spec .
|
Raises |
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 .
|