code: def test_from_torch(shutdown_only, tmp_path):
      torch_dataset = torchvision.datasets.MNIST(
          tmp_path, download=True
      )
      expected_data = list(torch_dataset)
  
      ray_dataset = ray.data.from_torch(torch_dataset)
  
      actual_data = extract_values("item", list(ray_dataset.take_all()))
      assert actual_data == expected_data
  
      import torch
  
      class IterMNIST(torch.utils.data.IterableDataset):
          def __len__(self):
              return len(torch_dataset)
  
          def __iter__(self):
              return iter(torch_dataset)
  
      iter_torch_dataset = IterMNIST()
      ray_dataset = ray.data.from_torch(iter_torch_dataset)
  
      actual_data = extract_values("item", list(ray_dataset.take_all()))
      assert actual_data == expected_data
  
imports: import os
  from typing import Iterable, List
  import pandas
  import pyarrow
  import pyarrow.parquet
  import pytest
  import torchvision
  from fsspec.implementations.http import HTTPFileSystem
  from fsspec.implementations.local import LocalFileSystem
  import ray
  from ray._private.test_utils import wait_for_condition
  from ray.data._internal.execution.interfaces import TaskContext
  from ray.data.block import Block, BlockAccessor
  from ray.data.datasource import Datasource, DummyOutputDatasource, WriteResult
  from ray.data.datasource.file_meta_provider import _handle_read_os_error
  from ray.data.tests.conftest import *
  from ray.data.tests.mock_http_server import *
  from ray.data.tests.util import extract_values
  from ray.tests.conftest import *
  from ray.types import ObjectRef
label_desc: Use image node_id 11 for calling a global function with example usage: test_from_torch(shutdown_only, tmp_path) and returns: len, iter