code: def test_tensors_in_tables_to_torch_variable_shaped(
      ray_start_10_cpus_shared,
  ):
      shapes = [(2, 2), (3, 3), (4, 4)]
      cumsum_sizes = np.cumsum(
          [0] + [np.prod(shape) for shape in shapes[:-1]]
      )
      arrs1 = [
          np.arange(offset, offset + np.prod(shape)).reshape(shape)
          for offset, shape in zip(cumsum_sizes, shapes)
      ]
      df1 = pd.DataFrame(
          {
              "one": TensorArray(arrs1),
              "two": TensorArray([a + 1 for a in arrs1]),
              "label": [1.0, 2.0, 3.0],
          }
      )
      base = cumsum_sizes[-1]
      arrs2 = [
          np.arange(
              base + offset, base + offset + np.prod(shape)
          ).reshape(shape)
          for offset, shape in zip(cumsum_sizes, shapes)
      ]
      df2 = pd.DataFrame(
          {
              "one": TensorArray(arrs2),
              "two": TensorArray([a + 1 for a in arrs2]),
              "label": [4.0, 5.0, 6.0],
          }
      )
      df = pd.concat([df1, df2])
      ds = ray.data.from_pandas([df1, df2])
      torchd = ds.to_torch(
          label_column="label",
          batch_size=2,
          unsqueeze_label_tensor=False,
      )
  
      num_epochs = 2
      for _ in range(num_epochs):
          features, labels = [], []
          for batch in iter(torchd):
              features.append(batch[0].numpy())
              labels.append(batch[1].numpy())
          features, labels = np.concatenate(features), np.concatenate(
              labels
          )
          values = np.stack(
              [df["one"].to_numpy(), df["two"].to_numpy()], axis=1
          )
          np.testing.assert_array_equal(values, features)
          np.testing.assert_array_equal(df["label"].to_numpy(), labels)
  
file_path: ray/python/ray/data/tests/test_torch.py
imports: import numpy
  import pandas
  import pytest
  import ray
  from ray.data.extensions.tensor_extension import TensorArray
  from ray.data.tests.conftest import *
  from ray.tests.conftest import *
label_desc: Use image node_id 5 for calling a global function with example usage: test_tensors_in_tables_to_torch_variable_shaped(ray_start_10_cpus_shared) without return types