code: def dataframe_from_tensor(
      tensor: Tensor,
      index: Union[TileableType, pd.Index] = None,
      columns: Union[pd.Index, list] = None,
      gpu: bool = None,
      sparse: bool = False,
  ):
      if tensor is not None:
          if tensor.ndim > 2 or tensor.ndim <= 0:
              raise TypeError(
                  f"Not support create DataFrame from {tensor.ndim} dims tensor"
              )
          try:
              col_num = tensor.shape[1]
          except IndexError:
              col_num = 1
          gpu = tensor.op.gpu if gpu is None else gpu
          dtypes = pd.Series([tensor.dtype] * col_num, index=columns)
          if columns is None:
              columns = dtypes.index
      else:
          gpu = None
          if columns is not None:
              dtypes = pd.Series([], index=columns)
          else:
              dtypes = pd.Series([], index=pd.Index([], dtype=object))
      if index is not None and not isinstance(index, ENTITY_TYPE):
          index = pd.Index(index)
      op = DataFrameFromTensor(
          input=tensor,
          index=index,
          columns=columns,
          gpu=gpu,
          sparse=sparse,
      )
      return op(tensor, index, columns, dtypes)
  
imports: from collections import OrderedDict
  from typing import Any, Dict, List, Union
  import numpy
  import pandas
  from ...None import opcodes
  from ...core import ENTITY_TYPE, OutputType, recursive_tile
  from ...core.context import Context
  from ...serialization.serializables import KeyField, AnyField
  from ...tensor.core import Tensor
  from ...tensor.datasource import tensor
  from ...tensor.utils import unify_chunks
  from ...typing import EntityType, TileableType
  from ...utils import has_unknown_shape
  from ..core import INDEX_TYPE, SERIES_TYPE
  from ..operands import DataFrameOperand, DataFrameOperandMixin
  from ..utils import parse_index
label_desc: Use image node_id 1 for calling a global function with example usage: dataframe_from_tensor(tensor, index, columns, gpu, sparse) and returns: op