class_docstr: 将所有数据集当成一个混合大数据集来对待， 在 __getitem__() 能根据输入的 idx 来判断属于哪个小数据并返回其 ds_index
class_docstr_tok: ["\u5c06\u6240\u6709\u6570\u636e\u96c6\u5f53\u6210\u4e00\u4e2a\u6df7\u5408\u5927\u6570\u636e\u96c6\u6765\u5bf9\u5f85\uff0c","\u5728","__getitem__","(",")","\u80fd\u6839\u636e\u8f93\u5165\u7684","idx","\u6765\u5224\u65ad\u5c5e\u4e8e\u54ea\u4e2a\u5c0f\u6570\u636e\u5e76\u8fd4\u56de\u5176","ds_index"]
docstr: :param datasets: 实现了 __getitem__() 和 __len__() 的对象的序列
docstr_tok: [":","param","datasets",":","\u5b9e\u73b0\u4e86","__getitem__","(",")","\u548c","__len__","(",")","\u7684\u5bf9\u8c61\u7684\u5e8f\u5217"]
code: def __init__(self, datasets: list = None) -> None:
      """
      :param datasets: 实现了 __getitem__() 和 __len__() 的对象的序列
      """
      self.datasets = datasets
      # 记录每个数据集的长度索引， 以便根据idx定位数据集的位置
      self.lens = []
      index = 0
      for item in self.datasets:
          index += len(item)
          self.lens.append(index)
  
file_path: fastNLP/fastNLP/core/dataloaders/torch_dataloader/mix_dataloader.py
imports: from typing import Optional, Callable, List, Union, Tuple, Dict, Sequence, Mapping
  import numpy
  from pkg_resources import parse_version
  from fastNLP.core.dataset import DataSet, Instance
  from fastNLP.core.samplers import PollingSampler, MixSequentialSampler, DopedSampler
  from fastNLP.envs.imports import _NEED_IMPORT_TORCH
  from fastNLP.core.collators import Collator
label_desc: Use image node_id 1 to create a new _MixDataset object  with example: obj = _MixDataset(datasets)