torch_blue.vi.utils

Contains various utility functions.

Exceptions

NoVariablesError

Raised by VIModules when an operation requires nonexistent variables.

UnsupportedDistributionError

Raised if a distribution is used in an unsupported way.

Classes

PostInitCallMeta

Metaclass calling __post_init__ after __init__.

Functions

use_norm_constants(→ None)

Set global flag _USE_NORM_CONSTANTS.

Package Contents

torch_blue.vi.utils.use_norm_constants(mode: bool = True) None[source]

Set global flag _USE_NORM_CONSTANTS.

This flag makes all distributions add normalization constants during log_prob calculation. These constants are mathematically accurate, but not needed and seemingly counterproductive for training, possibly due to float accuracy.

Parameters:

mode (bool, default: True) – Value to set the global flag to.