class_docstr: Collective operations using `torch.distributed <https://pytorch.org/docs/stable/distributed.html>`__.
  
  .. warning:: This is an :ref:`experimental <versioning:Experimental API>` feature which is still in development.
class_docstr_tok: ["Collective","operations","using","`","torch.distributed","<","https",":","\/\/pytorch.org\/docs\/stable\/distributed.html",">","`","__",".","..","warning",":",":","This","is","an",":","ref",":","`","experimental","<","versioning",":","Experimental","API",">","`","feature","which","is","still","in","development","."]
code: def _convert_to_native_op(
      cls, op: Union[str, ReduceOp, RedOpType]
  ) -> Union[ReduceOp, RedOpType]:
      # in 1.13, `ReduceOp` has become an empty shell for `RedOpType`, the latter being the actually returned class.
      # for example, `ReduceOp.SUM` returns a `RedOpType.SUM`. the only exception is `RedOpType.PREMUL_SUM` where
      # `ReduceOp` is still the desired class, but it's created via a special `_make_nccl_premul_sum` function
      if (
          isinstance(op, ReduceOp)
          or _TORCH_GREATER_EQUAL_1_13
          and isinstance(op, RedOpType)
      ):
          return op
      if not isinstance(op, str):
          raise ValueError(
              f"Unsupported op {op!r} of type {type(op).__name__}"
          )
      op = op.upper()
      # `ReduceOp` should contain `RedOpType`'s members
      value = getattr(ReduceOp, op, None)
      if value is None:
          raise ValueError(f"op {op!r} is not a member of `ReduceOp`")
      return value
  
imports: import datetime
  import os
  from typing import Any, List, Optional, Union
  import torch
  import torch.distributed
  from torch import Tensor
  from typing_extensions import Self, override
  from lightning.fabric.plugins.collectives.collective import Collective
  from lightning.fabric.utilities.imports import _TORCH_GREATER_EQUAL_1_13
  from lightning.fabric.utilities.types import CollectibleGroup, RedOpType, ReduceOp
label_desc: Use image node_id 28 for calling the TorchCollective obj's underlying member method code with example usage: obj._convert_to_native_op(cls, op) and returns: value, op