code: def test_from_tensor_execution(setup):
      tensor = mt.random.rand(10, 10, chunk_size=5)
      df = dataframe_from_tensor(tensor)
      tensor_res = tensor.execute().fetch()
      pdf_expected = pd.DataFrame(tensor_res)
      df_result = df.execute().fetch()
      pd.testing.assert_index_equal(
          df_result.index, pd.RangeIndex(0, 10)
      )
      pd.testing.assert_index_equal(
          df_result.columns, pd.RangeIndex(0, 10)
      )
      pd.testing.assert_frame_equal(df_result, pdf_expected)
  
      # test from tensor with unknown shape
      tensor2 = tensor[tensor[:, 0] < 0.9]
      df = dataframe_from_tensor(tensor2)
      df_result = df.execute().fetch()
      tensor_res = tensor2.execute().fetch()
      pdf_expected = pd.DataFrame(tensor_res)
      pd.testing.assert_frame_equal(
          df_result.reset_index(drop=True), pdf_expected
      )
  
      # test converted with specified index_value and columns
      tensor2 = mt.random.rand(2, 2, chunk_size=1)
      df2 = dataframe_from_tensor(
          tensor2, index=pd.Index(["a", "b"]), columns=pd.Index([3, 4])
      )
      df_result = df2.execute().fetch()
      pd.testing.assert_index_equal(
          df_result.index, pd.Index(["a", "b"])
      )
      pd.testing.assert_index_equal(df_result.columns, pd.Index([3, 4]))
  
      # test converted from 1-d tensor
      tensor3 = mt.array([1, 2, 3])
      df3 = dataframe_from_tensor(tensor3)
      result3 = df3.execute().fetch()
      pdf_expected = pd.DataFrame(np.array([1, 2, 3]))
      pd.testing.assert_frame_equal(pdf_expected, result3)
  
      # test converted from identical chunks
      tensor4 = mt.ones((10, 10), chunk_size=3)
      df4 = dataframe_from_tensor(tensor4)
      result4 = df4.execute().fetch()
      pdf_expected = pd.DataFrame(tensor4.execute().fetch())
      pd.testing.assert_frame_equal(pdf_expected, result4)
  
      # from tensor with given index
      tensor5 = mt.ones((10, 10), chunk_size=3)
      df5 = dataframe_from_tensor(tensor5, index=np.arange(0, 20, 2))
      result5 = df5.execute().fetch()
      pdf_expected = pd.DataFrame(
          np.ones((10, 10)), index=np.arange(0, 20, 2)
      )
      pd.testing.assert_frame_equal(pdf_expected, result5)
  
      # from tensor with given index that is a tensor
      raw7 = np.random.rand(10, 10)
      tensor7 = mt.tensor(raw7, chunk_size=3)
      index_raw7 = np.random.rand(10)
      index7 = mt.tensor(index_raw7, chunk_size=4)
      df7 = dataframe_from_tensor(tensor7, index=index7)
      result7 = df7.execute().fetch()
      pdf_expected = pd.DataFrame(raw7, index=index_raw7)
      pd.testing.assert_frame_equal(pdf_expected, result7)
  
      # from tensor with given index is a md.Index
      raw10 = np.random.rand(10, 10)
      tensor10 = mt.tensor(raw10, chunk_size=3)
      index10 = md.date_range("2020-1-1", periods=10, chunk_size=3)
      df10 = dataframe_from_tensor(tensor10, index=index10)
      result10 = df10.execute().fetch()
      pdf_expected = pd.DataFrame(
          raw10, index=pd.date_range("2020-1-1", periods=10)
      )
      pd.testing.assert_frame_equal(pdf_expected, result10)
  
      # from tensor with given columns
      tensor6 = mt.ones((10, 10), chunk_size=3)
      df6 = dataframe_from_tensor(tensor6, columns=list("abcdefghij"))
      result6 = df6.execute().fetch()
      pdf_expected = pd.DataFrame(
          tensor6.execute().fetch(), columns=list("abcdefghij")
      )
      pd.testing.assert_frame_equal(pdf_expected, result6)
  
      # from 1d tensors
      raws8 = [
          ("a", np.random.rand(8)),
          ("b", np.random.randint(10, size=8)),
          (
              "c",
              [
                  "".join(np.random.choice(list(printable), size=6))
                  for _ in range(8)
              ],
          ),
      ]
      tensors8 = OrderedDict(
          (r[0], mt.tensor(r[1], chunk_size=3)) for r in raws8
      )
      raws8.append(("d", 1))
      raws8.append(("e", pd.date_range("2020-1-1", periods=8)))
      tensors8["d"] = 1
      tensors8["e"] = raws8[-1][1]
      df8 = dataframe_from_1d_tileables(
          tensors8, columns=[r[0] for r in raws8]
      )
      result = df8.execute().fetch()
      pdf_expected = pd.DataFrame(OrderedDict(raws8))
      pd.testing.assert_frame_equal(result, pdf_expected)
  
      # from 1d tensors and specify index with a tensor
      index_raw9 = np.random.rand(8)
      index9 = mt.tensor(index_raw9, chunk_size=4)
      df9 = dataframe_from_1d_tileables(
          tensors8, columns=[r[0] for r in raws8], index=index9
      )
      result = df9.execute().fetch()
      pdf_expected = pd.DataFrame(OrderedDict(raws8), index=index_raw9)
      pd.testing.assert_frame_equal(result, pdf_expected)
  
      # from 1d tensors and specify index
      df11 = dataframe_from_1d_tileables(
          tensors8,
          columns=[r[0] for r in raws8],
          index=md.date_range("2020-1-1", periods=8),
      )
      result = df11.execute().fetch()
      pdf_expected = pd.DataFrame(
          OrderedDict(raws8), index=pd.date_range("2020-1-1", periods=8)
      )
      pd.testing.assert_frame_equal(result, pdf_expected)
  
      df12 = dataframe_from_1d_tileables(
          {"a": [md.Series([1, 2, 3]).sum() + 1]}
      )
      result = df12.execute().fetch()
      pdf_expected = pd.DataFrame(
          {"a": [pd.Series([1, 2, 3]).sum() + 1]}
      )
      pd.testing.assert_frame_equal(result, pdf_expected)
  
imports: import itertools
  import os
  import tempfile
  import time
  from collections import OrderedDict
  from datetime import datetime
  from string import printable
  import numpy
  import pandas
  import pytest
  from ....None import tensor
  from ....None import dataframe
  from ....config import option_context
  from ....tests.core import require_cudf, require_ray
  from ....utils import arrow_array_to_objects, lazy_import, pd_release_version
  from ...utils import ray_deprecate_ml_dataset
  from ..dataframe import from_pandas
  from ..series import from_pandas
  from ..index import from_pandas, from_tileable
  from ..from_tensor import dataframe_from_tensor, dataframe_from_1d_tileables
  from ..from_records import from_records
label_desc: Use image node_id 8 for calling a global function with example usage: test_from_tensor_execution(setup) without return types