nvalchemi.training.distillation.scorer_fields#

nvalchemi.training.distillation.scorer_fields(scorer)[source]#

Return the batch fields scorer populates, or None when they cannot be known.

A label_fields declaration is taken at its word; otherwise a scorer whose signals are all built in gets signal_fields() of them, companion fields included; otherwise the fields are unknown, since a custom signal may map onto any field.

None is not (): a scorer that labels nothing declares (), while an undeclared scorer with a custom signal resolves to None, which a consumer must treat as unknown rather than as nothing to check.

Parameters:

scorer (TeacherScorer) – Scorer to resolve the fields of.

Returns:

Batch field names the scorer writes, or None when they cannot be determined without scoring a batch.

Return type:

tuple[str, …] | None

Raises:

TypeError – If scorer declares label_fields as a string, which would otherwise resolve to its characters.