tff.types.structure_from_tensor_type_tree
Stay organized with collections
Save and categorize content based on your preferences.
Constructs a structure from a type_spec
tree of tff.TensorType
s.
tff.types.structure_from_tensor_type_tree(
fn: Callable[[tff.types.TensorType
], object],
type_spec
) -> object
Args |
fn
|
A callable used to generate the elements with which to fill the
resulting structure. fn will be called exactly once per leaf
tff.TensorType in the order they appear in the type_spec structure.
|
type_spec
|
A TFF type or value convertible to TFF type. Once converted,
type_spec must be a tff.TensorType or tff.StructType containing only
other tff.TensorType s and tff.StructType s.
|
Returns |
A structure with the same shape and Python containers as type_spec but
with the tff.TensorType elements replaced with the results of fn .
|
Raises |
ValueError
|
if the provided type_spec is not a structural or tensor type.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-08-23 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]
{"lastModified": "Last updated 2024-08-23 UTC."}