1 utils.console.summary

utils.console.summary

Compact tensor summaries and rendering-neutral diagnostic products.

This module owns both the structured summary dictionaries used by model and dataset diagnostics and their optional Rich rendering. It inspects EFM3D tensor wrappers without mutating or moving their underlying tensors; callers retain device and lifetime ownership.

1.1 Classes

Name Description
SummaryRow One flattened inspection value consumable by CLI or Streamlit.

1.1.1 SummaryRow

utils.console.summary.SummaryRow(path, value, kind)

One flattened inspection value consumable by CLI or Streamlit.

1.2 Functions

Name Description
build_nested Expand EFM #/+ flat keys into a diagnostic-only nested mapping.
capture_tree Render a Rich tree as ANSI-free plain text for logs and web UIs.
rich_summary Build and return a rich Tree from a flattened sample dict.
summarize Describe tensor-like values without copying their payloads.
summarize_shape Render tensor shape, dtype, and device as one compact status string.
summary_markdown Render the shared summary rows as compact Markdown for text UIs.
summary_rows Flatten a structured summary into deterministic, rendering-neutral rows.

1.2.1 build_nested

utils.console.summary.build_nested(
    flat_sample,
    show_semidense=True,
    show_gt=True,
)

Expand EFM #/+ flat keys into a diagnostic-only nested mapping.

Returns both the nested values and a reverse path map to the original flat keys. Optional filters hide semi-dense or oracle GT branches from display; they do not alter the source sample.

1.2.2 capture_tree

utils.console.summary.capture_tree(tree)

Render a Rich tree as ANSI-free plain text for logs and web UIs.

1.2.3 rich_summary

utils.console.summary.rich_summary(
    tree_dict,
    *,
    path_map=None,
    with_shape=True,
    show_only_sample=None,
    root_label='',
    is_print=True,
)

Build and return a rich Tree from a flattened sample dict.

  • One line per entry; tensors show shape/dtype, optional stats line when with_shape is True (single-element tensors show value).
  • Lists show length/element type (+ first/last for primitive elements).
  • Dicts are traversed recursively; keys listed in show_only_sample are truncated to first/last items.
  • The original flat key is appended to the node label when available.

1.2.4 summarize

utils.console.summary.summarize(val, *, include_stats=False)

Describe tensor-like values without copying their payloads.

Tensor wrappers are reduced to shape, dtype, and device metadata. Floating statistics are computed over finite elements only when include_stats is true; lists are represented by length and all other values pass through.

1.2.5 summarize_shape

utils.console.summary.summarize_shape(value)

Render tensor shape, dtype, and device as one compact status string.

1.2.6 summary_markdown

utils.console.summary.summary_markdown(summary)

Render the shared summary rows as compact Markdown for text UIs.

1.2.7 summary_rows

utils.console.summary.summary_rows(summary)

Flatten a structured summary into deterministic, rendering-neutral rows.

The function accepts the existing summary dictionaries without acquiring or copying their source tensors. Rich, Streamlit, and export adapters can render the same rows while retaining the original field path and value kind.

Back to top