class_docstr: Contains the compute environment. If not passed, will try to detect.
  
  Args:
      dist_env: The distributed environment (distributed worldsize and global rank)
      worker_env: The worker environment (number of workers, worker rank)
class_docstr_tok: ["Contains","the","compute","environment",".","If","not","passed",",","will","try","to","detect",".","Args",":","dist_env",":","The","distributed","environment","(","distributed","worldsize","and","global","rank",")","worker_env",":","The","worker","environment","(","number","of","workers",",","worker","rank",")"]
docstr: Returns the total number of shards.
  
  Note:
      This may not be accurate in a non-dataloader-worker process like the main training process
      as it doesn't necessarily know about the number of dataloader workers.
docstr_tok: ["Returns","the","total","number","of","shards",".","Note",":","This","may","not","be","accurate","in","a","non-dataloader-worker","process","like","the","main","training","process","as","it","does","n't","necessarily","know","about","the","number","of","dataloader","workers","."]
code: def num_shards(self) -> int:
      """Returns the total number of shards.
  
      Note:
          This may not be accurate in a non-dataloader-worker process like the main training process
          as it doesn't necessarily know about the number of dataloader workers.
  
      """
      assert self.worker_env is not None
      assert self.dist_env is not None
      return self.worker_env.world_size * self.dist_env.world_size
  
file_path: pytorch-lightning/src/lightning/data/utilities/env.py
imports: from typing import Callable, Optional
  import torch
  from torch.utils.data import get_worker_info
label_desc: Use image node_id 3 for calling the Environment obj's underlying member method code with example usage: obj.num_shards() and returns: unknown