docstr: Soft Dynamic Time Warping.
  
  Parameters
  ----------
  D : array-like, shape=(m, n), dtype=float64 or class computing distances with a method 'compute'
      Distances. An example of class computing distance is 'SquaredEuclidean'.
  gamma: float
      Regularization parameter.
      Lower is less smoothed (closer to true DTW).
  be : Backend object or string or None
      Backend.
  compute_with_backend : bool, default=False
      This parameter has no influence when the NumPy backend is used.
      When a backend different from NumPy is used (cf parameter `be`):
      If `True`, the computation is done with the corresponding backend.
      If `False`, a conversion to the NumPy backend can be used to accelerate the computation.
  
  Attributes
  ----------
  self.R_: array-like, shape =(m + 2, n + 2)
      Accumulated cost matrix (stored after calling `compute`).
docstr_tok: ["Soft","Dynamic","Time","Warping",".","Parameters","--","--","--","--","--","D",":","array-like",",","shape=","(","m",",","n",")",",","dtype=float64","or","class","computing","distances","with","a","method","'compute'","Distances",".","An","example","of","class","computing","distance","is","'SquaredEuclidean","'",".","gamma",":","float","Regularization","parameter",".","Lower","is","less","smoothed","(","closer","to","true","DTW",")",".","be",":","Backend","object","or","string","or","None","Backend",".","compute_with_backend",":","bool",",","default=False","This","parameter","has","no","influence","when","the","NumPy","backend","is","used",".","When","a","backend","different","from","NumPy","is","used","(","cf","parameter","`","be","`",")",":","If","`","True","`",",","the","computation","is","done","with","the","corresponding","backend",".","If","`","False","`",",","a","conversion","to","the","NumPy","backend","can","be","used","to","accelerate","the","computation",".","Attributes","--","--","--","--","--","self.R_",":","array-like",",","shape","=","(","m","+","2",",","n","+","2",")","Accumulated","cost","matrix","(","stored","after","calling","`","compute","`",")","."]
code: def __init__(self, D, gamma=1.0, be=None, compute_with_backend=False):
      """Soft Dynamic Time Warping.
  
      Parameters
      ----------
      D : array-like, shape=(m, n), dtype=float64 or class computing distances with a method 'compute'
          Distances. An example of class computing distance is 'SquaredEuclidean'.
      gamma: float
          Regularization parameter.
          Lower is less smoothed (closer to true DTW).
      be : Backend object or string or None
          Backend.
      compute_with_backend : bool, default=False
          This parameter has no influence when the NumPy backend is used.
          When a backend different from NumPy is used (cf parameter `be`):
          If `True`, the computation is done with the corresponding backend.
          If `False`, a conversion to the NumPy backend can be used to accelerate the computation.
  
      Attributes
      ----------
      self.R_: array-like, shape =(m + 2, n + 2)
          Accumulated cost matrix (stored after calling `compute`).
      """
      be = instantiate_backend(be, D)
      self.be = be
      self.compute_with_backend = compute_with_backend
      if hasattr(D, "compute"):
          self.D = D.compute()
      else:
          self.D = D
      self.D = self.be.cast(self.D, dtype=self.be.float64)
  
      # Allocate memory.
      # We need +2 because we use indices starting from 1
      # and to deal with edge cases in the backward recursion.
      m, n = self.be.shape(self.D)
      self.R_ = self.be.zeros((m + 2, n + 2), dtype=self.be.float64)
      self.computed = False
  
      self.gamma = self.be.array(gamma, dtype=self.be.float64)
  
imports: import numpy
  from joblib import Parallel, delayed
  from numba import njit
  from sklearn.utils import check_random_state
  from tslearn.backend import instantiate_backend
  from tslearn.utils import check_equal_size, to_time_series, to_time_series_dataset, ts_size
  from .dtw_variants import dtw, dtw_path
  from .soft_dtw_fast import _jacobian_product_sq_euc, _njit_jacobian_product_sq_euc, _njit_soft_dtw, _njit_soft_dtw_grad, _soft_dtw, _soft_dtw_grad
  from .utils import _cdist_generic
label_desc: Use image node_id 1 to create a new SoftDTW object  with example: obj = SoftDTW(D, gamma, be, compute_with_backend)