Follow-up to #5738.
PR #5738 applied per-frame, mask-aware loss normalization (excluding type<0 ghost padding atoms in mixed_type batches) to five shared loss types — ener, ener_spin, dos, tensor, property — across the dpmodel and pt backends. The pt-only losses dens, population, and denoise were out of scope and were not audited or fixed.
Scope: audit deepmd/pt/loss/{dens,population,denoise}.py for the same mixed_type padding artifact (denominators / means diluted by ghost atoms), apply the per-frame masked normalization where needed under the existing model_dict["mask"] convention, and add grad-accumulation-invariant + all-ones-mask no-op tests mirroring source/tests/pt/test_loss_padding.py. If a given loss is already frame-decomposable, document that instead.
Follow-up to #5738.
PR #5738 applied per-frame, mask-aware loss normalization (excluding
type<0ghost padding atoms inmixed_typebatches) to five shared loss types —ener,ener_spin,dos,tensor,property— across the dpmodel and pt backends. The pt-only lossesdens,population, anddenoisewere out of scope and were not audited or fixed.Scope: audit
deepmd/pt/loss/{dens,population,denoise}.pyfor the same mixed_type padding artifact (denominators / means diluted by ghost atoms), apply the per-frame masked normalization where needed under the existingmodel_dict["mask"]convention, and add grad-accumulation-invariant + all-ones-mask no-op tests mirroringsource/tests/pt/test_loss_padding.py. If a given loss is already frame-decomposable, document that instead.