code: def _fp32_to_fp16_byte_array(fp32_arr):
      if _np.amax(fp32_arr) >= 65504 or _np.amin(fp32_arr) <= -65504:
          raise Exception(
              "Model cannot be converted as "
              "it has weights that cannot be represented in "
              "half precision.\n"
          )
  
      if _sys.byteorder == "little":
          return _np.float16(fp32_arr).tobytes()
      else:
          return _fp32_to_reversed_fp16_byte_array(fp32_arr)
  
imports: from collections.abc import Iterable
  from functools import lru_cache
  import math
  import os
  import shutil
  import subprocess
  import sys
  import tempfile
  from typing import Optional, Union
  import warnings
  import numpy
  import coremltools
  from coremltools import ComputeUnit
  from coremltools.converters.mil.mil.passes.defs.preprocess import NameSanitizer
  from coremltools.proto import Model_pb2
  import coremltools.proto.MIL_pb2
  from .._deps import _HAS_SCIPY
label_desc: Use image node_id 8 for calling a global function with example usage: _fp32_to_fp16_byte_array(fp32_arr) and returns: _np, _fp32_to_reversed_fp16_byte_array