code: def check_to_torch_no_spill(ctx, dataset):
      # Iterate over the dataset for 10 epochs to stress test that
      # no spilling will happen.
      max_epoch = 10
      for _ in range(max_epoch):
          for _ in dataset.to_torch(batch_size=None):
              pass
      meminfo = memory_summary(
          ctx.address_info["address"], stats_only=True
      )
      assert "Spilled" not in meminfo, meminfo
  
file_path: ray/python/ray/data/tests/test_object_gc.py
imports: import threading
  import pytest
  import ray
  from ray._private.internal_api import memory_summary
  from ray._private.test_utils import wait_for_condition
  from ray.tests.conftest import *
label_desc: Use image node_id 2 for calling a global function with example usage: check_to_torch_no_spill(ctx, dataset) without return types