code: def _load_tensorvalue(tensorvalue_spec):
      if not isinstance(tensorvalue_spec, pm.TensorValue):
          raise TypeError("Invalid TensorValue spec object")
  
      if tensorvalue_spec.WhichOneof("value") == "floats":
          return tensorvalue_spec.floats.values
      elif tensorvalue_spec.WhichOneof("value") == "ints":
          return tensorvalue_spec.ints.values
      elif tensorvalue_spec.WhichOneof("value") == "bools":
          return tensorvalue_spec.bools.values
      elif tensorvalue_spec.WhichOneof("value") == "strings":
          return tensorvalue_spec.strings.values
      elif tensorvalue_spec.WhichOneof("value") == "longInts":
          return tensorvalue_spec.longInts.values
      elif tensorvalue_spec.WhichOneof("value") == "doubles":
          return tensorvalue_spec.doubles.values
      elif tensorvalue_spec.WhichOneof("value") == "bytes":
          return tensorvalue_spec.bytes.values
      else:
          raise ValueError("Invalid dtype for TensorValue type")
  
imports: import os
  import numpy
  from coremltools import _logger
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget
  from coremltools.converters.mil.backend.mil import helper
  from coremltools.converters.mil.mil import Block
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import Function, ListVar, Placeholder, Program, TupleInputType, Var, mil_list, types
  from coremltools.converters.mil.mil.block import curr_block
  from coremltools.converters.mil.mil.ops.registry import SSAOpRegistry
  from coremltools.proto import MIL_pb2
  from coremltools.proto import Model_pb2
  from .helper import proto_to_types
label_desc: Use image node_id 1 for calling a global function with example usage: _load_tensorvalue(tensorvalue_spec) and returns: tensorvalue_spec, tensorvalue_spec, tensorvalue_spec, tensorvalue_spec, tensorvalue_spec, tensorvalue_spec, tensorvalue_spec