code: def two_sample_Kolmogorov_Smirnov_test(observed1, observed2):
      """Computes the Kolmogorov-Smirnov statistic on 2 samples
  
      Unlike `scipy.stats.ks_2samp`, the returned p-value is not accurate
      for large p.
      """
      assert observed1.dtype == observed2.dtype
      (n1,) = observed1.shape
      (n2,) = observed2.shape
      assert n1 >= 100 and n2 >= 100
      observed = numpy.concatenate([observed1, observed2])
      indices = numpy.argsort(observed)
      observed = observed[indices]  # sort
      ds = numpy.cumsum(
          numpy.where(indices < n1, -n2, n1).astype(numpy.int64)
      )
      assert ds[-1] == 0
      check = numpy.concatenate([observed[:-1] < observed[1:], [True]])
      ds = ds[check]
      d_plus = float(ds.max()) / (n1 * n2)
      d_minus = -float(ds.min()) / (n1 * n2)
      d = max(d_plus, d_minus)
      # Approximate p = special.kolmogorov(d * numpy.sqrt(n1 * n2 / (n1 + n2)))
      p = min(1.0, 2.0 * numpy.exp(-2.0 * d**2 * n1 * n2 / (n1 + n2)))
      return d_plus, d_minus, p
  
imports: import functools
  import unittest
  import numpy
  import cupy
  from cupy import testing
  from cupy.testing import _condition
label_desc: Use image node_id 1 for calling a global function with example usage: two_sample_Kolmogorov_Smirnov_test(observed1, observed2) and returns: d_plus,  d_minus,  p