Missed TensorFlow Dev Summit? Check out the video playlist. Watch recordings

tfl.linear_lib.verify_hyperparameters

View source on GitHub

Verifies that all given hyperparameters are consistent.

tfl.linear_lib.verify_hyperparameters(
    num_input_dims=None, monotonicities=None, monotonic_dominances=None,
    range_dominances=None, input_min=None, input_max=None, weights_shape=None
)

This function does not inspect weights themselves. Only their shape. Use assert_constraints() to assert actual weights against constraints.

Unlike linear layer itself this function requires monotonicites to be specified via list or tuple rather than via single element because that's how monotonicites are stored internaly.

See tfl.layers.Linear Layer class level comment for detailed description of arguments.

Args:

  • num_input_dims: None or number of input dimensions.
  • monotonicities: List or tuple of same length as number of elements in weights of {-1, 0, 1} which represent monotonicity constraints per dimension. -1 stands for decreasing, 0 for no constraints, 1 for increasing.
  • monotonic_dominances: List of two-element tuples. First element is the index of the dominant feature. Second element is the index of the weak feature.
  • range_dominances: List of two-element tuples. First element is the index of the dominant feature. Second element is the index of the weak feature.
  • input_min: List or tuple of length same length as number of elements in 'weights' of either None or float which specifies the minimum value to clip by.
  • input_max: List or tuple of length same length as number of elements in 'weights' of either None or float which specifies the maximum value to clip by.
  • weights_shape: None or shape of tensor which represents weights of Linear layer.

Raises:

  • ValueError: If something is inconsistent.