class_docstr: Class for registry object which acts as central source of truth
  for MMF
docstr: Register a torchmetric to registry with key 'name'
  
  Args:
      name: Key with which the torchmetric will be registered.
  
  Usage::
  
      from mmf.common.registry import registry
      from torchmetrics.metric import Metric
  
      @registry.register_torchmetric("topk_accuracy")
      class TopKAccuracy(Metric):
          ...
docstr_tok: ["Register","a","torchmetric","to","registry","with","key","'name'","Args",":","name",":","Key","with","which","the","torchmetric","will","be","registered",".","Usage",":",":","from","mmf.common.registry","import","registry","from","torchmetrics.metric","import","Metric","@","registry.register_torchmetric","(","``","topk_accuracy","''",")","class","TopKAccuracy","(","Metric",")",":","..."]
code: def register_torchmetric(cls, name):
      r"""Register a torchmetric to registry with key 'name'
  
      Args:
          name: Key with which the torchmetric will be registered.
  
      Usage::
  
          from mmf.common.registry import registry
          from torchmetrics.metric import Metric
  
          @registry.register_torchmetric("topk_accuracy")
          class TopKAccuracy(Metric):
              ...
      """
  
      def wrap(func):
          from torchmetrics.metric import Metric
  
          assert issubclass(
              func, Metric
          ), "All metric must inherit Metric class"
          cls.mapping["torchmetric_name_mapping"][name] = func
          return func
  
      return wrap
  
imports: from mmf.utils.env import setup_imports
label_desc: Use image node_id 5 for calling the Registry obj's underlying member method code with example usage: obj.register_torchmetric(cls, name) and returns: wrap, func