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