code: def test_normality(device):
      if device == gpu and not torch.cuda.is_available():
          pytest.skip(msg="CUDA not available.")
  
      t0_, t1_ = 0.0, 1.0
      eps = 1e-2
      for _ in range(REPS):
          w0_ = npr.randn() * math.sqrt(t1_)
          w0 = torch.tensor(w0_, device=device).repeat(BATCH_SIZE)
  
          bm = torchsde.BrownianPath(t0=t0_, w0=w0)  # noqa
  
          w1_ = bm(t1_).cpu().numpy()
  
          t_ = npr.uniform(
              low=t0_ + eps, high=t1_ - eps
          )  # Avoid sampling too close to the boundary.
          samples_ = bm(t_).cpu().numpy()
  
          # True expected mean from Brownian bridge.
          mean_ = ((t1_ - t_) * w0_ + (t_ - t0_) * w1_) / (t1_ - t0_)
          std_ = math.sqrt((t1_ - t_) * (t_ - t0_) / (t1_ - t0_))
          ref_dist = norm(
              loc=np.zeros_like(mean_), scale=np.ones_like(std_)
          )
  
          _, pval = kstest((samples_ - mean_) / std_, ref_dist.cdf)
          assert pval >= ALPHA
  
file_path: torchsde/tests/test_brownian_path.py
imports: import sys
  import math
  import numpy
  import numpy.random
  import torch
  from scipy.stats import norm, kstest
  import torchsde
  import pytest
label_desc: Use image node_id 4 for calling a global function with example usage: test_normality(device) without return types