class_docstr: 所有 mix_sampler 的基类。
  
  :param dataset: 一个字典，每个元素都是一个实现了 __getitem__ 和 __len__ 的数据容器
  :param batch_size: ``dataset`` 的批次大小，所有 ``dataset`` 均采用该 ``batch_size`` 作为批次大小
  :param sampler: 实例化好的 ``sampler`` ，每个 ``dataset`` 对应一个 ``sampler`` 对象
  :param ds_ratio: ``ds_ratio`` 是控制 datasets 怎么组成一个混合大数据集的重要参数， 其取值为 ``[None, 'truncate_to_least', 'pad_to_most', List[float], Dict[str, float]]``:
  
      * ds_ratio 为 ``None``, datasets 数据集序列或字典不进行数据扩充处理；
      * ds_ratio 为 ``'truncate_to_least'``, datasets 数据集序列或字典会计算得到 datasets序列中 dataset 最断长度 ``mix_len``， 其他数据集会被切断
        到最短长度 ``mix_len``。这种切断不是物理上切断，``MixDataLoader`` 会根据 sampler 不同来采样数据集到指定的最短长度 ``mix_len``；
      * ds_ratio 为 ``'pad_to_most'``, datasets 数据集序列或字典会计算得到 datasets序列中 dataset 最大长度 ``max_len``, 其他其他数据集会扩充
        到最大长度 ``mix_len``。这种扩充不是物理上扩充， ``MixDataLoader`` 会根据 sampler 不同来重采样 dataset 到指定的最大长度 ``max_len``；
      * ds_ratio 为 ``Dict[str, float]`` 时， datasets 类型也必须为 ``Dict[str, DataSet]``, 其 key 一一对应。 ``ds_ratio`` 的 value 是任意大于 0 的浮点数，
        代表着 datasets 的 value 数据进行扩充或者缩减的倍数；
  
  :param drop_last: 当最后一个 batch 长度小于 ``batch_size`` 时是否丢弃
  :param rank: 分布式训练中当前进程的 ``global_rank``
  :param world_size: 分布式训练中进程的总数 **world_size**
class_docstr_tok: ["\u6240\u6709","mix_sampler","\u7684\u57fa\u7c7b\u3002",":","param","dataset",":","\u4e00\u4e2a\u5b57\u5178\uff0c\u6bcf\u4e2a\u5143\u7d20\u90fd\u662f\u4e00\u4e2a\u5b9e\u73b0\u4e86","__getitem__","\u548c","__len__","\u7684\u6570\u636e\u5bb9\u5668",":","param","batch_size",":","``","dataset","``","\u7684\u6279\u6b21\u5927\u5c0f\uff0c\u6240\u6709","``","dataset","``","\u5747\u91c7\u7528\u8be5","``","batch_size","``","\u4f5c\u4e3a\u6279\u6b21\u5927\u5c0f",":","param","sampler",":","\u5b9e\u4f8b\u5316\u597d\u7684","``","sampler","``","\uff0c\u6bcf\u4e2a","``","dataset","``","\u5bf9\u5e94\u4e00\u4e2a","``","sampler","``","\u5bf9\u8c61",":","param","ds_ratio",":","``","ds_ratio","``","\u662f\u63a7\u5236","datasets","\u600e\u4e48\u7ec4\u6210\u4e00\u4e2a\u6df7\u5408\u5927\u6570\u636e\u96c6\u7684\u91cd\u8981\u53c2\u6570\uff0c","\u5176\u53d6\u503c\u4e3a","``","[","None",",","'truncate_to_least","'",",","'pad_to_most","'",",","List","[","float","]",",","Dict","[","str",",","float","]","]","``",":","*","ds_ratio","\u4e3a","``","None","``",",","datasets","\u6570\u636e\u96c6\u5e8f\u5217\u6216\u5b57\u5178\u4e0d\u8fdb\u884c\u6570\u636e\u6269\u5145\u5904\u7406\uff1b","*","ds_ratio","\u4e3a","``","'truncate_to_least","'","``",",","datasets","\u6570\u636e\u96c6\u5e8f\u5217\u6216\u5b57\u5178\u4f1a\u8ba1\u7b97\u5f97\u5230","datasets\u5e8f\u5217\u4e2d","dataset","\u6700\u65ad\u957f\u5ea6","``","mix_len","``","\uff0c","\u5176\u4ed6\u6570\u636e\u96c6\u4f1a\u88ab\u5207\u65ad","\u5230\u6700\u77ed\u957f\u5ea6","``","mix_len","``","\u3002\u8fd9\u79cd\u5207\u65ad\u4e0d\u662f\u7269\u7406\u4e0a\u5207\u65ad\uff0c","``","MixDataLoader","``","\u4f1a\u6839\u636e","sampler","\u4e0d\u540c\u6765\u91c7\u6837\u6570\u636e\u96c6\u5230\u6307\u5b9a\u7684\u6700\u77ed\u957f\u5ea6","``","mix_len","``","\uff1b","*","ds_ratio","\u4e3a","``","'pad_to_most","'","``",",","datasets","\u6570\u636e\u96c6\u5e8f\u5217\u6216\u5b57\u5178\u4f1a\u8ba1\u7b97\u5f97\u5230","datasets\u5e8f\u5217\u4e2d","dataset","\u6700\u5927\u957f\u5ea6","``","max_len","``",",","\u5176\u4ed6\u5176\u4ed6\u6570\u636e\u96c6\u4f1a\u6269\u5145","\u5230\u6700\u5927\u957f\u5ea6","``","mix_len","``","\u3002\u8fd9\u79cd\u6269\u5145\u4e0d\u662f\u7269\u7406\u4e0a\u6269\u5145\uff0c","``","MixDataLoader","``","\u4f1a\u6839\u636e","sampler","\u4e0d\u540c\u6765\u91cd\u91c7\u6837","dataset","\u5230\u6307\u5b9a\u7684\u6700\u5927\u957f\u5ea6","``","max_len","``","\uff1b","*","ds_ratio","\u4e3a","``","Dict","[","str",",","float","]","``","\u65f6\uff0c","datasets","\u7c7b\u578b\u4e5f\u5fc5\u987b\u4e3a","``","Dict","[","str",",","DataSet","]","``",",","\u5176","key","\u4e00\u4e00\u5bf9\u5e94\u3002","``","ds_ratio","``","\u7684","value","\u662f\u4efb\u610f\u5927\u4e8e","0","\u7684\u6d6e\u70b9\u6570\uff0c","\u4ee3\u8868\u7740","datasets","\u7684","value","\u6570\u636e\u8fdb\u884c\u6269\u5145\u6216\u8005\u7f29\u51cf\u7684\u500d\u6570\uff1b",":","param","drop_last",":","\u5f53\u6700\u540e\u4e00\u4e2a","batch","\u957f\u5ea6\u5c0f\u4e8e","``","batch_size","``","\u65f6\u662f\u5426\u4e22\u5f03",":","param","rank",":","\u5206\u5e03\u5f0f\u8bad\u7ec3\u4e2d\u5f53\u524d\u8fdb\u7a0b\u7684","``","global_rank","``",":","param","world_size",":","\u5206\u5e03\u5f0f\u8bad\u7ec3\u4e2d\u8fdb\u7a0b\u7684\u603b\u6570","*","*","world_size","*","*"]
code: def __iter__(self):
      pass
  
imports: import array
  import numpy
  from typing import Union, List, Iterable, Dict
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
label_desc: Use image node_id 2 for calling the MixSampler obj's underlying member method code with example usage: obj.__iter__() without return types