Skip to main content

core.HasTargetCheck

core.HasTargetCheck()

Checks a batch’s targets before the fit uses them, e.g. values outside the support.

The fit calls it eagerly on each batch with targets, before the curvature’s update. It runs under a torch.func transform over the parameters (grad), where the targets are plain tensors, and is skipped when a target leaf is transformed (vmap over batches).

Methods

Name Description
check_targets Check the targets of one batch.

check_targets

core.HasTargetCheck.check_targets(y, /)

Check the targets of one batch.

It reads only y: under a transform over the likelihood’s own fields those fields are wrapped.

Parameters

Name Type Description Default
y Targets The batch’s targets. required

Raises

Name Type Description
ValueError A target value is invalid, e.g. outside the support.
StructureError The targets are badly shaped.