deepmd.utils.model_stat#

Attributes#

Functions#

_make_all_stat_ref(→ dict[str, list[Any]])

collect_batches(→ dict[str, list[Any]])

Collect batches from a DeepmdDataSystem into a dict of lists.

make_stat_input(→ list[dict[str, numpy.ndarray]])

Pack data for statistics using DeepmdDataSystem.

merge_sys_stat(→ dict[str, list[Any]])

Module Contents#

deepmd.utils.model_stat.log[source]#
deepmd.utils.model_stat._make_all_stat_ref(data: Any, nbatches: int) dict[str, list[Any]][source]#
deepmd.utils.model_stat.collect_batches(data: Any, nbatches: int, merge_sys: bool = True) dict[str, list[Any]][source]#

Collect batches from a DeepmdDataSystem into a dict of lists.

This is a low-level helper used by the TF backend and by make_stat_input().

Parameters:
data

The data (must support get_nsystems() and get_batch(sys_idx=))

nbatchesint

The number of batches per system

merge_sysbool (True)

Merge system data

Returns:
all_stat:

A dictionary of list of list storing data for stat. if merge_sys == False data can be accessed by

all_stat[key][sys_idx][batch_idx][frame_idx]

else merge_sys == True can be accessed by

all_stat[key][batch_idx][frame_idx]

deepmd.utils.model_stat.make_stat_input(data: Any, nbatches: int) list[dict[str, numpy.ndarray]][source]#

Pack data for statistics using DeepmdDataSystem.

Collects nbatches batches from each system and concatenates them into a single dict per system. The returned format (list[dict[str, np.ndarray]]) is backend-agnostic and can be consumed by compute_or_load_stat in dpmodel, pt_expt, and jax.

Parameters:
data

The multi-system data manager (must support get_nsystems() and get_batch(sys_idx=)).

nbatchesint

Number of batches to collect per system.

Returns:
list[dict[str, np.ndarray]]

Per-system dicts with concatenated numpy arrays.

deepmd.utils.model_stat.merge_sys_stat(all_stat: dict[str, list[Any]]) dict[str, list[Any]][source]#