class_docstr: 定制给 :class:`~fastNLP.core.dataloaders.MixDataLoader` 的 ``BatchSampler``，其功能是将传入的 ``datasets`` 轮流采样并返回 index，
  处理结束上个 dataset 的一个 batch 后会处理下一个。
class_docstr_tok: ["\u5b9a\u5236\u7ed9",":","class",":","`","~fastNLP.core.dataloaders.MixDataLoader","`","\u7684","``","BatchSampler","``","\uff0c\u5176\u529f\u80fd\u662f\u5c06\u4f20\u5165\u7684","``","datasets","``","\u8f6e\u6d41\u91c7\u6837\u5e76\u8fd4\u56de","index\uff0c","\u5904\u7406\u7ed3\u675f\u4e0a\u4e2a","dataset","\u7684\u4e00\u4e2a","batch","\u540e\u4f1a\u5904\u7406\u4e0b\u4e00\u4e2a\u3002"]
code: def __len__(self) -> int:
      lens, index = 0, 0
      num_sampler = []
      for ds_len in self.num_samplers:
          num_sampler.append(ds_len - index)
          index = ds_len
  
      for ds_len in num_sampler:
          if self.drop_last:
              lens += ds_len // self.batch_size
          else:
              lens += (ds_len + self.batch_size - 1) // self.batch_size
      return lens
  
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 3 for calling the PollingSampler obj's underlying member method code with example usage: obj.__len__() and returns: lens