as_array_structure#
- penzai.core.shapecheck.as_array_structure(tree: Any) StructureAnnotation[source]#
Abstracts a concrete tree of values into a tree of
ArraySpecnodes.- Parameters:
tree – The tree to get an array structure for.
- Returns:
A copy of
treewhere each arraylike orNamedArraysubtree is replaced by anArraySpec, and each other leaf is replaced byANY.