code: def gather(emb, labels):
      device = emb.device
      if labels is not None:
          labels = c_f.to_device(labels, device=device)
      dist_emb, dist_labels = all_gather_embeddings_and_labels(
          emb, labels
      )
      all_emb = torch.cat([emb, dist_emb], dim=0)
      all_labels = (
          torch.cat([labels, dist_labels], dim=0)
          if dist_labels is not None
          else None
      )
      return all_emb, all_labels, labels
  
imports: import torch
  from ..losses import BaseMetricLossFunction, CrossBatchMemory
  from ..miners import BaseMiner
  from ..utils import common_functions
  from ..utils import loss_and_miner_utils
label_desc: Use image node_id 4 for calling a global function with example usage: gather(emb, labels) and returns: all_emb,  all_labels,  labels