class_docstr: A light-weight wrapper class for torch.distributed API.
  Only a subset of functions are wrapped. Once the init_process_group
  is initialized, standard torch.distributed.* can be used directly
  so no need to wrap all the functions. We can keep adding wrappers as
  needed.
class_docstr_tok: ["A","light-weight","wrapper","class","for","torch.distributed","API",".","Only","a","subset","of","functions","are","wrapped",".","Once","the","init_process_group","is","initialized",",","standard","torch.distributed",".","*","can","be","used","directly","so","no","need","to","wrap","all","the","functions",".","We","can","keep","adding","wrappers","as","needed","."]
docstr: Helper function. If the op provided is not a torch.dist.ReduceOp, convert it and return
docstr_tok: ["Helper","function",".","If","the","op","provided","is","not","a","torch.dist.ReduceOp",",","convert","it","and","return"]
code: def _reduce_op(self, op):
      """
      Helper function. If the op provided is not a torch.dist.ReduceOp, convert it and return
      """
      if not isinstance(op, torch.distributed.ReduceOp):
          if op == ReduceOp.SUM:
              op = torch.distributed.ReduceOp.SUM
          elif op == ReduceOp.PRODUCT:
              op = torch.distributed.ReduceOp.PRODUCT
          elif op == ReduceOp.AVG:
              op = torch.distributed.ReduceOp.AVG
          elif op == ReduceOp.MIN:
              op = torch.distributed.ReduceOp.MIN
          elif op == ReduceOp.MAX:
              op = torch.distributed.ReduceOp.MAX
          elif op == ReduceOp.BAND:
              op = torch.distributed.ReduceOp.BAND
          elif op == ReduceOp.BOR:
              op = torch.distributed.ReduceOp.BOR
          elif op == ReduceOp.BXOR:
              op = torch.distributed.ReduceOp.BXOR
      return op
  
imports: from deepspeed import utils
  from .utils import *
  from .backend import *
  from .comm import *
label_desc: Use image node_id 27 for calling the TorchBackend obj's underlying member method code with example usage: obj._reduce_op(op) and returns: op