code: def test_sdeint_run_shape_method(
      sde_cls,
      use_bm,
      levy_area_approximation,
      sde_type,
      method,
      adaptive,
      logqp,
      device,
  ):
      """Tests that sdeint:
      (a) runs/raises an error as appropriate
      (b) produces tensors of the right shape
      (c) accepts every method
      """
  
      if method == "milstein_grad_free":
          method = "milstein"
          options = dict(grad_free=True)
      else:
          options = dict()
  
      should_fail = False
      if sde_type == "ito":
          if method not in ("euler", "srk", "milstein"):
              should_fail = True
      else:
          if method not in (
              "euler_heun",
              "heun",
              "midpoint",
              "log_ode",
              "milstein",
          ):
              should_fail = True
      if (
          method in ("milstein", "srk")
          and sde_cls.noise_type == "general"
      ):
          should_fail = True
      if method == "srk" and levy_area_approximation == "none":
          should_fail = True
      if method == "log_ode" and levy_area_approximation in (
          "none",
          "space-time",
      ):
          should_fail = True
  
      if sde_cls.noise_type in (
          NOISE_TYPES.scalar,
          NOISE_TYPES.diagonal,
      ):
          kwargs = {"d": d}
      else:
          kwargs = {"d": d, "m": m}
      sde = sde_cls(sde_type=sde_type, **kwargs).to(device)
  
      if use_bm:
          if sde_cls.noise_type == "scalar":
              size = (batch_size, 1)
          elif sde_cls.noise_type == "diagonal":
              size = (batch_size, d + 1) if logqp else (batch_size, d)
          else:
              assert sde_cls.noise_type in ("additive", "general")
              size = (batch_size, m)
          bm = torchsde.BrownianInterval(
              t0=t0,
              t1=t1,
              size=size,
              dtype=dtype,
              device=device,
              levy_area_approximation=levy_area_approximation,
          )
      else:
          bm = None
  
      _test_sdeint(
          sde, bm, method, adaptive, logqp, device, should_fail, options
      )
  
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 5 for calling a global function with example usage: test_sdeint_run_shape_method(sde_cls, use_bm, levy_area_approximation, sde_type, method, adaptive, logqp, device) without return types