code: def test_mars_dataset(setup):
      from torch.utils.data import Dataset
      import numpy as np
      import pandas as pd
  
      # Mars tensor
      data = mt.random.rand(1000, 32, dtype="f4")
      labels = mt.random.randint(0, 2, (1000, 10), dtype="f4")
  
      data_verify = data[1].execute().fetch()
      labels_verify = labels[1].execute().fetch()
  
      train_dataset = MarsDataset(data, labels)
  
      assert isinstance(train_dataset, Dataset)
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      np.testing.assert_array_equal(train_dataset[1][1], labels_verify)
      assert len(train_dataset) == 1000
  
      # np ndarray
      data = np.random.rand(1000, 32)
      labels = np.random.randint(0, 2, (1000, 10))
  
      data_verify = data[1]
      labels.dtype = "float32"
      labels_verify = labels[1]
  
      train_dataset = MarsDataset(data, labels)
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      np.testing.assert_array_equal(train_dataset[1][1], labels_verify)
      assert len(train_dataset) == 1000
  
      # Mars dataframe
      data = md.DataFrame(data)
      labels = md.DataFrame(labels)
  
      data_verify = data.iloc[1].execute().fetch().values
      labels_verify = labels.iloc[1].execute().fetch().values
  
      train_dataset = MarsDataset(
          data,
          labels,
          fetch_kwargs={"extra_config": {"check_series_name": False}},
      )
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      np.testing.assert_array_equal(train_dataset[1][1], labels_verify)
      assert len(train_dataset) == 1000
  
      # Mars Series
      label = labels[1]
  
      label_verify = label[1].execute().fetch()
  
      train_dataset = MarsDataset(
          data,
          label,
          fetch_kwargs={"extra_config": {"check_series_name": False}},
      )
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      assert train_dataset[1][1] == label_verify
      assert len(train_dataset) == 1000
  
      # pandas dataframe
      data = pd.DataFrame(np.random.rand(1000, 32))
      labels = pd.DataFrame(
          np.random.randint(0, 2, (1000, 10)), dtype="float32"
      )
  
      data_verify = data.iloc[1].values
      labels_verify = labels.iloc[1].values
  
      train_dataset = MarsDataset(data, labels)
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      np.testing.assert_array_equal(train_dataset[1][1], labels_verify)
      assert len(train_dataset) == 1000
  
      # pands series
      label = labels[1]
      label_verify = label[1]
  
      train_dataset = MarsDataset(data, label)
      np.testing.assert_array_equal(train_dataset[1][0], data_verify)
      assert train_dataset[1][1] == label_verify
      assert len(train_dataset) == 1000
  
      # test TypeError
      label = tuple(range(1000))
  
      with pytest.raises(TypeError) as e:
          train_dataset = MarsDataset(data, label)
      exec_msg = e.value.args[0]
      assert exec_msg == "Unexpected dataset type: <class 'tuple'>"
  
file_path: mars/mars/learn/contrib/pytorch/tests/test_dataset.py
imports: import pytest
  import os
  from .....None import tensor
  from .....None import dataframe
  from .....utils import lazy_import
  from ..None import MarsDataset, RandomSampler, SequentialSampler, SubsetRandomSampler, DistributedSampler, run_pytorch_script
label_desc: Use image node_id 1 for calling a global function with example usage: test_mars_dataset(setup) without return types