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

tfl.pwl_calibration_lib.assert_constraints

View source on GitHub

Asserts that 'outputs' satisfiy constraints.

tfl.pwl_calibration_lib.assert_constraints(
    outputs, monotonicity, output_min, output_max, clamp_min=False, clamp_max=False,
    debug_tensors=None, eps=1e-06
)

Args:

  • outputs: Tensor of shape (num_output_values, units) which represents outputs of pwl calibration layer which will be tested against the given constraints. If monotonicity is specified these outputs must be for consequtive inputs.
  • monotonicity: One of {-1, 0, 1}. -1 for decreasing, 1 for increasing 0 means no monotonicity checks.
  • output_min: Lower bound or None.
  • output_max: Upper bound or None.
  • clamp_min: Whether one of outputs must match output_min.
  • clamp_max: Whther one of outputs must match output_max.
  • debug_tensors: None or list of anything convertible to tensor (for example tensors or strings) which will be printed in case of constraints violation.
  • eps: Allowed constraints violation.

Raises:

  • ValueError: If monotonicity is not one of {-1, 0, 1}

Returns:

List of assertion ops in graph mode or immideately asserts in eager mode.