def assert_scalar_congruency(bijector,<EOL>lower_x,<EOL>upper_x,<EOL>eval_func,<EOL>n=int(<NUM_LIT>),<EOL>rtol=<NUM_LIT>):
<EOL>ten_x_pts = np.linspace(lower_x, upper_x, num=<NUM_LIT:10>).astype(np.float32)<EOL>if bijector.dtype is not None:<EOL><INDENT>ten_x_pts = ten_x_pts.astype(dtype_util.as_numpy_dtype(bijector.dtype))<EOL><DEDENT>forward_on_10_pts = bijector.forward(ten_x_pts)<EOL>lower_y, upper_y = eval_func(<EOL>[bijector.forward(lower_x),<EOL>bijector.forward(upper_x)])<EOL>if upper_y < lower_y:  <EOL><INDENT>lower_y, upper_y = upper_y, lower_y<EOL><DEDENT>uniform_x_samps = uniform_distribution.Uniform(<EOL>low=lower_x, high=upper_x).sample(<EOL>n, seed=<NUM_LIT:0>)<EOL>uniform_y_samps = uniform_distribution.Uniform(<EOL>low=lower_y, high=upper_y).sample(<EOL>n, seed=<NUM_LIT:1>)<EOL>inverse_forward_x = bijector.inverse(bijector.forward(uniform_x_samps))<EOL>forward_inverse_y = bijector.forward(bijector.inverse(uniform_y_samps))<EOL>dy_dx = tf.exp(<EOL>bijector.inverse_log_det_jacobian(uniform_y_samps, event_ndims=<NUM_LIT:0>))<EOL>expectation_of_dy_dx_under_uniform = tf.reduce_mean(input_tensor=dy_dx)<EOL>change_measure_dy_dx = (<EOL>(upper_y - lower_y) * expectation_of_dy_dx_under_uniform)<EOL>dx_dy = tf.exp(<EOL>bijector.forward_log_det_jacobian(<EOL>bijector.inverse(uniform_y_samps), event_ndims=<NUM_LIT:0>))<EOL>[<EOL>forward_on_10_pts_v,<EOL>dy_dx_v,<EOL>dx_dy_v,<EOL>change_measure_dy_dx_v,<EOL>uniform_x_samps_v,<EOL>uniform_y_samps_v,<EOL>inverse_forward_x_v,<EOL>forward_inverse_y_v,<EOL>] = eval_func([<EOL>forward_on_10_pts,<EOL>dy_dx,<EOL>dx_dy,<EOL>change_measure_dy_dx,<EOL>uniform_x_samps,<EOL>uniform_y_samps,<EOL>inverse_forward_x,<EOL>forward_inverse_y,<EOL>])<EOL>assert_strictly_monotonic(forward_on_10_pts_v)<EOL>np.testing.assert_allclose(<EOL>inverse_forward_x_v, uniform_x_samps_v, atol=<NUM_LIT>, rtol=<NUM_LIT>)<EOL>np.testing.assert_allclose(<EOL>forward_inverse_y_v, uniform_y_samps_v, atol=<NUM_LIT>, rtol=<NUM_LIT>)<EOL>np.testing.assert_allclose(<EOL>upper_x - lower_x, change_measure_dy_dx_v, atol=<NUM_LIT:0>, rtol=rtol)<EOL>np.testing.assert_allclose(<EOL>dy_dx_v, np.divide(<NUM_LIT:1.>, dx_dy_v), atol=<NUM_LIT>, rtol=<NUM_LIT>)<EOL>
Assert `bijector`'s forward/inverse/inverse_log_det_jacobian are congruent.

    We draw samples `X ~ U(lower_x, upper_x)`, then feed these through the
    `bijector` in order to check that:

    1. the forward is strictly monotonic.
    2. the forward/inverse methods are inverses of each other.
    3. the jacobian is the correct change of measure.

    This can only be used for a Bijector mapping open subsets of the real line
    to themselves.  This is due to the fact that this test compares the `prob`
    before/after transformation with the Lebesgue measure on the line.

    Args:
      bijector:  Instance of Bijector
      lower_x:  Python scalar.
      upper_x:  Python scalar.  Must have `lower_x < upper_x`, and both must be in
        the domain of the `bijector`.  The `bijector` should probably not produce
        huge variation in values in the interval `(lower_x, upper_x)`, or else the
        variance based check of the Jacobian will require small `rtol` or huge
        `n`.
      eval_func: Function to evaluate any intermediate results.
      n:  Number of samples to draw for the checks.
      rtol:  Positive number.  Used for the Jacobian check.

    Raises:
      AssertionError:  If tests fail.