tfl.utils.canonicalize_monotonicities

Converts string constants representing monotonicities into integers.

monotonicities monotonicities hyperparameter of a tfl.layers Layer (e.g. tfl.layers.Lattice).
allow_decreasing If decreasing monotonicity is considered a valid monotonicity.

A list of monotonicities represented as -1, 0, 1, or the value None if monotonicities is None.

ValueError If one of monotonicities is not in the set {-1, 0, 1, 'decreasing', 'none', 'increasing'} and allow_decreasing is True.
ValueError If one of monotonicities is not in the set {0, 1, 'none', 'increasing'} and allow_decreasing is False.