code: def stack_batch_scores(elements, device=None):
      """Stack the ``score`` of a batch of :obj:`LabelData` to a tensor.
  
      Args:
          elements (List[LabelData]): A batch of :obj`LabelData`.
          device (torch.device, optional): The output device of the batch label.
              Defaults to None.
      Returns:
          torch.Tensor: The stacked score tensor.
      """
      item = elements[0]
      if "score" not in item._data_fields:
          return None
  
      batch_score = torch.stack([element.score for element in elements])
      if device is not None:
          batch_score = batch_score.to(device)
      return batch_score
  
file_path: mmdetection/mmdet/models/data_preprocessors/reid_data_preprocessor.py
imports: import math
  from numbers import Number
  from typing import Optional, Sequence
  import torch
  import torch.nn.functional
  from mmengine.model import BaseDataPreprocessor, stack_batch
  from mmdet.registry import MODELS
label_desc: Use image node_id 1 for calling a global function with example usage: stack_batch_scores(elements, device) and returns: batch_score, None