code: def svd_interface(
      matrix,
      method="truncated_svd",
      n_eigenvecs=None,
      flip_sign=True,
      u_based_flip_sign=True,
      non_negative=None,
      mask=None,
      n_iter_mask_imputation=5,
      **kwargs,
  ):
      """Dispatching function to various SVD algorithms, alongside additional
      properties such as resolving sign invariance, imputation, and non-negativity.
  
      Parameters
      ----------
      matrix : tensor
          A 2D tensor.
      method : str, default is 'truncated_svd'
          Function to use to compute the SVD, acceptable values in tensorly.SVD_FUNS or a callable.
      n_eigenvecs : int, optional, default is None
          If specified, number of eigen[vectors-values] to return.
      flip_sign : bool, optional, default is True
          Whether to resolve the sign indeterminacy of SVD.
      u_based_flip_sign : bool, optional, default is True
          Whether the sign indeterminacy should be resolved using U (vs. V).
      non_negative : bool, optional, default is False
          Whether to make the SVD results non-negative.
      nn_type : str, default is 'nndsvd'
          Algorithm to use for converting U to be non-negative.
      mask : tensor, default is None.
          Array of booleans with the same shape as ``matrix``. Should be 0 where
          the values are missing and 1 everywhere else. None if nothing is missing.
          Imputation is done by iterative low rank approximation, so n_eigenvecs should be provided
          and be lower than the rank of the matrix.
      n_iter_mask_imputation : int, default is 5
          Number of repetitions to apply in missing value imputation.
      **kwargs : optional
          Arguments passed along to individual SVD algorithms.
  
      Returns
      -------
      U : 2-D tensor, shape (matrix.shape[0], n_eigenvecs)
          Contains the right singular vectors of `matrix`
      S : 1-D tensor, shape (n_eigenvecs, )
          Contains the singular values of `matrix`
      V : 2-D tensor, shape (n_eigenvecs, matrix.shape[1])
          Contains the left singular vectors of `matrix`
      """
  
      if method == "truncated_svd":
          svd_fun = truncated_svd
      elif method == "symeig_svd":
          svd_fun = symeig_svd
      elif method == "randomized_svd":
          svd_fun = randomized_svd
      elif callable(method):
          svd_fun = method
      else:
          raise ValueError(
              f"Got svd={method}. However, the possible choices are {SVD_FUNS} or to pass a callable."
          )
  
      U, S, V = svd_fun(matrix, n_eigenvecs=n_eigenvecs, **kwargs)
  
      if mask is not None and n_eigenvecs is not None:
          for _ in range(n_iter_mask_imputation):
              # Workaround to avoid needing fill_diagonal
              St = tl.eye(
                  tl.shape(U)[1], tl.shape(V)[0], **tl.context(matrix)
              )
              for i in range(tl.shape(S)[0]):
                  St = tl.index_update(St, tl.index[i, i], S[i])
  
              matrix = matrix * mask + (U @ St @ V) * (1 - mask)
              U, S, V = svd_fun(
                  matrix, n_eigenvecs=n_eigenvecs, **kwargs
              )
  
      if flip_sign:
          U, V = svd_flip(U, V, u_based_decision=u_based_flip_sign)
  
      if non_negative is not False and non_negative is not None:
          U, V = make_svd_non_negative(matrix, U, S, V, non_negative)
  
      return U, S, V
  
file_path: tensorly/tensorly/tenalg/svd.py
imports: import warnings
  import tensorly
  from .proximal import soft_thresholding
label_desc: Use image node_id 8 for calling a global function with example usage: svd_interface(matrix, method, n_eigenvecs, flip_sign, u_based_flip_sign, non_negative, mask, n_iter_mask_imputation) and returns: U,  S,  V