code: def _network_sequence_output(
      images: Tensor, network: nn.Module, keys: list[str] | None = None
  ) -> list[Tensor]:
      """
      Decompose the output of network (a dict) into a list.
  
      Args:
          images: input of the network
          keys: the keys in the network output whose values will be output in this func.
              If not provided, will use all keys.
  
      Return:
          network output values concat to a single List[Tensor]
      """
      head_outputs = network(images)
  
      # if head_outputs is already a sequence of tensors, directly output it
      if isinstance(head_outputs, (tuple, list)):
          return list(head_outputs)
  
      # if head_outputs is a dict
      ensure_dict_value_to_list_(head_outputs, keys)
      if keys is None:
          keys = list(head_outputs.keys())
      check_dict_values_same_length(head_outputs, keys)
      head_outputs_sequence = []
      for k in keys:
          head_outputs_sequence += list(head_outputs[k])
      return head_outputs_sequence
  
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 3 for calling a global function with example usage: _network_sequence_output(images, network, keys) and returns: head_outputs_sequence, list