class_docstr: This sampler iterates over all the datasets, sampling according to
  the weighted number of samples in each dataset.
class_docstr_tok: ["This","sampler","iterates","over","all","the","datasets",",","sampling","according","to","the","weighted","number","of","samples","in","each","dataset","."]
docstr: Count number of items in a dataset
docstr_tok: ["Count","number","of","items","in","a","dataset"]
code: def _dataset_count(self, iterator: Iterator) -> int:
      """
      Count number of items in a dataset
      """
      return sum(len(raw_batch) for raw_batch, batch in iter(iterator))
  
imports: from collections.abc import Iterator
  from typing import Dict, Optional
  import numpy
  from pytext.config.component import Component, ComponentType
label_desc: Use image node_id 3 for calling the NaturalBatchSampler obj's underlying member method code with example usage: obj._dataset_count(iterator) and returns: sum