code: def _get_leaf_components(
      input_module: tf.Module,
  ) -> Mapping[Path, LeafVariable]:
      """
      Returns a list of tuples each corresponding to a gpflow.Parameter or tf.Variable in the each
      submodules of a given tf.Module. Each tuple consists of an specific Parameter (or Variable) and
      its relative path inside the module, which is constructed recursively by adding a prefix with
      the path to the current module. Designed to be used as a helper for the method 'print_summary'.
  
      :param input_module: tf.Module including keras.Model, keras.layers.Layer and gpflow.Module.
      :return:
      """
      target_types = (Parameter, tf.Variable)
      input_name = input_module.__class__.__name__
      state: Dict[Path, LeafVariable] = {}
      accumulator = (input_name, state)
  
      def update_state(
          parameter_or_variable: LeafVariable,
          path: Path,
          state: Dict[Path, LeafVariable],
      ) -> Dict[Path, LeafVariable]:
          state[path] = parameter_or_variable
          return state
  
      state = traverse_module(
          input_module, accumulator, update_state, target_types
      )
      return state
  
imports: import copy
  import re
  from functools import lru_cache
  from typing import Any, Callable, Dict, Mapping, Optional, Pattern, Tuple, Type, TypeVar, Union
  import numpy
  import tensorflow
  import tensorflow_probability
  from packaging.version import Version
  from tabulate import tabulate
  from tensorflow.python.util.object_identity import Reference
  from ..base import AnyNDArray, Parameter
  from ..config import default_summary_fmt
label_desc: Use image node_id 8 for calling a global function with example usage: _get_leaf_components(input_module) and returns: state, state