code: def _yield_fractional_labels(
      label: np.ndarray,
      prediction: np.ndarray,
      example_weight: np.ndarray,
  ) -> Iterable[Tuple[np.ndarray, np.ndarray, np.ndarray]]:
      """Yields (label, prediction, example_weight) applying fractional labels.
  
      The incoming label, prediction, and example weights will be split into two
      tuples such that if l, p, w represent the resulting tuple values we will get:
        (1) l = 0.0, p = prediction, and w = example_weight * (1.0 - label)
        (2) l = 1.0, p = prediction, and w = example_weight * label
  
      Args:
        label: Label.
        prediction: Prediction.
        example_weight: Example weight.
  
      Raises:
        ValueError: If labels are not within [0, 1].
      """
      # Verify that labels are also within [0, 1]
      if not within_interval(float(label), 0.0, 1.0):
          raise ValueError(
              f"label must be within [0, 1]: label={label}, prediction={prediction}, "
              f"example_weight={example_weight}"
          )
      for l, w in (
          (
              np.array([0], dtype=label.dtype),
              example_weight * (1 - label),
          ),
          (np.array([1], dtype=label.dtype), example_weight * label),
      ):
          if not math.isclose(w, 0.0):
              yield (l, prediction, w)
  
imports: import inspect
  import math
  from typing import Any, Callable, Dict, Iterable, Iterator, List, Mapping, Optional, Tuple, Union
  import numpy
  import tensorflow
  from tensorflow_model_analysis import constants
  from tensorflow_model_analysis.api import types
  from tensorflow_model_analysis.metrics import metric_types
  from tensorflow_model_analysis.proto import config_pb2
  from tensorflow_model_analysis.utils import util
  from tensorflow_metadata.proto.v0 import schema_pb2
label_desc: Use image node_id 18 for calling a global function with example usage: _yield_fractional_labels(label, prediction, example_weight) without return types