code: def svd_checks(matrix, n_eigenvecs=None):
      """Runs common checks to all of the SVD methods.
  
      Parameters
      ----------
      matrix : 2D-array
      n_eigenvecs : int, optional, default is None
          if specified, number of eigen[vectors-values] to return
  
      Returns
      -------
      n_eigenvecs : int
          the number of eigenvectors to solve for
      min_dim : int
          the minimum dimension of matrix
      max_dim : int
          the maximum dimension of matrix
      """
      # Check that matrix is... a matrix!
      if tl.ndim(matrix) != 2:
          raise ValueError(
              f"matrix be a matrix. matrix.ndim is {tl.ndim(matrix)} != 2"
          )
  
      dim_1, dim_2 = tl.shape(matrix)
      min_dim, max_dim = min(dim_1, dim_2), max(dim_1, dim_2)
  
      if n_eigenvecs is None:
          n_eigenvecs = max_dim
  
      if n_eigenvecs > max_dim:
          warnings.warn(
              f"Trying to compute SVD with n_eigenvecs={n_eigenvecs}, which is larger "
              f"than max(matrix.shape)={max_dim}. Setting n_eigenvecs to {max_dim}."
          )
          n_eigenvecs = max_dim
  
      return n_eigenvecs, min_dim, max_dim
  
file_path: tensorly/tensorly/tenalg/svd.py
imports: import warnings
  import tensorly
  from .proximal import soft_thresholding
label_desc: Use image node_id 4 for calling a global function with example usage: svd_checks(matrix, n_eigenvecs) and returns: n_eigenvecs,  min_dim,  max_dim