class_docstr: Wrapper that allows DataPipe to be sharded (functional name: ``sharding_filter``).
  
  After ``apply_sharding`` is called, each instance of the DataPipe (on different workers) will have every `n`-th element of the
  original DataPipe, where `n` equals to the number of instances.
  
  Args:
      source_datapipe: Iterable DataPipe that will be sharded
code: def apply_sharding(
      self,
      num_of_instances,
      instance_id,
      sharding_group=SHARDING_PRIORITIES.DEFAULT,
  ):
      if instance_id >= num_of_instances:
          raise ValueError(
              f"instance_id({instance_id}) should be smaller than num_of_instances({num_of_instances})"
          )
      if sharding_group == SHARDING_PRIORITIES.DEFAULT:
          if (
              len(self.groups)
              and SHARDING_PRIORITIES.DEFAULT not in self.groups
          ):
              raise Exception(
                  "ShardingFilter cannot mix DEFAULT and non DEFAULT groups"
              )
      else:
          if SHARDING_PRIORITIES.DEFAULT in self.groups:
              raise Exception(
                  "ShardingFilter cannot mix DEFAULT and non DEFAULT groups"
              )
      self.groups[sharding_group] = (num_of_instances, instance_id)
      self._update_num_of_instances()
  
file_path: pytorch/torch/utils/data/datapipes/iter/sharding.py
imports: from typing import Dict, Sized, Tuple
  from torch.utils.data.datapipes._decorator import functional_datapipe
  from torch.utils.data.datapipes.datapipe import IterDataPipe
  from enum import IntEnum
label_desc: Use image node_id 2 for calling the ShardingFilterIterDataPipe obj's underlying member method code with example usage: obj.apply_sharding(num_of_instances, instance_id, sharding_group) without return types