code: def values_from_const(node_def: node_def_pb2.NodeDef) -> np.ndarray:
      """Extracts the values from a const NodeDef as a numpy ndarray.
  
      Args:
        node_def: Const NodeDef that has the values we want to access.
  
      Returns:
        Numpy ndarray containing the values.
  
      Raises:
        ValueError: If the node isn't a Const.
      """
      if node_def.op != "Const":
          raise ValueError(
              "Can not extract constant value from a node that is not Const. Got:\n"
              f"{node_def}"
          )
      input_tensor = node_def.attr["value"].tensor
      tensor_value = tensor_util.MakeNdarray(input_tensor)
      return tensor_value
  
imports: import collections
  import math
  import re
  from typing import Mapping, Sequence
  import numpy
  from tensorflow.core.framework import attr_value_pb2
  from tensorflow.core.framework import graph_pb2
  from tensorflow.core.framework import node_def_pb2
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import graph_util
  from tensorflow.python.framework import tensor_util
  from tensorflow.python.platform import flags
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.tools import strip_unused_lib
label_desc: Use image node_id 8 for calling a global function with example usage: values_from_const(node_def) and returns: tensor_value