code: def test_normality_conditional(device, levy_area_approximation):
      if device == gpu and not torch.cuda.is_available():
          pytest.skip(msg="CUDA not available.")
  
      t0, t1 = 0.0, 1.0
      for _ in range(REPS):
          bm = torchsde.BrownianInterval(
              t0=t0,
              t1=t1,
              size=(LARGE_BATCH_SIZE,),
              device=device,
              levy_area_approximation=levy_area_approximation,
          )
  
          for _ in range(MEDIUM_REPS):
              ta, t_, tb = sorted(
                  npr.uniform(low=t0, high=t1, size=(3,))
              )
  
              W = bm(ta, tb)
              W1 = bm(ta, t_)
              W2 = bm(t_, tb)
  
              mean_W1 = W * (t_ - ta) / (tb - ta)
              std_W1 = math.sqrt((tb - t_) * (t_ - ta) / (tb - ta))
              rescaled_W1 = (W1 - mean_W1) / std_W1
              _, pval = kstest(
                  rescaled_W1.cpu().detach().numpy(), "norm"
              )
              assert pval >= ALPHA
  
              mean_W2 = W * (tb - t_) / (tb - ta)
              std_W2 = math.sqrt((tb - t_) * (t_ - ta) / (tb - ta))
              rescaled_W2 = (W2 - mean_W2) / std_W2
              _, pval = kstest(
                  rescaled_W2.cpu().detach().numpy(), "norm"
              )
              assert pval >= ALPHA
  
              if levy_area_approximation != "none":
                  W, U = bm(ta, tb, return_U=True)
                  W1, U1 = bm(ta, t_, return_U=True)
                  W2, U2 = bm(t_, tb, return_U=True)
  
                  h = tb - ta
                  h1 = t_ - ta
                  h2 = tb - t_
  
                  denom = math.sqrt(h1**3 + h2**3)
                  a = h1**3.5 * h2**0.5 / (2 * h * denom)
                  b = h1**0.5 * h2**3.5 / (2 * h * denom)
                  c = math.sqrt(3) * h1**1.5 * h2**1.5 / (6 * denom)
  
                  H = _U_to_H(W, U, h)
                  H1 = _U_to_H(W1, U1, h1)
                  H2 = _U_to_H(W2, U2, h2)
  
                  mean_H1 = H * (h1 / h) ** 2
                  std_H1 = math.sqrt(a**2 + c**2) / h1
                  rescaled_H1 = (H1 - mean_H1) / std_H1
  
                  _, pval = kstest(
                      rescaled_H1.cpu().detach().numpy(), "norm"
                  )
                  assert pval >= ALPHA
  
                  mean_H2 = H * (h2 / h) ** 2
                  std_H2 = math.sqrt(b**2 + c**2) / h2
                  rescaled_H2 = (H2 - mean_H2) / std_H2
  
                  _, pval = kstest(
                      rescaled_H2.cpu().detach().numpy(), "norm"
                  )
                  assert pval >= ALPHA
  
file_path: torchsde/tests/test_brownian_interval.py
imports: import sys
  import math
  import numpy.random
  import torch
  from scipy.stats import kstest
  import pytest
  import torchsde
label_desc: Use image node_id 8 for calling a global function with example usage: test_normality_conditional(device, levy_area_approximation) without return types