code: def ensure_dict_value_to_list_(
      head_outputs: dict[str, list[Tensor]],
      keys: list[str] | None = None,
  ) -> None:
      """
      An in-place function. We expect ``head_outputs`` to be Dict[str, List[Tensor]].
      Yet if it is Dict[str, Tensor], this func converts it to Dict[str, List[Tensor]].
      It will be modified in-place.
  
      Args:
          head_outputs: a Dict[str, List[Tensor]] or Dict[str, Tensor], will be modifier in-place
          keys: the keys in head_output that need to have value type List[Tensor]. If not provided, will use head_outputs.keys().
      """
      if keys is None:
          keys = list(head_outputs.keys())
  
      for k in keys:
          value_k = head_outputs[k]  # Tensor or List[Tensor]
          # convert value_k to List[Tensor]
          if isinstance(value_k, Tensor):
              head_outputs[k] = [value_k]
          elif isinstance(value_k[0], Tensor):
              head_outputs[k] = list(value_k)
          else:
              raise ValueError(
                  "The output of network should be Dict[str, List[Tensor]] or Dict[str, Tensor]."
              )
  
file_path: MONAI/monai/apps/detection/utils/predict_utils.py
imports: from __future__ import annotations
  import torch
  from torch import Tensor, nn
  from monai.inferers import SlidingWindowInferer
label_desc: Use image node_id 1 for calling a global function with example usage: ensure_dict_value_to_list_(head_outputs, keys) without return types