code: def test_subset_random_sampler(setup_cluster):
      import numpy as np
      import torch
  
      data = mt.random.rand(1000, 32, dtype="f4")
      labels = mt.random.randint(0, 2, (1000, 10), dtype="f4")
      data.execute()
      labels.execute()
  
      train_dataset = MarsDataset(data, labels)
      train_sampler = SubsetRandomSampler(
          np.random.choice(
              range(len(train_dataset)), len(train_dataset)
          )
      )
  
      assert len(train_sampler) == 1000
      train_loader = torch.utils.data.DataLoader(
          dataset=train_dataset, batch_size=32, sampler=train_sampler
      )
      for _, (batch_data, batch_labels) in enumerate(train_loader):
          assert len(batch_data[0]) == 32
          assert len(batch_labels[0]) == 10
  
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 4 for calling a global function with example usage: test_subset_random_sampler(setup_cluster) without return types