code: def _soft_dtw(D, R, gamma, be=None):
      """Compute soft dynamic time warping.
  
      Parameters
      ----------
      D : array-like, shape=(m, n), dtype=float64
      R : array-like, shape=(m+2, n+2), dtype=float64
      gamma : float64
          Regularization parameter.
      be : Backend object or string or None
          Backend. If `be` is an instance of the class `NumPyBackend` or the string `"numpy"`,
          the NumPy backend is used.
          If `be` is an instance of the class `PyTorchBackend` or the string `"pytorch"`,
          the PyTorch backend is used.
          If `be` is `None`, the backend is determined by the input arrays.
          See our :ref:`dedicated user-guide page <backend>` for more information.
      """
      be = instantiate_backend(be, D, R, gamma)
  
      m, n = be.shape(D)
  
      # Initialization.
      R[: m + 1, 0] = be.dbl_max
      R[0, : n + 1] = be.dbl_max
      R[0, 0] = 0
  
      # DP recursion.
      for i in range(1, m + 1):
          for j in range(1, n + 1):
              # D is indexed starting from 0.
              R[i, j] = D[i - 1, j - 1] + _softmin3(
                  be.copy(R[i - 1, j]),
                  be.copy(R[i - 1, j - 1]),
                  be.copy(R[i, j - 1]),
                  gamma,
                  be=be,
              )
  
file_path: tslearn/tslearn/metrics/soft_dtw_fast.py
imports: import numpy
  from numba import njit, prange
  from tslearn.backend.backend import instantiate_backend
label_desc: Use image node_id 4 for calling a global function with example usage: _soft_dtw(D, R, gamma, be) without return types