class_docstr: Implements distributed data parallelism at the module level.
  
  A simplified version of :class:`torch.nn.parallel.DistributedDataParallel`.
  This version uses a c10d process group for communication and does not
  broadcast buffers.
  
  Args:
      module (~torch.nn.Module): module to be parallelized
      process_group: the c10d process group to be used for distributed data
          parallel all-reduction.
      buffer_size (int, optional): number of elements to buffer before
          performing all-reduce (default: 256M).
class_docstr_tok: ["Implements","distributed","data","parallelism","at","the","module","level",".","A","simplified","version","of",":","class",":","`","torch.nn.parallel.DistributedDataParallel","`",".","This","version","uses","a","c10d","process","group","for","communication","and","does","not","broadcast","buffers",".","Args",":","module","(","~torch.nn.Module",")",":","module","to","be","parallelized","process_group",":","the","c10d","process","group","to","be","used","for","distributed","data","parallel","all-reduction",".","buffer_size","(","int",",","optional",")",":","number","of","elements","to","buffer","before","performing","all-reduce","(","default",":","256M",")","."]
docstr: A context manager to disable gradient synchronization.
docstr_tok: ["A","context","manager","to","disable","gradient","synchronization","."]
code: def no_sync(self):
      """A context manager to disable gradient synchronization."""
      old_accumulate_grads = self.accumulate_grads
      self.accumulate_grads = True
      yield
      self.accumulate_grads = old_accumulate_grads
  
file_path: fairseq/fairseq/distributed/legacy_distributed_data_parallel.py
imports: from collections import OrderedDict
  from contextlib import contextmanager
  import torch
  from torch import nn
  from fairseq.distributed import utils
label_desc: Use image node_id 2 for calling the LegacyDistributedDataParallel obj's underlying member method code with example usage: obj.no_sync() without return types