class_docstr: Tests ``FullyShardedDataParallel``'s collective communication usage.
docstr: Returns the reference number of reduce-scatters for an iteration
  in the ``no_sync()`` context.
docstr_tok: ["Returns","the","reference","number","of","reduce-scatters","for","an","iteration","in","the","``","no_sync","(",")","``","context","."]
code: def _get_ref_num_reduce_scatters(
      self,
      num_fsdp: int,
      in_no_sync: bool,
  ) -> int:
      """Returns the reference number of reduce-scatters for an iteration
      in the ``no_sync()`` context."""
      return num_fsdp if not in_no_sync else 0
  
imports: import sys
  from contextlib import nullcontext
  from enum import auto, Enum
  from typing import Optional
  from unittest.mock import patch
  import torch
  from torch import distributed
  from torch.distributed.fsdp import FullyShardedDataParallel
  from torch.distributed.fsdp.fully_sharded_data_parallel import ShardingStrategy
  from torch.testing._internal.common_distributed import skip_if_lt_x_gpu
  from torch.testing._internal.common_fsdp import CUDAInitMode, FSDPInitMode, FSDPTest, NestedWrappedModule, TransformerWithSharedParams
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, TEST_WITH_DEV_DBG_ASAN
label_desc: Use image node_id 3 for calling the TestCommunication obj's underlying member method code with example usage: obj._get_ref_num_reduce_scatters(num_fsdp, in_no_sync) and returns: unknown