class_docstr: Shuffle describe how to distribute chunked datasets across processes and workers.
class_docstr_tok: ["Shuffle","describe","how","to","distribute","chunked","datasets","across","processes","and","workers","."]
code: def get_len(
      self, distributed_env: _DistributedEnv, current_epoch: int
  ) -> int:
      _, intervals_per_ranks = self.get_chunks_and_intervals_per_ranks(
          distributed_env, current_epoch
      )
  
      if self.drop_last:
          items_per_process = [
              sum(
                  (interval[-1] - interval[0]) for interval in intervals
              )
              for intervals in intervals_per_ranks
          ]
          min_items_per_process = min(items_per_process)
          return min_items_per_process
  
      return sum(
          (interval[-1] - interval[0])
          for interval in intervals_per_ranks[
              distributed_env.global_rank
          ]
      )
  
file_path: pytorch-lightning/src/lightning/data/streaming/shuffle.py
imports: from abc import ABC, abstractmethod
  from functools import lru_cache
  from typing import Any, List, Tuple
  import numpy
  from lightning.data.streaming import Cache
  from lightning.data.utilities.env import _DistributedEnv
label_desc: Use image node_id 2 for calling the Shuffle obj's underlying member method code with example usage: obj.get_len(distributed_env, current_epoch) and returns: sum, min_items_per_process