handle_layers

Contents

handle_layers#

penzai.treescope.handlers.penzai.layer_handler.handle_layers(node: Any, path: tuple[Any, ...] | None, subtree_renderer: renderer.TreescopeSubtreeRenderer, obvious_input_output_structure_types: tuple[type[Any], ...] = (<class 'penzai.nn.grouping.CheckStructure'>, <class 'penzai.nn.grouping.CheckedSequential'>)) -> part_interface.RenderableTreePart | part_interface.RenderableAndLineAnnotations | type(NotImplemented)[source]#

Renders a penzai layer.

Layers render like Structs in general. However:

  • The outermost layer is augmented with information about the set of free effects in the layer.

  • The outermost layer with a nontrivial input/output structure shows that structure.

Parameters:
  • node – The node to render.

  • path – Optionally, a path to this node.

  • subtree_renderer – A recursive renderer for subtrees of this node.

  • obvious_input_output_structure_types – Types where the input and output structure are obvious from the type’s ordinary pretty-printed output.

Returns:

A rendering, or NotImplemented.