testing.check_link
testing.check_link(link, likelihood, outputs)Check a link approximation against the core contracts.
- It satisfies
LinkApprox, andsupportsreturns a bool. - It is called with a
generatorkeyword, asLinearizedcalls it. supportsagrees with applying it: when False, the call raisesCapabilityErrororStructureError; when True, it raises neither.- It returns a
Distribution. A torchCategoricalhas finite, non-negative probabilities summing to 1 over the classes (up toRTOL); any other distribution has a finite mean and a finite, non-negative variance.
When supports returns True, errors other than CapabilityError and StructureError from applying the link propagate.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| link | LinkApprox | The link approximation. | required |
| likelihood | Likelihood | The likelihood to apply it with. | required |
| outputs | OutputGaussian | The Gaussian over the outputs. supports sees its mean. |
required |
Raises
| Name | Type | Description |
|---|---|---|
| AssertionError | A law above fails, including a call that raises another error after supports returned False. The message names the law and link. |