code: def generate_model_outputs_using_core_keras_layers(
      input_model: tf.keras.Model,
      custom_layer_set: Optional[
          Set[type]
      ] = None,  # pylint: disable=g-bare-generic
  ) -> type_aliases.PackedTensors:
      """Returns the model outputs generated by only core Keras layers.
  
      Args:
        input_model: A `tf.keras.Model` instance to obtain outputs from.
        custom_layer_set: An optional `set` of custom layers to expand. If `None`,
          then this is the set of all registered custom Keras layers.
  
      Returns:
        A `tf.Tensor` that is the result of `input_model(input_model.inputs)`
        using only Keras layers that are not in `custom_layer_set`.
      """
      # Set up helper variables and functions.
      custom_layer_set = (
          custom_layer_set
          or tf.keras.utils.get_custom_objects().values()
      )
  
      def _is_core(layer_instance):
          return type(layer_instance) not in custom_layer_set
  
      def generator_fn(layer_instance, args, kwargs):
          # Using `.call()` does not register the layer in the compute graph of
          # a forward pass.
          layer_outputs = (
              layer_instance(*args, **kwargs)
              if _is_core(layer_instance)
              else layer_instance.call(*args, **kwargs)
          )
          return layer_outputs, None
  
      # Return early if all the existing layers contain only core layers.
      if all(_is_core(layer) for layer in input_model.layers):
          return model_forward_pass(input_model, input_model.inputs)[0]
  
      # Do a forward pass to expand the outermost layers.
      candidate_outputs, _ = model_forward_pass(
          input_model, input_model.inputs, generator_fn
      )
  
      # The following recursion is inefficient because it recursively builds `n`
      # Keras model graphs, where `n` is the number of recursive calls. However,
      # it appears to be the only valid approach without accessing Keras's internal
      # functions (e.g., `keras.engine.functional._map_graph_network()`).
      cleaned_model = tf.keras.Model(
          inputs=input_model.inputs, outputs=candidate_outputs
      )
      return generate_model_outputs_using_core_keras_layers(
          cleaned_model, custom_layer_set
      )
  
file_path: privacy/tensorflow_privacy/privacy/fast_gradient_clipping/gradient_clipping_utils.py
imports: from collections.abc import Sequence, Set
  from typing import Any, Literal, Optional
  from absl import logging
  import tensorflow
  from tensorflow_privacy.privacy.fast_gradient_clipping import layer_registry
  from tensorflow_privacy.privacy.fast_gradient_clipping import type_aliases
label_desc: Use image node_id 5 for calling a global function with example usage: generate_model_outputs_using_core_keras_layers(input_model, custom_layer_set) and returns: generate_model_outputs_using_core_keras_layers, unknown, layer_outputs,  None, model_forward_pass