code: def test_variable_shaped_tensor_array_roundtrip():
      shapes = [(2, 2), (3, 3), (4, 4)]
      cumsum_sizes = np.cumsum(
          [0] + [np.prod(shape) for shape in shapes[:-1]]
      )
      arrs = [
          np.arange(offset, offset + np.prod(shape)).reshape(shape)
          for offset, shape in zip(cumsum_sizes, shapes)
      ]
      arr = np.array(arrs, dtype=object)
      ta = TensorArray(arr)
      assert isinstance(ta.dtype, TensorDtype)
      assert len(ta) == len(arr)
      out = ta.to_numpy()
      for o, a in zip(out, arr):
          np.testing.assert_array_equal(o, a)
  
      # Check Arrow conversion.
      ata = ta.__arrow_array__()
      assert isinstance(ata.type, ArrowVariableShapedTensorType)
      assert len(ata) == len(arr)
      out = ata.to_numpy()
      for o, a in zip(out, arr):
          np.testing.assert_array_equal(o, a)
  
imports: import itertools
  import numpy
  import pandas
  from packaging.version import parse
  import pyarrow
  import pytest
  from ray.air.util.tensor_extensions.arrow import ArrowTensorArray, ArrowTensorType, ArrowVariableShapedTensorArray, ArrowVariableShapedTensorType
  from ray.air.util.tensor_extensions.pandas import TensorArray, TensorDtype
  from ray.air.util.tensor_extensions.utils import create_ragged_ndarray
  from ray._private.utils import _get_pyarrow_version
label_desc: Use image node_id 13 for calling a global function with example usage: test_variable_shaped_tensor_array_roundtrip() without return types