code: def assert_true_cdf_equal_by_dkwm_two_sample(
      samples1, samples2, false_fail_rate=1e-6, name=None
  ):
      """Asserts the full CDFs of the two given distributions are equal.
  
      More precisely, fails if there is enough evidence (using the
      [Dvoretzky-Kiefer-Wolfowitz-Massart inequality]
      (https://en.wikipedia.org/wiki/CDF-based_nonparametric_confidence_interval))
      that the true CDF of the distribution from which `samples1` are drawn is _not_
      the true CDF of the distribution from which `samples2` are drawn, with
      statistical significance `false_fail_rate` or stronger, otherwise passes.  If
      you also want to check that you are gathering enough evidence that a pass is
      not spurious, see `min_num_samples_for_dkwm_cdf_two_sample_test` and
      `min_discrepancy_of_true_cdfs_detectable_by_dkwm_two_sample`.
  
      This test works as written even if the distribution in question has atoms
      (e.g., is discrete).
  
      Note that `false_fail_rate` is a total false failure rate for all
      the assertions in the batch.  As such, if the batch is nontrivial,
      the assertion will insist on stronger evidence to fail any one member.
  
      Args:
        samples1: Tensor of shape [n] + B.  Samples from some (batch of)
          scalar-event distribution(s) of interest, giving a (batch of) empirical
          CDF(s).  Assumed IID across the 0 dimension.
        samples2: Tensor of shape [m] + B.  Samples from some (batch of)
          scalar-event distribution(s) of interest, giving a (batch of) empirical
          CDF(s).  Assumed IID across the 0 dimension.
        false_fail_rate: *Scalar* floating-point `Tensor` admissible total
          rate of mistakes.
        name: A name for this operation (optional).
  
      Returns:
        check: Op that raises `InvalidArgumentError` if any expected CDF is
          outside the corresponding confidence envelope.
      """
      with tf.name_scope(
          name or "assert_true_cdf_equal_by_dkwm_two_sample"
      ):
          dtype = dtype_util.common_dtype(
              [samples1, samples2, false_fail_rate], tf.float32
          )
          samples1 = tf.convert_to_tensor(
              value=samples1, name="samples1", dtype=dtype
          )
          samples2 = tf.convert_to_tensor(
              value=samples2, name="samples2", dtype=dtype
          )
          false_fail_rate = tf.convert_to_tensor(
              value=false_fail_rate, name="false_fail_rate", dtype=dtype
          )
          tf.debugging.assert_scalar(false_fail_rate)  # Static shape
          compatible_samples = tf.debugging.assert_equal(
              tf.shape(samples1)[1:], tf.shape(samples2)[1:]
          )
          with tf.control_dependencies([compatible_samples]):
              itemwise_false_fail_rate = _itemwise_error_rate(
                  total_rate=false_fail_rate,
                  param_tensors=[],
                  samples_tensor=samples1,
              )
              n1 = tf.shape(samples1)[0]
              envelope1 = _dkwm_cdf_envelope(
                  n1, itemwise_false_fail_rate
              )
              n2 = tf.shape(samples2)[0]
              envelope2 = _dkwm_cdf_envelope(
                  n2, itemwise_false_fail_rate
              )
              distance = kolmogorov_smirnov_distance_two_sample(
                  samples1, samples2
              )
              return tf.debugging.assert_less_equal(
                  distance,
                  envelope1 + envelope2,
                  message="Empirical CDFs outside joint K-S envelope",
              )
  
imports: import functools
  import itertools
  import tensorflow.compat.v2
  from tensorflow_probability.python.internal import distribution_util
  from tensorflow_probability.python.internal import dtype_util
  from tensorflow_probability.python.internal import prefer_static
  from tensorflow_probability.python.internal import tensorshape_util
  from tensorflow_probability.python.util.seed_stream import SeedStream
label_desc: Use image node_id 10 for calling a global function with example usage: assert_true_cdf_equal_by_dkwm_two_sample(samples1, samples2, false_fail_rate, name) and returns: tf