def METHOD_NAME(self, x: List[Dict]):
    """
    Collate a list of dictionaries into one.
    Each value is a tensor concatenated from a list of batch tensors.
    Parameters
    ----------
    x
        A list of batch results. Each batch is one (nested) dictionary.
    """
    results = dict()
    if len(x[0]) == 0:  # dict is empty
        return dict()
    for k, v in x[0].items():
        if k == WEIGHT:  # ignore the key
            continue
        elif isinstance(v, dict):
            results[k] = self.METHOD_NAME([i[k] for i in x])
        elif isinstance(v, torch.Tensor):
            results[k] = torch.cat([i[k] for i in x])
        else:
            raise ValueError(
                f"Unsupported data type {type(v)} is found in prediction results. "
                f"We only support dictionary with torch tensor values."
            )
    return results