nvalchemi.distributed.DensePadder#
- class nvalchemi.distributed.DensePadder(*, count_key, nbmat_key, row_pads, atom_output_keys=(), n_systems_key=None, cap_key='atoms', initial_factor=1.15, grow_factor=1.15, stride=16)[source]#
Built-in
GraphPadderfor dense(N, K)neighbor-matrix graphs.The dense counterpart of
COOPadder: the graph is an(N, K)neighbor matrix that rides the atom dimension (no separate edge dim). Pads the per-atom row fields to a fixed atom capacity and repoints the neighbor matrix’s padding sentinel to an isolated dead atom (the last row);unpadslices the dead rows off the per-atom outputs.Parametrized by the model’s field names:
count_key(field whose row count is the atom count),nbmat_key(the neighbor matrix),row_pads(per-atom field -> pad fill value; passLAST_SYSTEMto pad a per-system label with the last system’s index), andatom_output_keys(per-atom outputs that get dead rows stripped inunpad()).Layout assumption: the input’s last pre-pad row is the model’s own padding/sentinel atom, so the real atom count is
n_rows - 1and neighbor entries>= n_rows - 1are the sentinel — both get repointed to the dead row.- Parameters:
count_key (str)
nbmat_key (str)
row_pads (dict[str, Any])
atom_output_keys (tuple[str, ...])
n_systems_key (str | None)
cap_key (str)
initial_factor (float)
grow_factor (float)
stride (int)
- pad(data, cap_state, cap_atoms=True)[source]#
Resolve the atom cap from
cap_stateand pad the dense fields.datais the model’s plain-tensor input dict; returns a shallow copy with the row fields + neighbor matrix padded to the atom cap.- Parameters:
data (dict[str, Any])
cap_state (dict[str, int])
cap_atoms (bool)
- Return type:
dict[str, Any]