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 __init__(
      self,
      dataset,
      batch_size: int = 32,
      shuffle: bool = True,
      drop_last: bool = False,
      seed: int = 0,
      **kwargs,
  ):
      super().__init__()
  
      self.dataset = dataset
  
      self.batch_size = batch_size
      self.shuffle = shuffle
      self.drop_last = drop_last
      self.seed = int(seed)
  
      self.num_consumed_samples = kwargs.get(
          "num_consumed_samples", 0
      )  # 总共迭代了多少数据了，包括多卡情况下的其它卡上的输出的数量
  
      # 多卡的相关的参数
      self.num_replicas = kwargs.get("num_replicas", 1)
      self.rank = kwargs.get("rank", 0)
      self.epoch = kwargs.get("epoch", -1)
      self.pad = kwargs.get("pad", False)  # 该参数在单卡上不具有任何意义；
  
      # 是否处于iteration之间，为True不允许调用 set_distributed()和load_state_dict()
      self.during_iter = kwargs.get("during_iter", False)
  
      # 以下变量为内部使用恢复状态的变量。
      self.old_batch_size = kwargs.get(
          "old_batch_size", self.batch_size
      )
  
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 1 to create a new RandomBatchSampler object from inherited base classes: ReproducibleBatchSampler with example: obj = RandomBatchSampler(dataset, batch_size, shuffle, drop_last, seed)