class_docstr: 随机分 batch 的 batch_sampler 。
  
  :param dataset: 实现了 __len__ 方法的数据容器
  :param batch_size: 每个 batch 的大小
  :param shuffle: 如果为 ``True``，将不进行打乱操作，实际上数据会以从长到短的方式输出
  :param drop_last: 如果最后一个 batch 无法构成 batch_size 个 sample ，是否丢掉
  :param seed: 设置的随机数种子
  :param kwargs: fastNLP 内部使用的参数
class_docstr_tok: ["\u968f\u673a\u5206","batch","\u7684","batch_sampler","\u3002",":","param","dataset",":","\u5b9e\u73b0\u4e86","__len__","\u65b9\u6cd5\u7684\u6570\u636e\u5bb9\u5668",":","param","batch_size",":","\u6bcf\u4e2a","batch","\u7684\u5927\u5c0f",":","param","shuffle",":","\u5982\u679c\u4e3a","``","True","``","\uff0c\u5c06\u4e0d\u8fdb\u884c\u6253\u4e71\u64cd\u4f5c\uff0c\u5b9e\u9645\u4e0a\u6570\u636e\u4f1a\u4ee5\u4ece\u957f\u5230\u77ed\u7684\u65b9\u5f0f\u8f93\u51fa",":","param","drop_last",":","\u5982\u679c\u6700\u540e\u4e00\u4e2a","batch","\u65e0\u6cd5\u6784\u6210","batch_size","\u4e2a","sample","\uff0c\u662f\u5426\u4e22\u6389",":","param","seed",":","\u8bbe\u7f6e\u7684\u968f\u673a\u6570\u79cd\u5b50",":","param","kwargs",":","fastNLP","\u5185\u90e8\u4f7f\u7528\u7684\u53c2\u6570"]
code: def state_dict(self) -> Dict:
      if self.old_batch_size != self.batch_size:
          raise RuntimeError(
              "BucketedBatchSampler does not support saving before last checkpoint states have been"
              " consumed. "
          )
      states = {
          "seed": self.seed,
          "epoch": self.epoch,
          "num_consumed_samples": self.num_consumed_samples,
          "sampler_type": self.__class__.__name__,
          "length": self.num_samples,
          "shuffle": self.shuffle,
          "batch_size": self.batch_size,
          "num_replicas": self.num_replicas,
      }
  
      return states
  
imports: import os
  import math
  from copy import deepcopy
  from typing import Dict, Union, List
  from itertools import chain
  import numpy
  from fastNLP.core.dataset import DataSet
  from fastNLP.core.log import logger
  from .utils import create_array
  from abc import abstractmethod
label_desc: Use image node_id 11 for calling the RandomBatchSampler obj's underlying member method code with example usage: obj.state_dict() and returns: states