class_docstr: Generic class for tensor products.
class_docstr_tok: ["Generic","class","for","tensor","products","."]
code: def __new__(cls, *args, **kwargs):
      from sympy.tensor.array import NDimArray, tensorproduct, Array
      from sympy.matrices.expressions.matexpr import MatrixExpr
      from sympy.matrices.matrixbase import MatrixBase
      from sympy.strategies import flatten
  
      args = [sympify(arg) for arg in args]
      evaluate = kwargs.get("evaluate", global_parameters.evaluate)
  
      if not evaluate:
          obj = Expr.__new__(cls, *args)
          return obj
  
      arrays = []
      other = []
      scalar = S.One
      for arg in args:
          if isinstance(arg, (Iterable, MatrixBase, NDimArray)):
              arrays.append(Array(arg))
          elif isinstance(arg, (MatrixExpr,)):
              other.append(arg)
          else:
              scalar *= arg
  
      coeff = scalar * tensorproduct(*arrays)
      if len(other) == 0:
          return coeff
      if coeff != 1:
          newargs = [coeff] + other
      else:
          newargs = other
      obj = Expr.__new__(cls, *newargs, **kwargs)
      return flatten(obj)
  
file_path: sympy/sympy/tensor/functions.py
imports: from collections.abc import Iterable
  from functools import singledispatch
  from sympy.core.expr import Expr
  from sympy.core.mul import Mul
  from sympy.core.singleton import S
  from sympy.core.sympify import sympify
  from sympy.core.parameters import global_parameters
label_desc: Use image node_id 1 for calling the TensorProduct obj's underlying member method code with example usage: obj.__new__(cls) and returns: flatten, obj, coeff