code: def _validate_tucker_tensor(tucker_tensor):
      core, factors = tucker_tensor
  
      if len(factors) < 2:
          raise ValueError(
              "A Tucker tensor should be composed of at least two factors and a core."
              f"However, {len(factors)} factor was given."
          )
  
      if len(factors) != tl.ndim(core):
          raise ValueError(
              "Tucker decompositions should have one factor per more of the core tensor."
              f"However, core has {tl.ndim(core)} modes but {len(factors)} factors have been provided"
          )
  
      shape = []
      rank = []
      for i, factor in enumerate(factors):
          current_shape, current_rank = tl.shape(factor)
          if current_rank != tl.shape(core)[i]:
              raise ValueError(
                  "Factor `n` of Tucker decomposition should verify:\n"
                  "factors[n].shape[1] = core.shape[n]."
                  f"However, factors[{i}].shape[1]={tl.shape(factor)[1]} but core.shape[{i}]={tl.shape(core)[i]}."
              )
          shape.append(current_shape)
          rank.append(current_rank)
  
      return tuple(shape), tuple(rank)
  
imports: from ._factorized_tensor import FactorizedTensor
  from .base import unfold, tensor_to_vec
  from .tenalg import multi_mode_dot, mode_dot
  from .None import backend
  import numpy
  from scipy.optimize import brentq
  import warnings
label_desc: Use image node_id 1 for calling a global function with example usage: _validate_tucker_tensor(tucker_tensor) and returns: tuple,  tuple