core.as_pytree
core.as_pytree(tree)Turn each mapping that torch’s pytree would treat as a leaf into a plain dict.
This works at any depth, so vmap and tree_map see the mapping’s tensors.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| tree | Any | The tree. | required |
Returns
| Name | Type | Description |
|---|---|---|
| Any | The converted tree. A tree without such a mapping comes back as it is. |