code: def _test_sdeint(
      sde, bm, method, adaptive, logqp, device, should_fail, options
  ):
      y0 = torch.ones(batch_size, d, device=device)
      ts = torch.linspace(t0, t1, steps=T, device=device)
      if (
          adaptive
          and method == "euler"
          and sde.noise_type != "additive"
      ):
          ctx = pytest.warns(UserWarning)
      else:
          ctx = _nullcontext()
  
      # Using `f` as drift.
      with torch.no_grad():
          try:
              with ctx:
                  ans = torchsde.sdeint(
                      sde,
                      y0,
                      ts,
                      bm,
                      method=method,
                      dt=dt,
                      adaptive=adaptive,
                      logqp=logqp,
                      options=options,
                  )
          except ValueError:
              if should_fail:
                  return
              raise
          else:
              if should_fail:
                  pytest.fail("Expected an error; did not get one.")
      if logqp:
          ans, log_ratio = ans
          assert log_ratio.shape == (T - 1, batch_size)
      assert ans.shape == (T, batch_size, d)
  
      # Using `h` as drift.
      with torch.no_grad():
          with ctx:
              ans = torchsde.sdeint(
                  sde,
                  y0,
                  ts,
                  bm,
                  method=method,
                  dt=dt,
                  adaptive=adaptive,
                  names={"drift": "h"},
                  logqp=logqp,
                  options=options,
              )
      if logqp:
          ans, log_ratio = ans
          assert log_ratio.shape == (T - 1, batch_size)
      assert ans.shape == (T, batch_size, d)
  
file_path: torchsde/tests/test_sdeint.py
imports: import sys
  import pytest
  import torch
  import torchsde
  from torchsde.settings import NOISE_TYPES
  from .None import problems
label_desc: Use image node_id 7 for calling a global function with example usage: _test_sdeint(sde, bm, method, adaptive, logqp, device, should_fail, options) without return types