class_docstr: Meter to calculate mean AP metric for multi-label image classification task.
  
  Args:
      meters_config (AttrDict): config containing the meter settings
  
  meters_config should specify the num_classes
class_docstr_tok: ["Meter","to","calculate","mean","AP","metric","for","multi-label","image","classification","task",".","Args",":","meters_config","(","AttrDict",")",":","config","containing","the","meter","settings","meters_config","should","specify","the","num_classes"]
docstr: Do a gather over all embeddings, so we can compute the loss.
  Final shape is like: (batch_size * num_gpus) x embedding_dim
docstr_tok: ["Do","a","gather","over","all","embeddings",",","so","we","can","compute","the","loss",".","Final","shape","is","like",":","(","batch_size","*","num_gpus",")","x","embedding_dim"]
code: def gather_targets(self, targets: torch.Tensor):
      """
      Do a gather over all embeddings, so we can compute the loss.
      Final shape is like: (batch_size * num_gpus) x embedding_dim
      """
      if (
          torch.distributed.is_available()
          and torch.distributed.is_initialized()
      ):
          # gather all embeddings.
          targets_gathered = gather_from_all(targets)
      else:
          targets_gathered = targets
      return targets_gathered
  
imports: import logging
  import numpy
  import torch
  from classy_vision.generic.distributed_util import all_reduce_sum, gather_from_all
  from classy_vision.meters import ClassyMeter, register_meter
  from vissl.config import AttrDict
  from vissl.utils.env import get_machine_local_and_dist_rank
  from vissl.utils.svm_utils.evaluate import get_precision_recall
label_desc: Use image node_id 6 for calling the MeanAPMeter obj's underlying member method code with example usage: obj.gather_targets(targets) and returns: targets_gathered