code: def test_1(self):
      sampler = NormalSampler(
          num_of_data=100
      )  # 这里是否是 batchsampler 不影响；
  
      reproduce_batch_sampler = ReproduceBatchSampler(
          sampler, batch_size=4, drop_last=False
      )
  
      forward_steps = 3
      iterator = iter(reproduce_batch_sampler)
      i = 0
      while i < forward_steps:
          next(iterator)
          i += 1
  
      # 保存状态；
      state = reproduce_batch_sampler.state_dict()
  
      assert state == {
          "index_list": array("I", list(range(100))),
          "num_consumed_samples": forward_steps * 4,
          "sampler_type": "ReproduceBatchSampler",
      }
  
      # 重新生成一个 batchsampler 然后加载状态；
      sampler = NormalSampler(
          num_of_data=100
      )  # 这里是否是 batchsampler 不影响；
      reproduce_batch_sampler = ReproduceBatchSampler(
          sampler, batch_size=4, drop_last=False
      )
      reproduce_batch_sampler.load_state_dict(state)
  
      real_res = []
      supposed_res = (list(range(12, 16)), list(range(16, 20)))
      forward_steps = 2
      iter_dataloader = iter(reproduce_batch_sampler)
      for _ in range(forward_steps):
          real_res.append(next(iter_dataloader))
  
      for i in range(forward_steps):
          assert supposed_res[i] == real_res[i]
  
      # 改变 batchsize；
      sampler = NormalSampler(
          num_of_data=100
      )  # 这里是否是 batchsampler 不影响；
      reproduce_batch_sampler = ReproduceBatchSampler(
          sampler, batch_size=7, drop_last=False
      )
      reproduce_batch_sampler.load_state_dict(state)
  
      real_res = []
      supposed_res = (list(range(12, 19)), list(range(19, 26)))
      forward_steps = 2
      iter_dataloader = iter(reproduce_batch_sampler)
      for _ in range(forward_steps):
          real_res.append(next(iter_dataloader))
  
      for i in range(forward_steps):
          assert supposed_res[i] == real_res[i]
  
      # 断点重训的第二轮是否是一个完整的 dataloader；
      # 先把断点重训所在的那一个 epoch 跑完；
      begin_idx = 26
      while True:
          try:
              data = next(iter_dataloader)
              _batch_size = len(data)
              assert data == list(
                  range(begin_idx, begin_idx + _batch_size)
              )
              begin_idx += _batch_size
          except StopIteration:
              break
  
      # 开始新的一轮；
      begin_idx = 0
      iter_dataloader = iter(reproduce_batch_sampler)
      while True:
          try:
              data = next(iter_dataloader)
              _batch_size = len(data)
              assert data == list(
                  range(begin_idx, begin_idx + _batch_size)
              )
              begin_idx += _batch_size
          except StopIteration:
              break
  
imports: import numpy
  import pytest
  from itertools import chain
  from copy import deepcopy
  from array import array
  from tests.helpers.datasets.normal_data import NormalSampler, NormalBatchSampler
  from fastNLP.core.samplers import ReproduceBatchSampler, BucketedBatchSampler, RandomBatchSampler
label_desc: Use image node_id 1 for calling the TestReproducibleBatchSampler obj's underlying member method code with example usage: obj.test_1() without return types