code: def _modified_bessel_i(n: int, x: torch.Tensor) -> torch.Tensor:
      if n < 2:
          raise ValueError(f"n must be greater than 1, got n={n}.")
      x = torch.as_tensor(
          x,
          dtype=torch.float,
          device=x.device if isinstance(x, torch.Tensor) else None,
      )
      if x == 0.0:
          return x
      device = x.device
      tox = 2.0 / torch.abs(x)
      ans, bip, bi = (
          torch.tensor(0.0, device=device),
          torch.tensor(0.0, device=device),
          torch.tensor(1.0, device=device),
      )
      m = int(2 * (n + np.floor(np.sqrt(40.0 * n))))
      for j in range(m, 0, -1):
          bim = bip + float(j) * tox * bi
          bip = bi
          bi = bim
          if abs(bi) > 1.0e10:
              ans = ans * 1.0e-10
              bi = bi * 1.0e-10
              bip = bip * 1.0e-10
          if j == n:
              ans = bip
      ans = ans * _modified_bessel_0(x) / bi
      return -ans if x < 0.0 and (n % 2) == 1 else ans
  
file_path: MONAI/monai/networks/layers/convutils.py
imports: from __future__ import annotations
  from collections.abc import Sequence
  import numpy
  import torch
label_desc: Use image node_id 8 for calling a global function with example usage: _modified_bessel_i(n, x) and returns: unknown, x