Module: oryx.core.interpreters.inverse.custom_inverse

Contains logic for defining custom inverses for functions.

Automatic inversion works for only a certain class of functions (see core.inverse documentation for more details). For example, an autoregressive neural network will likely use masked weight matrices in order to be invertible but the automatic inversion is not aware of autoregressive masked matrices (yet!). Furthermore, we may want more numerically stable inverses for functions like softmax or sigmoid.

This module provides a custom_inverse decorator for Python functions that enables overriding the default programmatic inversion. See custom_inverse for further documentation.

Classes

class NonInvertibleError: Raised by a custom inverse definition when values are unknown.

Functions

custom_inverse(...): Decorates a function to enable defining a custom inverse.