code: def _need_fp16_cast_pass(
      compute_precision: Optional[
          Union[precision, FP16ComputePrecision]
      ],
      convert_to: Text,
  ) -> bool:
      if convert_to not in (
          "mlprogram",
          "neuralnetwork",
          "milinternal",
          "milpython",
      ):
          raise NotImplementedError(
              f"Backend converter {convert_to} not implemented"
          )
  
      if compute_precision is None:
          return convert_to != "neuralnetwork"
      elif compute_precision == precision.FLOAT32:
          return False
      elif compute_precision == precision.FLOAT16 or isinstance(
          compute_precision, FP16ComputePrecision
      ):
          return True
      else:
          raise ValueError(
              f"Invalid value of the argument 'compute_precision': {compute_precision}"
          )
  
imports: import collections
  import gc
  import os
  from typing import List, Optional, Text, Union
  from coremltools import _LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_MILPROGRAM, _LOWEST_ALLOWED_SPECIFICATION_VERSION_FOR_NEURALNETWORK
  from coremltools import ComputeUnit
  from coremltools import __version__
  from coremltools import _logger
  from coremltools._deps import _HAS_TF_1, _HAS_TF_2, _HAS_TORCH, _HAS_TORCH_EXPORT_API
  from coremltools.converters._profile_utils import _profile
  from coremltools.converters.mil._deployment_compatibility import AvailableTarget, check_deployment_compatibility
  from coremltools.converters.mil.converter import mil_convert
  from coremltools.converters.mil.input_types import ClassifierConfig, EnumeratedShapes, ImageType, InputType, RangeDim, Shape, TensorType
  from coremltools.converters.mil.mil import Program, types
  from coremltools.converters.mil.mil.passes.defs.quantization import ComputePrecision
  from coremltools.converters.mil.mil.passes.defs.quantization import FP16ComputePrecision
  from coremltools.converters.mil.mil.passes.graph_pass import PassOption
  from coremltools.converters.mil.mil.passes.pass_pipeline import PassPipeline
  from coremltools.models import _METADATA_SOURCE, _METADATA_SOURCE_DIALECT, _METADATA_VERSION
  from coremltools.models.utils import _MLPACKAGE_EXTENSION
label_desc: Use image node_id 2 for calling a global function with example usage: _need_fp16_cast_pass(compute_precision, convert_to) and returns: unknown, False, True