nvalchemi.training.distillation.AdmissionPolicy#

class nvalchemi.training.distillation.AdmissionPolicy(*args, **kwargs)[source]#

Decide which incoming frames enter a ReplayBuffer.

ReplayBuffer.extend() calls the policy on the frames a segment delivers, before the schema check. A frame the mask leaves out therefore never freezes or violates the schema. A policy is a predicate over the batch and may read any field the frames carry. For example, it can reject the NaN-labeled frames of a diverged trajectory, or filter frames on size or diversity.

Examples

>>> import torch
>>> def finite_labels(frames):
...     return torch.isfinite(frames.teacher_energy.view(-1))
>>> ReplayBuffer(admission=finite_labels)