code: def _infer_output_shape(output: ValueInfoProto):
      """
      TODO: short documentation.
      """
      output_shape = []
      for dim in output.type.tensor_type.shape.dim:
          if getattr(dim, "dim_param"):
              output_shape.append(getattr(dim, "dim_param"))
          elif getattr(dim, "dim_value"):
              output_shape.append(getattr(dim, "dim_value"))
          else:
              raise ValueError(
                  "Cannot find `dim_param` nor `dim_value` in the output dimension info."
              )
  
      return output_shape
  
imports: import hashlib
  from collections import defaultdict
  from typing import TYPE_CHECKING, Any, DefaultDict, Dict, List, Set, Tuple
  import numpy
  import onnx
  from onnx import ModelProto, ValueInfoProto, numpy_helper
  from ..utils import logging, recurse_getattr
label_desc: Use image node_id 5 for calling a global function with example usage: _infer_output_shape(output) and returns: output_shape