code: def test_to_pandas_tensor_column_cast_arrow(ray_start_regular_shared):
      # Check that tensor column casting occurs when converting a Dataset to a Pandas
      # DataFrame.
      data = np.arange(12).reshape((3, 2, 2))
      ctx = ray.data.context.DataContext.get_current()
      original = ctx.enable_tensor_extension_casting
      try:
          ctx.enable_tensor_extension_casting = True
          in_table = pa.table({"a": ArrowTensorArray.from_numpy(data)})
          ds = ray.data.from_arrow(in_table)
          dtype = ds.schema().base_schema.field(0).type
          assert isinstance(dtype, ArrowTensorType)
          out_df = ds.to_pandas()
          assert out_df["a"].dtype.type is np.object_
          expected_df = pd.DataFrame({"a": list(data)})
          pd.testing.assert_frame_equal(out_df, expected_df)
      finally:
          ctx.enable_tensor_extension_casting = original
  
file_path: ray/python/ray/data/tests/test_pandas.py
imports: import numpy
  import pandas
  import pyarrow
  import pytest
  import ray
  from ray.data.extensions import ArrowTensorArray, ArrowTensorType, TensorDtype
  from ray.data.tests.conftest import *
  from ray.data.tests.mock_http_server import *
  from ray.tests.conftest import *
label_desc: Use image node_id 7 for calling a global function with example usage: test_to_pandas_tensor_column_cast_arrow(ray_start_regular_shared) without return types