class_docstr: 专门测试 set_dist_repro_dataloader 函数的类
class_docstr_tok: ["\u4e13\u95e8\u6d4b\u8bd5","set_dist_repro_dataloader","\u51fd\u6570\u7684\u7c7b"]
code: def test_shuffle_dataloader(
      self, shuffle, batch_size, drop_last, reproducible
  ):
      # 需要检验一下 set_dist_repro_dataloader 没有修改参数
      num_samples = 200
      dataset = PaddleNormalXYDataset(num_samples)
      dl = prepare_paddle_dataloader(
          dataset,
          shuffle=shuffle,
          batch_size=batch_size,
          drop_last=drop_last,
      )
      model = PaddleNormalModel_Classification_1(1, 2)
      dl = self.driver.set_dist_repro_dataloader(
          dataloader=dl, reproducible=reproducible
      )
  
      data = []
      flags = []
      for batch in dl:
          flags.append(batch["x"].shape[0] == batch_size)
          data.extend(batch["x"].reshape((-1,)).tolist())
  
      if drop_last and num_samples % batch_size != 0:
          assert len(data) != num_samples
          assert all(flags) == True
      elif num_samples % batch_size != 0:
          assert flags[-1] is False
      else:
          assert len(data) == num_samples
  
      if not shuffle:
          for i in range(1, len(data)):
              assert data[i] > data[i - 1]
      else:
          flags = []
          for i in range(1, len(data)):
              flags.append(data[i] > data[i - 1])
          assert all(flags) is False
  
imports: import pytest
  from pathlib import Path
  from fastNLP.core.drivers.paddle_driver.single_device import PaddleSingleDriver
  from fastNLP.core.samplers import ReproduceBatchSampler, RandomSampler
  from tests.helpers.models.paddle_model import PaddleNormalModel_Classification_1
  from tests.helpers.datasets.paddle_data import PaddleNormalDataset, PaddleNormalXYDataset
  from tests.helpers.datasets.torch_data import TorchNormalDataset
  from tests.helpers.models.torch_model import TorchNormalModel_Classification_1
  from fastNLP.envs.distributed import rank_zero_rm
  from fastNLP.envs.imports import _NEED_IMPORT_PADDLE, _NEED_IMPORT_TORCH
  from fastNLP import prepare_paddle_dataloader, BucketedBatchSampler
label_desc: Use image node_id 9 for calling the TestSetDistReproDataloader obj's underlying member method code with example usage: obj.test_shuffle_dataloader(shuffle, batch_size, drop_last, reproducible) without return types