code: def test_to_torch_feature_columns(
      ray_start_10_cpus_shared, input, force_dtype, label_type
  ):
      import torch
  
      df1 = pd.DataFrame(
          {
              "one": [1, 2, 3],
              "two": [1.0, 2.0, 3.0],
              "three": [4.0, 5.0, 6.0],
              "label": [1.0, 2.0, 3.0],
          }
      )
      df2 = pd.DataFrame(
          {
              "one": [4, 5, 6],
              "two": [4.0, 5.0, 6.0],
              "three": [7.0, 8.0, 9.0],
              "label": [4.0, 5.0, 6.0],
          }
      )
      df3 = pd.DataFrame(
          {
              "one": [7, 8],
              "two": [7.0, 8.0],
              "three": [10.0, 11.0],
              "label": [7.0, 8.0],
          }
      )
      df = pd.concat([df1, df2, df3]).drop("three", axis=1)
      ds = ray.data.from_pandas([df1, df2, df3])
  
      feature_column_dtypes = None
      label_column_dtype = None
      if force_dtype:
          label_column_dtype = torch.long
      if input == "single":
          feature_columns = ["one", "two"]
          if force_dtype:
              feature_column_dtypes = torch.long
      elif input == "list":
          feature_columns = [["one"], ["two"]]
          if force_dtype:
              feature_column_dtypes = [torch.long, torch.long]
      elif input == "dict":
          feature_columns = {"X1": ["one"], "X2": ["two"]}
          if force_dtype:
              feature_column_dtypes = {
                  "X1": torch.long,
                  "X2": torch.long,
              }
  
      label_column = None if label_type is None else "label"
      unsqueeze_label_tensor = label_type == "unsqueezed"
  
      torchd = ds.to_torch(
          label_column=label_column,
          feature_columns=feature_columns,
          feature_column_dtypes=feature_column_dtypes,
          label_column_dtype=label_column_dtype,
          unsqueeze_label_tensor=unsqueeze_label_tensor,
          batch_size=3,
      )
      iterations = []
  
      for batch in iter(torchd):
          features, label = batch
  
          if input == "single":
              assert isinstance(features, torch.Tensor)
              if force_dtype:
                  assert features.dtype == torch.long
              data = features
          elif input == "list":
              assert isinstance(features, list)
              assert all(
                  isinstance(item, torch.Tensor) for item in features
              )
              if force_dtype:
                  assert all(
                      item.dtype == torch.long for item in features
                  )
              data = torch.cat(tuple(features), dim=1)
          elif input == "dict":
              assert isinstance(features, dict)
              assert all(
                  isinstance(item, torch.Tensor)
                  for item in features.values()
              )
              if force_dtype:
                  assert all(
                      item.dtype == torch.long
                      for item in features.values()
                  )
              data = torch.cat(tuple(features.values()), dim=1)
  
          if not label_type:
              assert label is None
          else:
              assert isinstance(label, torch.Tensor)
              if force_dtype:
                  assert label.dtype == torch.long
              if unsqueeze_label_tensor:
                  assert label.dim() == 2
              else:
                  assert label.dim() == 1
                  label = label.view(-1, 1)
              data = torch.cat((data, label), dim=1)
          iterations.append(data.numpy())
  
      combined_iterations = np.concatenate(iterations)
      if not label_type:
          df.drop("label", axis=1, inplace=True)
      np.testing.assert_array_equal(df.values, combined_iterations)
  
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 2 for calling a global function with example usage: test_to_torch_feature_columns(ray_start_10_cpus_shared, input, force_dtype, label_type) without return types